RT1170 SBL ISP download app for remap function

Showing results for 
Show  only  | Search instead for 
Did you mean: 

RT1170 SBL ISP download app for remap function

RT1170 SBL ISP download app for remap function

RT1170 SBL ISP download app for remap function

1. Abstract

Previously wrote a post about using the official SBL ISP method to download the APP:

RT1170 SBL ISP download SDRAM APP

Recently, a customer also needs to use RT1170 SBL ISP to download code, but the code app that needs to be downloaded is based on MCUXpresso IDE, which generates a bin file and can be programmed to different locations in the flash, and then use remap to run the corresponding app.

Regarding remap, we can know from the SBL documentation that RT1170 can directly support it:


Fig 1

Usually, if combined with SFW for SD card, cloud and other app updates, the remap function can be directly supported. Because SFW currently only supports two IDEs: IAR and MDK, and does not support MCUXPresso IDE, it is not particularly convenient for customers to use MCUXPresso to develop apps. Moreover, customers do not need to use an SD card or network cloud to update the code. SBL's ISP Updates are enough. So how to use SBL to implement the remap function of two MCUXpresso apps? For MCUXpresso App, you can use one project, so you only need to modify the content to identify different apps and burn them to different flash addresses. The specific implementation methods and steps are given below.

The spatial structure of SBL, APP1, and APP2 codes is as follows:


Fig 2

2. SBL operation and modification

2.1 SBL configuration and downloading

Refer to the doc chapter 2.1:

RT1170 SBL ISP download SDRAM APP

Generate the related sbl_iar project.

2.2 SBL add remap code

Opern sbl project file: sbl-master\boot\sbl_boot.c

int sbl_boot_main(void) code modified like this:

int sbl_boot_main(void)
  char ch = 0;
	struct image_header br_hdr1 = {
		.ih_hdr_size = 0x2000
	struct boot_rsp rsp = {
		.br_hdr = &br_hdr1,
		.br_flash_dev_id = 1,
		.br_image_off = 0x80000
	int rc = 0;

#if defined(SOC_IMXRTYYYY_SERIES) || defined(SOC_LPC55S69_SERIES)
	BOOT_LOG_INF("Bootloader Version %s", BOOTLOADER_VERSION);
        BOOT_LOG_INF("remap or not:Y/N\r\n\r\n");
        ch = GETCHAR();
        if((ch == 'Y') || (ch == 'y'))
            BOOT_LOG_INF("With remap!\r\n\r\n");
        else if((ch == 'N') || ((ch == 'n') ))
	    BOOT_LOG_INF("Without remap!\r\n\r\n");
            BOOT_LOG_INF("Without remap!\r\n\r\n");
    rc = boot_single_go(&rsp);
    rc = boot_remap_go(&rsp);
	rc = boot_go(&rsp);
#endif /* SINGLE_IMAGE*/
	if (rc != 0) {
        while (1)
            BOOT_LOG_ERR("Unable to find bootable image");
            SDK_DelayAtLeastUs(3000000, BOARD_BOOTCLOCKRUN_CORE_CLOCK);
	BOOT_LOG_INF("Bootloader chainload address offset: 0x%x", rsp.br_image_off);
	BOOT_LOG_INF("Reset_Handler address offset: 0x%x", rsp.br_image_off + rsp.br_hdr->ih_hdr_size);
	BOOT_LOG_INF("Jumping to the image\r\n\r\n");      
	BOOT_LOG_ERR("Never should get here");
    for (;;);

After modification, build the IAR SBL project, then use the debugger download the sbl to the MIMXRT1170-EVK board.

3. APP prepare

Refer to doc chapter 2.2:

RT1170 SBL ISP download SDRAM APP

In order to know the detail app, we can use the hello_world project, and modify the code like the following:

int main(void)
    char ch;

    /* Init board hardware. */
    PRINTF("hello world1->real addr is 0X30100000\r\n"); //app1
    //  PRINTF("hello world2->real addr is 0X30200000\r\n");//app2

    while (1)
        ch = GETCHAR();

Use app1 printf code, to generate the hello_world1.bin,then add the secure header which match to the SBL, generate the hello_app1.bin.

Use app2 printf code, to generate the hello_world2.bin,then add the secure header which match to the SBL, generate the hello_app2.bin.

Now, give the details how to generate the related secure app:

Open sbl-master\target\evkmimxrt1170\env.bat:

Change the path to:

cd ..\..\component\secure\mcuboot\scripts

copy the mcuxpresso project generated bin file:hello_world1.bin and hello_world2.bin



Use the following commander:

python imgtool.py sign --key xxxx_priv.pem --align 4 --version "1.1" --header-size 0x400 --pad-header --slot-size 0x100000 --max-sectors 32 hello_world1.bin hello_app1.bin

python imgtool.py sign --key xxxx_priv.pem --align 4 --version "1.1" --header-size 0x400 --pad-header --slot-size 0x100000 --max-sectors 32 hello_world2.bin hello_app2.bin

to generate the hello_app1.bin, hello_app2.bin.


Fig 3

3. Test result

Use the MCUbootutility SBL OTA run mode, after board reset, in 5 seconds to connect the board, then burn:

hello_app1.bin to 0X30100000

hello_app2.bin to 0X30200000


Fig 4


Fig 5

After downloading, exit MCUBootutility.

Reset the board, in the console wait the log appear, then input ‘Y’ or ‘N’ to select which app boots:

‘Y’: remap, APP2 boot

‘N’: without remap, APP1 boot

Test result is:


Fig 6

From the test result, we can see the remap function already works OK.


No ratings
Version history
Last update:
‎01-03-2024 03:42 AM
Updated by: