2021-04-01 08:56 PM
Hi,
I checked with the test code below, and it sets the hard fault for the G0 controller. It looks like an alignment issue. But the same code runs fine with L4 and F4 microcontrollers and does not set any fault for misaligned assignments. Project settings for all the 3 controllers was default generated by the ST Cube IDE. So is this an issue with the microcontroller G0 where I am facing this issue currently ?
This test code fails for G0 but passes for L4 and F4 controllers
UI_8 Buffer[16] = {0};
*(UI_16*)(Buffer+1)=*(UI_16*)(Buffer+1); // Code goes to hard fault at this line.
// Buffer + 1 is not a 4 byte aligned address.
Thanks,
Nilesh
2021-04-01 09:06 PM
The CortexM0 does not tolerate misaligned word access.