Bootloader API RT 1064

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

Bootloader API RT 1064

1,218 Views
_Bart_
Contributor I

Hi,

I am currently experimenting with the bootloader api of the RT 1064. I would like to create a setup with 2 images on the internal flash chip. Image 0 at 0x70000000 and image 2 at 0x70040000. Both images have the IVT header and the second image is compiled with start address 0x70000000. I would like to be able to switch from within image 0 to image 1. In the documentation I found the following command to do that:

uint32_t arg = 0xeb000001;
ROM_RunBootloader(&arg);

To define the location of the second image I've set the image offset value to 1 (256KB)

OCOTP->MISC_CONF1 = 0x1 << 16;

This did not work, I got the following error:

"Break at address "0x2019f8" with no debug information available, or outside of program code."

Since I was not sure if the Bootloader API sets the address mapping registers I've also tried to set the following registers.

IOMUXC_GPR->GPR30 = 0x70001000;
IOMUXC_GPR->GPR31 = 0x70200000;
IOMUXC_GPR->GPR32 = 0x40000;

This did not help unfortunately. Is there an example on how to do this or am I doing something wrong?

Thanks for the help,

Bart

0 Kudos
Reply
2 Replies

1,187 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

You can refer to this application note to make the switch of image, you need to call the ROM API to change the image: How to Use Flash Remapping Function (nxp.com)

Best regards,
Omar

0 Kudos
Reply

1,159 Views
_Bart_
Contributor I

Dear Omar,

Thank you for your answer. I've used this document but it is not really clear on how to implement it, also searched for the example project in the MIMXRT1060 SDK but could not find it.

I've continued experimenting and finally got something working. Modified my remap registers to this

 IOMUXC_GPR->GPR30 = 0x70000000;
IOMUXC_GPR->GPR31 = 0x70100000;
IOMUXC_GPR->GPR32 = 0x100000;
OCOTP->MISC_CONF1 |= 0x4 << 16;
So now the remap includes the xip flash header, also added the flash header to the second image. After I modify these registers the flash is remapped so I put the code in a RAM function. I did this for the ROM_RunBootloader method as well since it can not run when flash is being remapped. I ended up with:
 
//in fsl_romapi.c
__RAM_FUNC void ROM_RunBootloader(void *arg)
{
g_bootloaderTree->runBootloader(arg);
}

__RAM_FUNC
void RunImage()
{
IOMUXC_GPR->GPR30 = 0x70000000;
IOMUXC_GPR->GPR31 = 0x70100000;
IOMUXC_GPR->GPR32 = 0x100000;
OCOTP->MISC_CONF1 |= 0x4 << 16;

uint32_t arg = 0xeb000001;
ROM_RunBootloader(&arg);
}
Is this the way it was designed to work, if so why is the ROM_RunBootloader not implemented in RAM by default? I could also implement the setting of the remap registers in de dcd part of the IVT, would this work and is this the proper way to do it.
 
Thanks for the help,
 
Bart
0 Kudos
Reply