How to debug code in external SDRAM?(LPC1776)

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

How to debug code in external SDRAM?(LPC1776)

525 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by noricmadaito on Mon Sep 10 03:48:10 MST 2012
When I power on the board, Main program on the CPU's Flash ROM is executed. Lets say it is "Program A".
"Program A" is received from user through UART0 and copied to external FlashROM. Lets say the copied program is "Program-B". When all of "Program B" is written on external FlashROM, "Program B" then copied to external SDRAM. And lastly, "Program B" is executed on SDRAM.
On the next Power On, the "Copy from external FlashROM to external SDRAM", and "Execute Program B on SDRAM" steps as mentioned above is repeated.
When I want to debug "Program-B", I have to execute "Program A" first,and then start debugging "Program B". But the problem is,  I couldn't debug the axf file of "Program A".
Yet,When I want to debug Program B's axf file directly, The Program couldn't be executed and "HardFault" warning shown.
Could you please teach me how to debug "Program-B".
0 Kudos
3 Replies

386 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Fri Sep 28 02:24:05 MST 2012
The debugger uses a startup script that you can change.

- Open the Debug configuration for your project
- Switch to the Debugger tab
- Press Edit scripts
- Add your gdb commands
0 Kudos

386 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Fri Sep 28 01:44:58 MST 2012
[FONT=Tahoma][SIZE=2]
Quote: daniel.widyanto
To debug program in SDRAM, you need to init the SDRAM directly from the JTAG (eg. writing to SDRAM registers from JTAG, and enable the SDRAM), then download your 'Program B', along with its debugging symbols, directly to SDRAM address.

I know that Keil and IAR has some script/macro function to ask the JTAG to enable the SDRAM before downloading the AXF file into the SDRAM, but I'm not sure how to do that with LPCXpresso.

[/SIZE][/FONT] [FONT=Tahoma][SIZE=2]
I, too, would really love to know how to provide 'GDB init' scripts with LPCXpresso.

[Code Red: does Red Suit LpcxPresso provide this functionality? It would be a big reason to upgrade!]

It's a bit accedemic for me anyway; at the max clock speed for 1778 (120 MHz), the EMC clock is only 60MHz or less, that part of memory does not support the I-Code AHB bus, will have to compete with data and dma accesses, so will be too slow for (my) practical use.


[/SIZE][/FONT]
0 Kudos

386 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by daniel.widyanto on Fri Sep 28 00:49:24 MST 2012
To debug program in SDRAM, you need to init the SDRAM directly from the JTAG (eg. writing to SDRAM registers from JTAG, and enable the SDRAM), then download your 'Program B', along with its debugging symbols, directly to SDRAM address.

I know that Keil and IAR has some script/macro function to ask the JTAG to enable the SDRAM before downloading the AXF file into the SDRAM, but I'm not sure how to do that with LPCXpresso.
0 Kudos