cancel
Showing results for 
Search instead for 
Did you mean: 

M0 in-line assembler moving from bootloader to main app

DiBosco
Senior II

Folks,

I have a bootloader for an M0 which works without using interrupts. It works in that it loads the new app, the CRC in the new app matches and I then try and jump to 0x8004000.

In the past I have used a couple of different methids with M3/4 to boot to the app from bootloader dependent on what compiler/IDE I was using, but the M0 is slightly different due to how the vector table is no relocatable. So we'vecome up with a method to get round that and "all" I need to do is jump to 0x8004000.

I *think I need something like this:

void jump_to_normal_application(void)
{

    u32 jump_address;

    jump_address = *(volatile u32*) (MAIN_PROG_START_ADDRESS + 4);
    jump_to_application = (pFunction) jump_address;

    asm("ldr sp, =0x20002000");

    jump_to_application();

}


I'm getting the error:

Error: lo register required -- `ldr sp,=0x20002000'

I've searched this and although I can find many hits  I can't see anything vaguely relevant to my situation.

Also, I would like to make 0x20002000 on line 9 top be a #define or loading from a C variable


Can anyone help me with this please? __Set_MSP is not available to me due to the, errr, "individual" setup I am forced to use.

What is the way to do this and are any of my assumptions above even vaguely correct? Am using gcc.

0 REPLIES 0