Attempt to reach memory out flash boundaries

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Attempt to reach memory out flash boundaries

575 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by oceaneGu on Wed Aug 06 08:17:49 MST 2014
Hi everyone,

I am running a graphical application (emwin) on an Embedded Artist LPC1788 evaluation board using lpcxpresso.
At some point in my code, while refreshing the LCD screen, the software attempt to reach an address out the internal flash memory boudaries.

I made my own linker script (attached here) from a generated linker script but I meet the same problem with the managed linker script (all semihosted).
You will find attached the registers values when the hardfault is met ans the disassembly of the area.

Is there anything to add in the linker script in order to avoid this problem ?

Original Attachment has been moved to: Registers.txt.zip

Original Attachment has been moved to: Disassembly.txt.zip

Original Attachment has been moved to: LinkerScript_Debug.txt.zip

Labels (1)
0 Kudos
4 Replies

508 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by oceaneGu on Thu Aug 07 01:35:19 MST 2014
Ok, thank you for giving me an idea of what I am looking for :)

0 Kudos

508 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Aug 07 01:18:35 MST 2014
...because of a BUG in your code.

As explained in the FAQ, the most likely causes of this sort of problem are memory/stack corruption. If you are exceeding the length of a buffer (and so overwriting the memory that follows), or overwriting the memory occupied by the stack (and so corrupting local variables, or overwriting function return address, or...), or any number of other similar bugs, then anything can happen.

Sorry, but you are going to have to debug your code to find your bug.
0 Kudos

508 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by oceaneGu on Thu Aug 07 00:40:28 MST 2014
Hi,

Thank you for your answer. However your link does not give me much more information than those I extracted in the files "Registers.txt" and "Disassembly.txt" above.

In the Register file, you can read the address 0xadf0 in the PC register.
In the Disassembly file, the address 0xadf0 corresponds to the instruction "ldr     r5, [r1, #0]", while emWin GUI is trying  to update the screen (at that moment, emwin is doing its own stuff).
However, at that right moment, R1 contains the addresse 0x80050 while the flash memory end at 0x80000. So it points at nothing.

I do not understand how I could reach this point. Any idea ?
0 Kudos

508 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Aug 06 08:41:01 MST 2014
This is caused by a bug in your code - nothing to do with Linker scripts. You will need to run a debugger to find out what is going wrong. For information on debugging the cause of a hard fault (including possible, but not exclusive, causes), see this FAQ:

http://www.lpcware.com/content/faq/lpcxpresso/debugging-hard-fault
0 Kudos