STM32F103RCT6 - BusFault on address 0x20010000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 3: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
- Labels:
-
RAM
-
STM32F1 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 3: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 4:47 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 6: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 7: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:
