How boot an RAM Image programatically

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

How boot an RAM Image programatically

Jump to solution
570 Views
Flo1989
Contributor III

Hello,

we want to have two Application Images which both are executed in DTC RAM burned into FlexSPI NOR Flash. I can generate the Images with Secure Provisioning Tool and both can be burned into FlexSPI NOR Flash at Base Address 0x30000000. But how i can burn the second image to Address 0x30140000?

And what do i have to call in the first Application to boot to the second one?

I first generated both images as XIP not run in RAM, there i could jump to second Application with the example from SDK where applicationAddress was 0x30140000:

//! @brief Exits bootloader and jumps to the user application.
void jump_to_application(uint32_t applicationAddress, uint32_t stackPointer)
{
#if BL_FEATURE_OTFAD_MODULE
    quadspi_cache_clear();
    oftfad_resume_as_needed();
#endif

    typedef void (*application_callback_t)(void);
    static uint32_t s_stackPointer = 0;
    uint32_t applicationPointer;
    static application_callback_t s_appCallback;
    //shutdown_cleanup(kShutdownType_Shutdown);

    // 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



    shutdown_cleanup(kShutdownType_Shutdown);

    uint32_t *vectorTable = (uint32_t*)applicationAddress;

    s_stackPointer = vectorTable[0];
    applicationPointer = vectorTable[1];


    s_appCallback = (application_callback_t)applicationPointer;
    // Set the VTOR to the application vector table address.
    SCB->VTOR = (uint32_t)vectorTable;

    // Set stack pointers to the application stack pointer.
    __set_MSP(s_stackPointer);
    __set_PSP(s_stackPointer);

    // Jump to the application.
    s_appCallback();
    // Dummy fcuntion call, should never go to this fcuntion call
    shutdown_cleanup(kShutdownType_Shutdown);
}

 

In this case the StackPointer is 0x20038000 and applicationPointer is 0x301404FD.

Now in the Image Linked to RAM and Image builded with Secure Provisioning Tool the StackPointer is 20040000 and applicationPointer is 0x200024FD.

I tryed to convert sie binary to a hex file and add the address offset, so i could program it to the address 0x30140000.

So the Stack and ApplicationPointer now located in Flash at 0x30141000 because the image generation adds the header with a length of 0x1000. When i try to jump to that application it fails. I loose connection to target even i do not see where the program hangs.

How can i jump now to that application? Do i manualy have to copy the Image to RAM? And how do i have to do this?

We work with MCUXpresso v11.6.0

SDK_2.x_MIMXRT1170-EVK v2.12.0

We have a EVK Board and a Custom board on both the same problem!

One difference i see is that we do not have the FCFB header at 0x30140000, is this a problem? But with XIP this was no Problem.

Thank you very much,

Florian

0 Kudos
1 Solution
563 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
If the image is linked to the RAM, it must be loaded to the destination address space prior to jumping.
Regarding your case, it needs to copy the image to RAM actually, further, the image doesn't need to contain the FCDB, IVT, etc, just having application is okay
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.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
564 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
If the image is linked to the RAM, it must be loaded to the destination address space prior to jumping.
Regarding your case, it needs to copy the image to RAM actually, further, the image doesn't need to contain the FCDB, IVT, etc, just having application is okay
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