Skip to content

Commit c06ecbe

Browse files
committed
The IAR compilier does not resolve references to fields in the anonymous structs defined within the usbh_dev0_t and usbh_device_t structs as they are defined. The problem seems to relate to the placement of the 'volatile' keyword at the struct level. I fixed the problem by removing the 'volatile' from the struct level, and instead placing it on each of the field declarations within the structs.
1 parent b797d1a commit c06ecbe

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/host/usbh.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ typedef struct
6262
uint8_t hub_port;
6363
uint8_t speed;
6464

65-
volatile struct TU_ATTR_PACKED
65+
struct TU_ATTR_PACKED
6666
{
67-
uint8_t connected : 1;
68-
uint8_t addressed : 1;
69-
uint8_t configured : 1;
70-
uint8_t suspended : 1;
67+
volatile uint8_t connected : 1;
68+
volatile uint8_t addressed : 1;
69+
volatile uint8_t configured : 1;
70+
volatile uint8_t suspended : 1;
7171
};
7272
} usbh_dev0_t;
7373

@@ -78,12 +78,12 @@ typedef struct {
7878
uint8_t hub_port;
7979
uint8_t speed;
8080

81-
volatile struct TU_ATTR_PACKED
81+
struct TU_ATTR_PACKED
8282
{
83-
uint8_t connected : 1;
84-
uint8_t addressed : 1;
85-
uint8_t configured : 1;
86-
uint8_t suspended : 1;
83+
volatile uint8_t connected : 1;
84+
volatile uint8_t addressed : 1;
85+
volatile uint8_t configured : 1;
86+
volatile uint8_t suspended : 1;
8787
};
8888

8989
//------------- device descriptor -------------//

0 commit comments

Comments
 (0)