The bootable image consists of:
I’ll briefly explain each below:
The FCB will configure the settings of the FlexSPI communication. It will establish how many ports will be used, what clock speed to run the FlexSPI controller at, etc. This is the first thing that happens, as everything else is stored in Flash memory. In order to read anything else, the flash must first be configured.
The IVT is a table that tells the memory the addresses of where everything is stored.
The Boot Data contains pointers to the start address of the Memory.
The DCD contains configuration data to configure any peripherals.
The program image contains the code you write to go into the application.
These things are optional. They come with high-assurance boot sequence and will not be covered in this writeup.
Below is a rough table outlining these different parts of the boot image:
MCUXpresso can generate bootable images for Hyperflash and QSPI XiP, but if trying to boot and execute in place of SDRAM or intern SRAM, or from your own memory module, then you must generate a bootable image by through a combination of generating an s record or elf image on MCUXpresso, and then using the flashloader tool suite (elftosb and mfgtool) to create a bootable image and then a bootable program to upload to the board.
The entire general process is described below. In subsequent sections, a more detailed step-by-step guide is provided for Hyperflash XiP, SDRAM, and SRAM, each.
Begin with your application code in MCUXpresso. Change memory allocation in the memory configuration editor of the MCU Settings part of MCUXpresso according to where you would like to boot from. If applicable, be sure to specify in the preprocessor settings if you would like to enable the dcd in the boot image.
Generate an s-record (.s19) file from MCUXpresso using binary utilities.
You can find this tool in the flashloader. Call an imx command to it which will take as input the s-record file containing the program image, a dcd.bin file (may or may not be in the s-record), a FCB?, and a bd_file (given to you, specific to your memory configuration). The elftosb tool will generate as an output a .bin file.
Then call the elftosb tool again with a kinetis command. This will take the .bin file and convert it to a boot_image.sb file.
Then we can use the mfg tool to generate the program image for the board, and upload it.
In order to do this, the board SW7 must be set to OFF-ON-OFF-ON, and switch the jumper from J1 (5-6) to J1 (3-4). Connect the USB cable to J9 to power the board. Then connect the board to your computer and run the Mfg tool. Click start and the image will be uploaded.
After this the bootable image will be uploaded to the board and you’ll be good to go!
Remember to switch the pin headers back, so the board can boot normally. J1 (5-6) and SW7 to OFF-ON -ON -OFF to boot from Hyperflash.
Now in the following sections I’ll break down specific examples of what to do depending on the specific memory location you’d like to boot from.
Please note that this can also be done in MCUXpresso, but In order to use my own dcd file, I did this project using the traditional flashloader tools.
Begin by changing memory allocation in the memory configuration editor (edit project settings >> C/C++ Build >> MCU settings >>edit. It should look like the one below.
Then go to C/C++ Build >>settings > MCU C compiler > preprocessor and set the XIP_boot_header enable and and XIP_boot_header_DCD_enable both to 0 if you have a dcd.bin file to use. Otherwise set these fields to 1.
Hit apply and close.
Go to the debug portion and click on binary utilities, then generate an s-record (.s19) file from MCUXpresso.
Click build to re-build the project.
Copy this .s19 file.
In the flashloader tool, go to Tools > elftosb > Win, and drop the .s19 file in this folder, as well as the dcd.bin file.
Fire up command prompt in administrator mode, and use command cd [elftosb directory] to get to this folder
To generate the .bin file, call the command:
elftosb.exe -f imx -V -c ../../bd_file/imx10xx/imx-flexspinor-normal-unsigned-dcd.bd -o ivt_flexspi_nor_led_blinky.bin HYPERFLASH_led_blinky.s19
This command essentially uses the imx-flexspinor bd linker file to generate a .bin file that will include the dcd.bin header inside. Note that HYPERFLASH_led_blinky.s19 should be renamed to your actual file name acquired from MCUXpresso
Then we must generate the boot_image.sb
Then call the elftosb tool again with a kinetis command. This will take the .bin file and convert it to a boot_image.sb file.
The command is:
elftosb.exe -f kinetis -V -c ../../bd_file/imx10xx/program_flexspinor_image_hyperflash.bd -o boot_image.sb ivt_flexspi_nor_led_blinky_nopadding.bin
Note: The output of the first imx command we made must match the input of this one (ivt_flexspi_nor_led_blinky_nopadding.bin). Also, the output must remain named boot_image.sb, otherwise it will not work.
Then we can use the mfg tool to generate the program image for the board, and upload it.
In order to do this, the board SW7 must be set to OFF-ON-OFF-ON, and switch the jumper from J1 (5-6) to J1 (3-4). Connect the USB cable to J9 to power the board. Then connect the board to your computer and run the Mfg tool. Click start and the image will be uploaded.
Copy the boot_image.sb file that we created in the last step. Move it to the directory Tools > mfgtools-rel > Profiles > MXRT105X > OS Firmware, and drop it in here.
Next, set SW7 on the board to OFF-ON-OFF-ON, and switch the jumper at the bottom to power the board. Then connect the USB cable to J9. This will allow you to program the board.
Go back to the folder mfgtools-rel and Open the Mfg Tool. It should say HID- compliant vendor-defined device. Otherwise double check SW7 and the power pin at the bottom right.
Click start and if successful it should look like:
Please note that this success only means that it was able to upload the bootable image to the board. This usually works well. However, if you find later that the board doesn’t do what it’s supposed to, then there might be a problem in the other steps of the processor. Check to make sure you used the right linker file, and that the settings in MCUXpresso are configured correctly.
Press stop and exit
Remember to switch the pin headers back, so the board can boot normally. J1 (5-6) and SW7 to OFF-ON -ON -OFF to boot from Hyperflash.
The guide is based off this link: https://community.nxp.com/docs/DOC-340655 . Download the files provided there, and unzip. Everything is good except the first step of that pdf document is a little unclear.
Begin by changing memory allocation in the memory configuration editor of the MCU Settings part of MCUXpresso. It should look like the one below.
Then go to settings > MCU C compiler > preprocessor and set the XIP_boot_header enable and and XIP_boot_header_DCD_enable both to 0
Hit apply and close.
Go to C/C++ Build >> Settings >> MCU Linker >> Manage linker script, and check the box Link application to RAM.
Go to the debug portion and click on binary utilities, then generate an s-record (.s19) file from MCUXpresso.
Click build to re-build the project.
You can check the console to verify the correct allocations of memory:
Copy this .s19 file.
In the flashloader tool, go to Tools > elftosb > Win, and drop the .s19 file in this folder, as well as the dcd.bin file.
There’s another step for booting from SDRAM. Take the file imx-sdram-normal-unsigned-dcd.bd (included in the link posted) and drag it into Tools > bd_file > imx10xx
Fire up command prompt in administrator mode, and use command cd [elftosb directory] to get to this folder
To generate the .bin file, call the command:
elftosb.exe -f imx -V -c ../../bd_file/imx10xx/imx-sdram-normal-unsigned-dcd.bd -o evkbimxrt1050_led_blinky.bin SDRAM1_led_blinky.s19
This command essentially uses the imx-flexspinor bd linker file to generate a .bin file that will include the dcd.bin header inside. Note that HYPERFLASH_led_blinky.s19 should be renamed to your actual file name acquired from MCUXpresso
Then we must generate the boot_image.sb
Then call the elftosb tool again with a kinetis command. This will take the .bin file and convert it to a boot_image.sb file.
The command is:
elftosb.exe -f kinetis -V -c ../../bd_file/imx10xx/program_flexspinor_image_hyperflash.bd -o boot_image.sb evkbimxrt1050_led_blinky_nopadding.bin
The output of the first imx command we made must match the input of this one. Also, the output must remain named boot_image.sb, otherwise it will not work. Also note that this says flexspinor image hyperflash, but that is correct since we are still technically needing to boot from Hyperflash initially before we copy everything over to SDRAM.
Copy the boot_image.sb file.
Then we can use the mfg tool to generate the program image for the board, and upload it.
In order to do this, the board SW7 must be set to OFF-ON-OFF-ON, and switch the jumper from J1 (5-6) to J1 (3-4). Connect the USB cable to J9 to power the board. Then connect the board to your computer and run the Mfg tool. Click start and the image will be uploaded.
Copy the boot_image.sb file that we created in the last step. Move it to the directory Tools > mfgtools-rel > Profiles > MXRT105X > OS Firmware, and drop it in here.
Next, set SW7 on the board to OFF-ON-OFF-ON, and switch the jumper at the bottom to power the board. Then connect the USB cable to J9. This will allow you to program the board.
Go back to the folder mfgtools-rel and Open the Mfg Tool. It should say HID- compliant vendor-defined device. Otherwise double check SW7 and the power pin at the bottom right.
Click start and if successful it should look like:
Please note that this success only means that it was able to upload the bootable image to the board. This usually works well. However, if you find later that the board doesn’t do what it’s supposed to, then there might be a problem in the other steps of the processor. Check to make sure you used the right linker file, and that the settings in MCUXpresso are configured correctly.
Press stop and exit
Remember to switch the pin headers back, so the board can boot normally. J1 (5-6) and SW7 to OFF-ON -ON -OFF to boot from Hyperflash.
This one was a little trickier as there was no appnote, but not too bad.
Begin by changing memory allocation in the memory configuration editor of the MCU Settings part of MCUXpresso. It should look like the one below. We are linking to copy everything to dtc RAM
Then go to settings > MCU C compiler > preprocessor and set the XIP_boot_header enable and and XIP_boot_header_DCD_enable both to 0
Hit apply and close.
Go to C/C++ Build >> Settings >> MCU Linker >> Manage linker script, and check the box Link application to RAM.
Go to the debug portion and click on binary utilities, then generate an s-record (.s19) file from MCUXpresso.
Click build to re-build the project.
You can verify that application is linked to SRAM in the console:
Copy this .s19 file.
In the flashloader tool, go to Tools > elftosb > Win, and drop the .s19 file in this folder, as well as the dcd.bin file
Fire up command prompt in administrator mode, and use command cd [elftosb directory] to get to this folder
This step is specific to dtcm ram: Go to Tools >>bd_file >> imx10xx, and open up the imx-dtcm-unsigned-dcd.bd file and change the ivtOffset address to 0x1000. 0x400 is the default for SDCARD booting.
To be clear, the bd file should look as below:
To generate the .bin file, call the command:
elftosb.exe -f imx -V -c ../../bd_file/imx10xx/imx-dtcm-unsigned-dcd.bd -o evkbimxrt1050_led_blinky.bin SRAM1_led_blinky.s19
This command essentially uses the imx-flexspinor bd linker file to generate a .bin file that will include the dcd.bin header inside. Note that SRAM_led_blinky.s19 should be renamed to your actual file name acquired from MCUXpresso.
Then we must generate the boot_image.sb
Then call the elftosb tool again with a kinetis command. This will take the .bin file and convert it to a boot_image.sb file.
The command is:
elftosb.exe -f kinetis -V -c ../../bd_file/imx10xx/program_flexspinor_image_hyperflash.bd -o boot_image.sb evkbimxrt1050_led_blinky_nopadding.bin
The output of the first imx command we made must match the input of this one. Also, the output must remain named boot_image.sb, otherwise it will not work. Also note that this says flexspinor image hyperflash, but that is correct since we are still technically needing to boot from Hyperflash initially before we copy everything over to SDRAM.
Then we can use the mfg tool to generate the program image for the board, and upload it.
In order to do this, the board SW7 must be set to OFF-ON-OFF-ON, and switch the jumper from J1 (5-6) to J1 (3-4). Connect the USB cable to J9 to power the board. Then connect the board to your computer and run the Mfg tool. Click start and the image will be uploaded.
Copy the boot_image.sb file that we created in the last step. Move it to the directory Tools > mfgtools-rel > Profiles > MXRT105X > OS Firmware, and drop it in here.
Next, set SW7 on the board to OFF-ON-OFF-ON, and switch the jumper at the bottom to power the board. Then connect the USB cable to J9. This will allow you to program the board.
Go back to the folder mfgtools-rel and Open the Mfg Tool. It should say HID- compliant vendor-defined device. Otherwise double check SW7 and the power pin at the bottom right.
Click start and if successful it should look like:
Please note that this success only means that it was able to upload the bootable image to the board. This usually works well. However, if you find later that the board doesn’t do what it’s supposed to, then there might be a problem in the other steps of the processor. Check to make sure you used the right linker file, and that the settings in MCUXpresso are configured correctly.
Press stop and exit
Remember to switch the pin headers back, so the board can boot normally. J1 (5-6) and SW7 to OFF-ON -ON -OFF to boot from Hyperflash.
Please note that this success only means that it was able to upload the bootable image to the board. This usually works well. However, if you find later that the board doesn’t do what it’s supposed to, then there might be a problem with the other steps of the processor. Check to make sure you used the right linker file, and that the settings in MCUXpresso are configured correctly.
After this the bootable image will be uploaded to the board and you’ll be good to go!
Hi Manuel, thank you for this interesting document.
Unfortunately elftosb crashes when I attempt to create the binaries. It keeps looking for "section 0x0", although the addresses in the S19 file are correct. This happens both with SDRAM and internal RAM version.
Thanks
Giuseppe
In the end, I discovered that my flashloader has some problems.
Today I was able to create an image, write it in flash and run it in SDRAM.
Later, we were also able to have MCUXpresso create the binary image (no flashloader). You need to load it to the right location via Segger Ozone, but everything works well.
Manuel, if you ever pass in Firenze, there is a free beer for you ;-)
Giuseppe
You can also try this tool, with this tool, You can flash bare image into various boot devices easily and don't need to care about headers (ivt, boot data...)
Ive been banging my head against the wall for the past three days. RT1050-EVKB. I can download images happily via MCUXpresso. I have been able to create images that I burn into flash, that are copied into either DTC or ITC ram. I use either NXP-MCUBootutility or MCUXpresso Secure provisioning tool. Both work for me. Next on the list is creating images that XIP and run from SDRam. I have tried every thing that I have found - NG. I can take the sample images from the provisioning tool: evkbimxrt1050_iled_blinky_ext_FLASH and evkbimxrt1050_iled_blinky_SDRAM, and burn these, and have them run. So its not my toolset - its obviously something Im doing wrong or not doing. I have SDK ver 2.3. The guides look really simple, but I must be missing something on each. Thoughts? If I were to ask for somewhere to start, it would be give me the steps to get an XIP image built and downloaded, using MCUXpresso. Which compiler defs need to be set. I know I have to have the image running at 0x60002000, with the flash as the top item. What else is there?
Thanks in advance.
Larry
EDIT:
OH MY GOD!!! I will tell you what else there is: The MCUXPresso IDE doesnt know that it isnt the latest version!!!!!!!!!!!!!!!!!! I've been using V10.3 for a year now, for another project. I have REPEATEDLY had it check for updates, and it said there were none available. It doesnt know that there is a version 11.1 available. And RT1050 SDK v 2.7 works with that and automatically provides all of the flash burning functionality!!! WOW! RT1050 SDK2.3 does not.