IMXRT1021 IAP and OTA update

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

IMXRT1021 IAP and OTA update

Jump to solution
5,179 Views
huy_tv
Contributor I

Dear all,

I have a question about ota update.
In my project, i want to perform OTA update for imxrt1021 via cellular network.
In other MCU like stm32,...

  1. I have to write my own bootloader
  2. Bootloader jump to application
  3. Application running, and download new binary firmware into other region in flash
  4. Bootloader select new firmware and jump to new application

In imxrt1021, i think i should write a secondary bootloader. ROM bootloader will run to secondary bootloader in QSPI flash, then secondary bootloader will jump to user application.

How can i do it with IMXRT1021 platform?I take a look at Flash loader example in NXP SDK, but it seem Flash loader example need computer, and loader program must be run in RAM.
Do you have any example about IAP update, or could you please give me your suggestion, any application note or documentations?

Thank you.

0 Kudos
Reply
1 Solution
5,103 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Yes, you can find it at the Documentation tab in the device product page: https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/i-mx-rt-crossover-...

Omar_Anguiano_0-1634165444716.png

If you have more questions do not hesitate to ask me.
Best regards,
Omar

View solution in original post

0 Kudos
Reply
8 Replies
5,158 Views
mjbcswitzerland
Specialist V

Hi

The uTasker project (including i.MX RT 1021 support) includes secure OTA loaders which can operate on various Wi-Fi and cellular modems, including USB RNDIS types. See details, documents and videos of the overall concept at https://www.utasker.com/iMX/developers.html

However there are many cellular modems that communicate in incompatible manners so this interface may need to be adapted (irrespective of which solution you use).

Regards

Mark

0 Kudos
Reply
5,146 Views
huy_tv
Contributor I

Thanks Mark,

I will register uTasker and request a personal license. It's seem not fully opensource license.
Why NXP doesn't provide an IAP sample code in SDK to help developer write custom bootloader?
I only see sample code from "Flash loader" example, but it only run from RAM. How can i move it into QSPI flash and execute firmware switch by my self?
Could you please share any documentation about it?

Thank you.

0 Kudos
Reply
5,128 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello
Hope you are well.

The application note AN12604 intends to introduce one example to illustrate how to implement a second boot loader on i.MX RT1050, i.MX RT1020, and i.MX RT1060 part based on XIP flash: https://www.nxp.com/docs/en/application-note/AN12604.pdf

 

If you have more questions do not hesitate to ask me.
Best regards,
Omar

0 Kudos
Reply
5,118 Views
huy_tv
Contributor I

Dear Anguiano

Does NXP provide sample code for AN12604?

Thank you.

0 Kudos
Reply
5,104 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Yes, you can find it at the Documentation tab in the device product page: https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/i-mx-rt-crossover-...

Omar_Anguiano_0-1634165444716.png

If you have more questions do not hesitate to ask me.
Best regards,
Omar

0 Kudos
Reply
5,089 Views
huy_tv
Contributor I

Dear @Omar_Anguiano 

I tried to import AN12604SW booloader source code into MCU Expresso IDE, because i dont have IAR license (NXP use IAR for bootloader demostration).

I'm stuck in hardfaut, after debugging step by step,I found the fault reason is the function "is_valid_application_location", NXP sample code will check "applicationAddress == (uint32_t)&Reset_Handler", and  "Reset_Handler" is set by IAR Linker.
How can we set "Reset_Handler" value in MCU ExpressoSDK?

Below is the code of NXP and Linker by IAR

 

 

bool is_valid_application_location(uint32_t applicationAddress)
{
    // Verify that the jumpLocation is non zero and then either within flash or RAM, both calculations are:
    // (jumpLocation >= startAddress) && (jumpLocation < (startAddress + size))
    if ((!applicationAddress) ||              // address is not null AND
        (applicationAddress == 0xffffffff) || // address is not blank Flash (0xff) AND
        (applicationAddress == (uint32_t)&Reset_Handler)||
         (*(uint32_t *)applicationAddress == 0xffffffff))
    {
        return false;
    }

    bool isValid = true;
    //const uint32_t minThumb2InstructionSize = 2; // smallest thumb2 instruction size is 16-bit.
    // Check if the application address is in valid executable memory range
   // status_t status = find_map_entry(applicationAddress, minThumb2InstructionSize, &map);
  //  if ((status == kStatus_Success) && (map->memoryProperty & kMemoryIsExecutable))
    {
   //     isValid = true;
    }

    return isValid;
}

 

 

 
- Linker 

 

 

* Entry Point */
ENTRY(Reset_Handler)

HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x0400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;

/* Specify the memory areas */
MEMORY
{
  m_flash_config        (RX)  : ORIGIN = 0x60000000, LENGTH = 0x00001000
  m_ivt                 (RX)  : ORIGIN = 0x60001000, LENGTH = 0x00001000
  m_interrupts          (RX)  : ORIGIN = 0x60002000, LENGTH = 0x00000400
  m_text                (RX)  : ORIGIN = 0x60002400, LENGTH = 0x03FFDC00
  m_data                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00020000
  m_data2               (RW)  : ORIGIN = 0x20200000, LENGTH = 0x00040000
}

/* Define output sections */
SECTIONS
{
  .flash_config :
  {
    . = ALIGN(4);
    __FLASH_BASE = .;
    KEEP(* (.boot_hdr.conf))     /* flash config section */
    . = ALIGN(4);
  } > m_flash_config

  ivt_begin= ORIGIN(m_flash_config) + LENGTH(m_flash_config);

  .ivt : AT(ivt_begin)
  {
    . = ALIGN(4);
	KEEP(* (.boot_hdr.ivt))           /* ivt section */
	KEEP(* (.boot_hdr.boot_data))     /* boot section */
	KEEP(* (.boot_hdr.dcd_data))      /* dcd section */
    . = ALIGN(4);
  } > m_ivt

 

 


Thank you.

0 Kudos
Reply
4,850 Views
Richard75
Contributor I

Hello sir,

 

I am having a problem to import  theAN12604SW bootoader source code into MCU Expresso IDE.

Could you help me with instructions to import it ? or could please share the imported project ?

 

Thanks

0 Kudos
Reply
5,074 Views
huy_tv
Contributor I

Dear all

The problem solve by change "Reset_Handler" to "Reset_ISR".

Thanks @Omar_Anguiano 

0 Kudos
Reply