2023-10-04 03:27 AM
Hi all,
I'm trying to debug a bus fault that happen on a region on ram that is not supposed to exists. MCU has 48kb of RAM, so start from 0x20000000 to 0x2000C000, but i'm able to write 0xFF from 0x2000C000 to 0x20010000.. why??
I can see also some data on 0x20010000, it seems random and i can't change it.
So, why BFAR reports 0x20010000?
The function referenced (and attached) by the program counter is simple and I test it with every possible values.
Thanks
2023-10-04 03:47 AM
An array defined in a function is created on the stack. Perharps, is to big, for your stack definition. Try to define this array as "static". It moves array to lower RAM and there is no need for initialization every time the function is called.
To RAM size. Are you sure the MCU is really from ST? Most of these MCUs are fakes and there's maybe everything there.
2023-10-04 04:47 AM
2023-10-04 06:44 AM
It sure looks like an out of bounds read/write. What code is at 0x0800C7DD? Should be able to track it down to the exact line it occurs on and figure out why an invalid address is in r1.
2023-10-04 07:05 AM
The line correspond to the
j+=k;
inside the while loop of the function.
I've tested the function with every values that v can take, and nothing bad happens.. :downcast_face_with_sweat: