[cortex-m0] hard fault when -fpack-struct option
Hi,
I have following test case:
typedef struct
{
char a;
long b;
} st_A;
st_A varstructA[3];
int main()
{
long *pb;
int i;
{
}
(*pb)++;
(*pb)++;
return 0;
}
i compile with: arm-none-eabi-gcc -c -mcpu=cortex-m0 -mthumb -O0 -fpack-struct
I get hard fault when executing instructyions of (*pb)++. Because of packing, LDR is trying to access unaligned memory which results in hard fault. This means, we can not use -fpack-struct for cortex-m0 devices at all (as this device does not support unaligned access ldr/str instructions)?
Please let me know.
Thanks,
Mallikarjuna
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Mallikarjun for more information if necessary.