I am using the MIMXRT1050 board with the Keilv5 Pro IDE. I am having problems attempting to create a secondary bootloader which will copy the binary file of a second project to external RAM then jump to RAM to continue execution. I am using QSPI flash which starts at address 0x6000_0000 and external SDRAM starting at address 0x8000_0000.
My goal is to create two projects, one will be my bootloader project and the second is my application project. The bootloader project will be run in flash just like the demo examples. My bootloader project will test the external RAM using a write and read test, then if there are no errors, the bootloader will use memcpy to copy the application binary located in flash at 0x6010_0000 to RAM at 0x8000_0000 and jump to that address to continue execution.
I am currently manually programming the flash using the JFlash app and JTAG flasher. First I build my bootloader project and create a binary file of the project, I do the same with my application project. Now, using the two binary files, I place the bootloarder binary file at 0x6000_0000 and the application project binary at 0x6010_0000. Once I reset the board, the bootloader project starts and copies the application binary from 0x6010_0000 to external RAM at 0x8000_0000 then jumps to 0x8000_0000 to continue execution. Currently, my bootloader is working fine and I confirmed all the data is copied correctly.
Once I jump to the external RAM for my application project, the board seems to hang. If I make my application project very small (7kB) the whole application project works fine. When I add code to the application project making it (11kB), the program hangs. I am using blinky demo project to debug my problem. If I edit the blinky project to blink 5 times (7kB bin size) the whole application project works. If I edit the blinky project to blink 8 times (11kB bin size) the application project hangs after the 4th set of blinks. Any print statements causes the hang, so it is hard to debug.
Another note, if I leave the board off for a few minutes and try to run the 8 blink application project again it works and does not hang anywhere. My debugging has not been consistent, sometimes the application will run without errors and hanging then other times it keeps hanging in the same spot. I also tried to clear the RAM by writing zeros to every location before copying my application project but it did not affect anything.
1) Are there any demo or example projects that accomplish similar ideas to my project?
2) Why is making the application project bigger causing an issue with execution in external RAM?
3) What are the required steps and code to jump from flash to external RAM for execution?
It seems there isn't examples could exactly meet your case. But there is examples in SDK_2.7.0_EVKB-IMXRT1050\boards\evkbimxrt1050\bootloader_examples\demo_apps\led_demo_evk_ram. It excutes from target RAM, but it is easily to change to SDRAM. I think the steps to copy and jump to RAM and SDRAM is almost same.
Thanks for showing me the example. I downloaded the SDK and the example worked as expected. The issue is all my work is done on SDK_2.3.0_EVK-MIMXRT1050 and the new SDK_2.7.0_EVKB-IMXRT1050 has a different layout, file structures, and different variable names than the previous SDK.
So when I tried to copy over the source files from the 2.7 SDK to my 2.3 SDK project, I ran into errors and incorrect file paths. Is there anyway to convert my project to the new SDK layout?
Also what happens if I finish my big project and run into an issue like this where the new SDK is needed? My project will not be able to compile anymore, am I just supposed to stick with one version and never change?
You can see that the version iterations of MCUXpresso and SDK are very frequent. I don't think customer must keep up with the iteration steps. And there is no tools can do this convert. You can just use the examples link file and refer to its project configuration. You can pay attention to the release notes to see if there is any useful driver version update.