Maybe someone remember the thread[1] that I created some months ago. I was searching a simple way to save on the external SPI Flash some constant data (mainly bitmaps) and copying them to SDRAM at startup.
I finally put my hands on that project again and I think I've found a good solution.
The MCU (LPC1785 from NXP) has an internal Flash memory starting from
0x0000 0000 and an external SDRAM starting at 0xA000 0000. The first region of SDRAM is dedicated to framebuffer. 0xA008 0000 is the starting address to copy bitmaps from SPI Flash.I'm using MCUXpresso IDE and I created a new *Flash* memory region starting from 0xA008 0000. Yes, I created a Flash region, even if it is RAM. Why? In this way, the linker automatically[2] put all the bitmaps in SDRAM. The USB bootloader knows that data starting from 0xA008 0000 must be saved in external SPI Flash. At startup the application copies from SPI Flash to SDRAM at the correct address and the application runs without problems.
So the debug workflow is very simple. If the bitmaps aren't changed, I can start the debug session without any problem. I don't know what really happens, because the internal Flash is normally written by J-Link, while SPI Flash is ignored. I was worried J-Link or IDE emitted some errors about a non existent Flash at 0xA008 0000 that couldn't be programmed.
If the bitmaps are changed, I use objcopy to extract bitmaps from 0xA008
0000 and generate hex file to use with the USB bootloader. After programming via bootloader, I can start the debug session normally.It's ok, but maybe it can be improved. How to instruct IDE or J-Link to write data to SDRAM at every debug session startup? SDRAM is mapped normally, so the programmer should be able to write to it without any problem. In this way I could avoid USB bootloader for debugging.
[1]