Hello,
I want to download and execute code (for debug purposes) directly from the external sdram. From my research this seems to be possible but requires a script (jlink or gdb) to initialize the external sdram before downloading the code to it.
Anyone knows if there is a script somewhere doing this I can use as a starting point? Or is there a simpler way of doing this?
The mcu used is a LPC54616.
Thanks
/Björn
Thanks for the feedback. Since the post I have been able to initialize the external ram using an init binary flashed by a jlink script. See below. It seems to be mostly stable but now and then we get some issues mainly that the MPU seems not to be configured correctly. Running the init.bin from ram would probably be faster but have not tried it yet and a break point instead of a delay might be a more elegant solution. Any feedback to this solution?
Thanks again
/Björn
int ResetTarget()
{
JLINK_SYS_Report("Init...");
JLINK_TIF_ActivateTargetReset();
JLINK_TIF_ReleaseTargetReset();
JLINK_ExecCommand("erase");
JLINK_ExecCommand("loadbin /.../init.bin, 0x0");
JLINK_ExecCommand("r");
JLINK_ExecCommand("g");
JLINK_SYS_Sleep(500);
JLINK_ExecCommand("h");
// Allow execution form sdram
JLINK_MEM_WriteU32(0xE000ED98, 0); // MPU_RNR
JLINK_MEM_WriteU32(0xE000ED9C, 0xa0000000); // MPU_RBAR
JLINK_MEM_WriteU32(0xE000EDA0, 0x3000027); // MPU_RASR
JLINK_MEM_WriteU32(0xE000ED94, 5); // MPU_CTRL
JLINK_SYS_Report("Init done");
}
Hi @bjorns
Thank you so much for your reply and for your patience.
Regarding your solution, I was wondering, did you tried using some other method like GUI Flash Tool or Flash Magic? Because your solution looks great but I think can be easier those tool to flash a binary to your board.
Please let me know if you have more questions.
Thank you!
Sincerely,
Pablo Avalos.
I suspect this is not really possible via debugger script and ETM. I suppose you need code to initialize the pins and the external bus interface correctly.
At least the document linked by PabloAvalos does not contain any hints in that direction.
Hi @bjorns
I would like to apologize for the delay, we are experiencing a high volume of questions these days. I really appreciate your patience.
Regarding your issue, it exists an application note that might be helpful to resolve your concern. Here you can find it: https://www.nxp.com/docs/en/application-note/AN12423.pdf
Hope this can be helpful, please let me know if you have more questions.
Best Regards.
Pablo Avalos.