Jump to Application

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

Jump to Application

Jump to solution
1,326 Views
Abhisek20
Contributor I

Hi,

I am using MIMXRT1170-EVKB for our development activities. I am new to this controller.

I used the fsl_romapi example sdk as customized bootloader and integrated the uart example with that to receive the image (led blinky example) through uart and write it in the flash.

Currently I am able to write to write the binary format of image received via uart into the flash starting from 0x32000000 address. 

Now I want to jump to this application. Currently I am using this piece of code from flashloader example to jump to this application address. 

Here while calling this function, what I should pass in the arguements section. If you can let me know then it will be helpful. If you have some piece of code for jumping to application then you can give me some link.

static void jump_to_application(uint32_t applicationAddress, uint32_t stackPointer)

{

#if BL_FEATURE_OTFAD_MODULE

quadspi_cache_clear();

oftfad_resume_as_needed();

#endif

// Create the function call to the user application.

// Static variables are needed since changed the stack pointer out from under the compiler

// we need to ensure the values we are using are not stored on the previous stack

static uint32_t s_stackPointer = 0;

s_stackPointer = stackPointer;

static void (*farewellBootloader)(void) = 0;

farewellBootloader = (void (*)(void))applicationAddress;

// Set the VTOR to the application vector table address.

SCB->VTOR = (uint32_t)APP_VECTOR_TABLE;

// Set stack pointers to the application stack pointer.

__set_MSP(s_stackPointer);

__set_PSP(s_stackPointer);

// Jump to the application.

farewellBootloader();

}

 

 

0 Kudos
Reply
1 Solution
1,256 Views
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @Abhisek20 ,

Thanks for your interest in NXP MIMXRT series!

The two arguments to the incoming function are the entry and SP pointers from your application project. You can find them from the map file you compiled earlier. Please refer to this link: https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/bootloader%E8%B7%B3%E8%BD%AC%E5%88%B0sdram%E7%9A...

Best regards,
Gavin

 

View solution in original post

0 Kudos
Reply
2 Replies
1,223 Views
Devyy
Contributor II

Hello !

The two arguments are the entry point of your new program and the stack pointer.
You can find them in the Vector Table of the program you just flashed.

So basically, in my application I'm doing :

new_StackPointer = read_Uint32 (New_Address);
new_ApplicationAddress = read_Uint32 (New_Address+4);

jump_to_application(new_StackPointer,new_ApplicationAddress);


Why ? :
Here is what I'm reading

Devyy_0-1721288792156.png


When you flash your application at the address 0x32000000, the first thing in the memory is the Vector Table. 

You can replace New_Address with 0x32000000 for your code.

I hope it will help you,

Devyy

 

0 Kudos
Reply
1,257 Views
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @Abhisek20 ,

Thanks for your interest in NXP MIMXRT series!

The two arguments to the incoming function are the entry and SP pointers from your application project. You can find them from the map file you compiled earlier. Please refer to this link: https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/bootloader%E8%B7%B3%E8%BD%AC%E5%88%B0sdram%E7%9A...

Best regards,
Gavin

 
0 Kudos
Reply