RT1050 SDRAM app code boot from SDcard burn with 3 tools
This document is about the RT series app running on the external SDRAM, but boot from SD card. The content contains SDRAM app code generate with the RT1050 SDK MCUXpresso IDE project, burn the code to the external SD card with flashloader MFG tool, and MCUXPresso Secure Provisioning.
The MCUBootUtility method can be found from this post:
https://community.nxp.com/docs/DOC-346194
Software and Hardware platform:
2 RT1050 SDRAM app image generation
Porting SDK_2.7.0_EVKB-IMXRT1050 iled_blinky project to the MCUXPresso IDE, to generate the code which is located in SDRAM, the configuration is modified like the following items:
2.1 Copy code to RAM
2.2 Modify memory location to SDRAM address 0X80002000
The code which boots from SD card and running in the SDRAM is the non-xip code, so the IVT offset is 0X400, in our test, we put the image from the SDRAM memory address 0x800002000, the configuration is:
2.3 Modify the symbol
2.4 Generate the .s19 file
After build has no problems, then generate the app.s19 file:
Rename the app.19 image file to evkbimxrt1050_iled_blinky_sdram_0x2000.s19, and copy it to the flashloader folder:
Flashloader_i.MXRT1050_GA\Flashloader_RT1050_1.1\Tools\elftosb\win
3, Flashloader configuration and download
This chapter will use flashloader to configure the image which can download the SDRAM app code to the external SD card with MFGTool.
We need to prepare the following files:
3.1 SDRAM DCD file preparation
MIMXRT1050-EVKB on board SDRAM is IS42S16160J, we can use the attached dcd_model\ISSI_IS42S16160J\dcd.cfg and dcdgen.exe tool to generate the CFG_DCD.bin, the commander is:
dcdgen -inputfile=dcd.cfg -bout -cout
Copy CFG_DCD.bin file to the flashloader path:
Flashloader_i.MXRT1050_GA\Flashloader_RT1050_1.1\Tools\elftosb\win
3.2 imx-sdram-unsigned-dcd.bd file
Prepare the imx-sdram-unsigned-dcd.bd file content as:
options {
flags = 0x00;
startAddress = 0x80000000;
ivtOffset = 0x400;
initialLoadSize = 0x2000;
DCDFilePath = "CFG_DCD.bin";
# Note: This is required if the default entrypoint is not the Reset_Handler
# Please set the entryPointAddress to Reset_Handler address
entryPointAddress = 0x800022f1;
}
sources {
elfFile = extern(0);
}
section (0)
{
}
The above entrypointAddress data is from the .s19 reset handler(0X80002000+4 address data):
Copy imx-sdram-unsigned-dcd.bd file to flashloader path:
Flashloader_i.MXRT1050_GA\Flashloader_RT1050_1.1\Tools\elftosb\win
Open cmd, run the following command:
elftosb.exe -f imx -V -c imx-sdram-unsigned-dcd.bd -o ivt_evkbimxrt1050_iled_blinky_sdram_0x2000.bin evkbimxrt1050_iled_blinky_sdram_0x2000.s19
After running the command, two app IVT files will be generated:
3.3 program_sdcard_image.bd file
Prepare the program_sdcard_image.bd file content as:
# The source block assign file name to identifiers
sources {
myBootImageFile = extern (0);
}
# The section block specifies the sequence of boot commands to be written to the SB file
section (0) {
#1. Prepare SDCard option block
load 0xd0000000 > 0x100;
load 0x00000000 > 0x104;
#2. Configure SDCard
enable sdcard 0x100;
#3. Erase blocks as needed.
erase sdcard 0x400..0x14000;
#4. Program SDCard Image
load sdcard myBootImageFile > 0x400;
#5. Program Efuse for optimal read performance (optional)
# Note: It is just a template, please program the actual Fuse required in the application
# and remove the # to enable the command
#load fuse 0x00000000 > 0x07;
}
Copy program_sdcard_image.bd to the flashloader path:
Flashloader_i.MXRT1050_GA\Flashloader_RT1050_1.1\Tools\elftosb\win
Open cmd, run the following command:
elftosb.exe -f kinetis -V -c program_sdcard_image.bd -o boot_image.sb ivt_evkbimxrt1050_iled_blinky_sdram_0x2000_nopadding.bin
Copy the generated boot_image.sb file to the following flashloader path:
\Flashloader_i.MXRT1050_GA\Flashloader_RT1050_1.1\Tools\mfgtools-rel\Profiles\MXRT105X\OS Firmware
3.4 MFGTool burn code to SD card
Prepare one SD card, insert it to J20, let the board enter the serial download mode, SW7:1-ON 2-OFF 3-OFF 4-ON. Find two USB cable, one is connected to J28, another is connected to J9, we use the HID to download the image.
Open MFGTool.exe, and click the start button:
Modify the boot mode to internal boot, and boot from the external SD card, SW7:1-ON 2-OFF 3-ON 4-OFF.
Power off and power on the board again, you will find the onboard LED D18 is blinking, it means the external SDRAM APP code is boot from external SD card successfully.
4, MCUBootUtility configuration and code download
Please check this community document:
https://community.nxp.com/docs/DOC-346194
Here just give one image readout memory map, it will be useful to understand the image location information:
After download, we can readout the SD card image, from 0X400 is the IVT, BD, DCD data, from 0X1000 is the image which is the same as the app.s19 file.
5, MCUXpresso Secure Provisioning configuration and download
This software is released in the NXP official website, it is also the GUI version, which can realize the normal code and the secure code downloading, it will be more easy to use than the flashloader tool, customer don’t need to input the command, the tool help the customer to do it, the function is similar to the MCUBootUtility, MCUBootUtility tool is the opensource tool which is shared in the github, but is not released in the NXP official website.
Now, we use the new official realized tool to download the SDRAM app code to the external SD card, the board still need to enter the serial download mode, just like the flashloader and the MCUBootUtility too, the detail operation is:
We can find this tool is also very easy to use, customer still need to provide the app.19 and the dcd.bin, then give the related boot device configuration is OK.
After the code is downloaded successfully, modify the boot mode to internal boot, and boot from the external SD card, SW7:1-ON 2-OFF 3-ON 4-OFF.
Power off and power on the board again, you will find the onboard LED D18 is blinking, it means the external SDRAM APP code is boot from external SD card successfully.
Until now, all the three methods to download the SDRAM app code to the SD card is working, flashloader is the command based tool, MCUBootUtility and MCUXPresso Secure Provisioning is the GUI tool, which is more easy to use.
Hello All,
Does anyone know how to do this with IMXRT1064 eval board? I am not sure if these tools and the software is applicable to IMXRT1064. Any help would be greatly appreciated.