Skip to content
RED SAGSkills
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;
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions