hard20 pts · first answer countsmemory-layoutmcu-architecture
Packed struct crashes a Cortex-M0
Code that works on a Cortex-M4 HardFaults on a Cortex-M0+. What is the most likely reason?
typedef struct __attribute__((packed)) {
uint8_t type;
uint32_t value;
} msg_t;
uint32_t read_value(msg_t *m) {
uint32_t *p = &m->value;
return *p;
}Discussion 0
Join free to post in the discussion.
Related questions
- What lives in .bssEmbedded Systems Engineer
- Keeping a table out of RAMEmbedded Systems Engineer
- First byte in memoryEmbedded Systems Engineer
- The interrupt vector tableEmbedded Systems Engineer
- Initialised global reads garbageEmbedded Systems Engineer
- Cortex-M interrupt priority numbersEmbedded Systems Engineer
- ISR runs twice per eventEmbedded Systems Engineer