Hard fault Issue with LPC1850

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

Hard fault Issue with LPC1850

576 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Noufal on Fri Oct 30 07:13:50 MST 2015
I'm facing  Hard fault issue during boot process

Controller used is LPC1850 , application using following interface NOR flash, SPIFI, and SDRAM and LCD(3.2 inch and 7 inch variant).
We are using Keil development environment, application using RTX, emwin, File  system etc. Currently we are booting from NOR flash (because 1850 is  flash less part), As we added more code we started getting memory conflict issue 's(Hard Fault). The recent code addition was using emwin menu, but i also found that if i add static/global variables then also i'm getting the  issue. The issue happening before it even reaching main, look like stack is getting corrupted. I have placed   startup_LPC18xx.o,system_LPC18xx.o  under internal SRAM, but i do see some time the memory is going to beyond it's range or SDRAM location while stepping through this file in debugger, Not sure what is happening

Attaching the scatter file

Tried the following so far

1.Increased the Heap(0x8000) and Stack (0x5000)  in system init
2. Increased RTX Task memory
3. Increased GUI memory in GUI config



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

Labels (1)
0 Kudos
5 Replies

421 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Sun Jan 31 19:48:37 MST 2016
Hi Noful,
Please check the map file to confirm that all init functions are with in 16kB memory space.
0 Kudos

421 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Noufal on Tue Jan 26 10:37:38 MST 2016
Hi MC,
I moved my startup files to NOR flash, still i 'm having the  issue . Is there any other way i can make sure entire NOR flash is initialized ?
0 Kudos

421 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Wed Dec 02 13:50:00 MST 2015
Hi Noufal,
Can you please make sure that external parallel NOR flash initialization routines are with-in first 16KB of memory space?  When booting without header, Boot ROM will initialize only up to 16KB(A0-A13).
Similarly, try to  put SPIFI lib in the beginning of memory space allocated to SPIFI devices.
0 Kudos

421 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Noufal on Wed Dec 02 10:12:56 MST 2015
It looks like it starts failing when the size of the image in External NOR flash(S29GL064N) gets above a certain range (~1735550 bytes). I also noticed that in SPIFI (S25FL256) beyond ~7MB  it starts failing. It's get into hard fault in these situations,  Any idea what is going on here ?

0 Kudos

421 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bavarian on Tue Nov 03 07:42:50 MST 2015
If the hard fault happens before main(), then it for sure happens in the code the linker inserts for initializing memory and relocating code. You don't see this code in your source code, only in assembler. When you jump from your source code into these embedded library code (at the end of the sys_init and just before main()  ), you need to set the cursor into the assembler window to continue with stepping, otherwise it runs into the hard fault directly.

So something in your memory setup is not correct, the init code seems to overwrite something or writes outside memory boundaries.
You need to find the mismatch here.
The debugger should also be able to provide you with more info about the reason of the hard fault.

Regards,
NXP Support Team
0 Kudos