How to create a bootloader process?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to create a bootloader process?

876件の閲覧回数
lihens
Contributor I

Hi,

I'm working with MK12DN512VMC5 and trying to create a bootloader process.
I burn my chip with 2 versions (the first is the bootloader and the second is the "application" version) into two different locations. I created a jump function (from the bootloader) and when the jump occurred, my application version didn't start.
What could be the reason for that? Am I missing something related to the bootloader process?

Thank you

0 件の賞賛
返信
2 返答(返信)

758件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Lihen Sternfeld,

       How you jump to the relocated application code address?

       Do you relocate the  SP, and the VTOR register?

     This is the jump code from the kboot2.0:

static void jump_to_application(uint32_t applicationAddress, uint32_t stackPointer)
{
#if BL_FEATURE_OTFAD_MODULE
    quadspi_cache_clear();
    oftfad_resume_as_needed();
#endif

    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
    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();
    // Dummy fcuntion call, should never go to this fcuntion call
    shutdown_cleanup(kShutdownType_Shutdown);
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Wish it helps you!


Have a great day,
Kerry

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

0 件の賞賛
返信

758件の閲覧回数
mjbcswitzerland
Specialist V

Hi

See the appendix of http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.pdf

for a check list of things to consider for boot loader and application compatibility.

You can also use the various loaders in the document on a K12 in case you prefer an off-the-shelf solution over redeveloping one.

Regards

Mark

0 件の賞賛
返信