cancel
Showing results for 
Search instead for 
Did you mean: 

Bootloader Problem

andrewkelly9
Associate II
Posted on February 12, 2010 at 17:23

Bootloader Problem

#bootloader
13 REPLIES 13
Posted on May 17, 2011 at 13:40

Wouldn't this make more sense?

-Clive

void app_start(void)

{

    u32 *resetvector = (u32 *)(0x08004004); // 32-bit point

    void (*runapp)();

    printf(''The code start is %08X\n'',*resetvector);

    irq_disable();

    runapp=(void(*)())(*resetvector);

    runapp();

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
andrewkelly9
Associate II
Posted on May 17, 2011 at 13:40

The sample code looks like this:

JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);

Jump_To_Application = (pFunction) JumpAddress;

__set_MSP(*(__IO uint32_t*) ApplicationAddress);

Jump_To_Application();

I am not doing this, Very possibly the problem.

The only issue will be translating the routine to set_MSP GCC  assembly.

Any help would be appliciated

__ASM void __set_MSP(UINT32 mainStackPointer)

{

  msr msp, r0

  bx lr

}

andrewkelly9
Associate II
Posted on May 17, 2011 at 13:40

No Need, its in the header. Will let you know if this works...

void __set_MSP(UINT32 topOfMainStack)

{

  __ASM volatile (''MSR msp, %0\n\t''

                  ''BX  lr     \n\t'' : : ''r'' (topOfMainStack) );

}

andrewkelly9
Associate II
Posted on May 17, 2011 at 13:40

Its working.

Using the code above. I suspect that it got an exception when I didn't change the stack before jumping. #

So many thanks, sorry i can't get you a pint and for anyone else, the solution is in AN2557 sample code.