I.MX RT1021 BootLoader problems in XIP mode.

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

I.MX RT1021 BootLoader problems in XIP mode.

949 Views
diangongcxq
Contributor II

Hi,Good morning.

I am using i.mx RT1020 to develop projects .Now,i want to develop a bootLoader that can jump to address other than 0x60000000。But i have some problems,the following steps:

1.I've written a bootloader than can store ".binary" app file to address 0x60400000.Execute the following instructions after running:

   

   JumpApplication1(0x60400000,0x60400004);

 __STATIC_FORCEINLINE void JumpApplication1(uint32_t topOfMainStack, uint32_t AppliAddr)

{
__ASM volatile ("mov r13, %0" : : "r" (topOfMainStack) : );
__ASM volatile ("mov r15, %0" : : "r" (AppliAddr) : );
}

2.So my app program performs the operation as attachment 1 and generates binary file as attachment 2 ,map file as attachment    3.

But the app program is not running after the jump。So I don't know what's wrong with the above operation。

Please give me your help。

Thanks。

0 Kudos
3 Replies

813 Views
jeremyzhou
NXP Employee
NXP Employee

Hi ,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
1) Firstly, you should assure the bootloader program is good, it means it can work well when debugging it independently.
2) I think it can use below jump_to_application function instead of the previous one.

//! @brief Exits bootloader and jumps to the user application.
static void jump_to_application(uint32_t applicationAddress, uint32_t stackPointer)
{


    // 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();
}

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

813 Views
diangongcxq
Contributor II

What is APP_VECTOR_TABLE?

0 Kudos

813 Views
jeremyzhou
NXP Employee
NXP Employee

Hi ,

Thanks for your reply and sorry for making you confused.
The APP_VECTOR_TABLE is the address of the application vector table which equals the stackPointer.

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos