cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103RCT6 - BusFault on address 0x20010000

rdzdvd
Associate II

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??

rdzdvd_0-1696414700487.png

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

4 REPLIES 4
ONadr.1
Senior III

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.

 

Nice answer, that array should become a const or, at least, static as you suggest.

To RAM size, i'm pretty sure it is. I can attach a photo.

TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
rdzdvd
Associate II

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: