AnsweredAssumed Answered

Bootloader mqx k64f

Question asked by Emanuele Trapani on Jul 3, 2015
Latest reply on Mar 22, 2016 by Emanuele Trapani

hi, i use frdmk64f with cw 10.6, mqx 4.1.

i want to do a bootloader using mqx OS. my question is: before i jump from the bootloader to the application how can i deinitialize (or close) mqx (or other peripheral automaticallhy started)?

i use the same code for application and the bootloader: the example gpio modified. the different is:

application: started from address 0x000C0000, use vector_ram, and blinking led1

bootloader: started from address 0x00000000, use vector_rom, blinking led2 and do the jump.


jump function:


extern void preparation_application(void)  
    SCB_VTOR = 0x1fff0000;
    asm volatile("cpsid i");
    _int_disable();//i dont know which is better to use for interrupt disabling

extern void start_application(unsigned long app_link_location)  
    asm(" ldr sp, [r0,#0]"); // load the stack pointer value from the program's reset vector  
    asm("mov lr, #0xffffffff");//asm("mov sp, r0");
    asm(" ldr pc, [r0,#4]");// load the program counter value from the program's reset vector to cause operation to continue from there


i know that i set the linker file for the application correctly because if i build a simple file with only the istruction for the jump i can se that the application run well.

the problem is when i run the bootloader code. in debug mode i can see that the jump is done correctly. load the sp and the pc from the correct location. but at certain point the code come back to the bootloader and run in this infinite loop.

so i think that i don't do correctly the deinitialization of the bootloader before the jump.

i try to use the function _mqx_exit(0) but somethings go wrong and it do not come back at the main application that call _mqx().


thank you