This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bootloader implementation on cortex-m3

Note: This was originally posted on 21st February 2012 at http://forums.arm.com

Hey, I'm working on a project on a Atmel's SAM3S4C, and I started to create a seperate bootloader for it.
The bootloader is a seperate project in IAR.
I'm sucessfully flushing the application code into the internal flash, however, when I try to jump to the application from the bootloader, using the Vector interrupt table re-allocation, the code just won't start.

The bootloader is placed at 0x00400000 - 0x00401FFF
and it's vector table is at 0x00400000.
The application is located at 0x00402000 - 0x0043FFFF
and it's vector table is at 0x00402000

This is the code for jumping to the application from the bootloader is:


Code:
int * address = ( int * ) 0x00402004; //pointer to reset handler of application
__set_MSP ( * ( int * ) 0x00402000 ); //set the stack pointer to that of the application

* ( int * ) 0xE000ED08 = 0x00402000; // VTOR: set the vector table to that of the app

( ( void ( * ) () ) ( *address ) ) (); // pointer recast as function pointer and the dereferenced/called

    while ( 1 )[/size]
        { }; //you application was never executed




can anyone help me with this ?
Parents
  • Note: This was originally posted on 29th February 2012 at http://forums.arm.com

    Just several guesses:
    1. [color=#666600][size=2]*[/size][/color][size=2] [/size][color=#666600][size=2]([/size][/color][size=2] [/size][color=#000088][size=2]int[/size][/color][size=2] [/size][color=#666600][size=2]*[/size][/color][size=2] [/size][color=#666600][size=2])[/size][/color][size=2] [/size][color=#006666][size=2]0xE000ED08[/size][/color][size=2] [/size][color=#666600][size=2]=[/size][/color][size=2] [/size][color=#006666][size=2]0x00402000[/size][/color][color=#666600][size=2];  should be *((volatile int *)0xE000ED08) = 0x00402000; to make sure that the value written to the register.[/size][/color]
    [color=#666600][size=2]2. volatile asm("dsb") should added to make sure the stack base and vector base modification really happened before the jump.[/size][/color]
Reply
  • Note: This was originally posted on 29th February 2012 at http://forums.arm.com

    Just several guesses:
    1. [color=#666600][size=2]*[/size][/color][size=2] [/size][color=#666600][size=2]([/size][/color][size=2] [/size][color=#000088][size=2]int[/size][/color][size=2] [/size][color=#666600][size=2]*[/size][/color][size=2] [/size][color=#666600][size=2])[/size][/color][size=2] [/size][color=#006666][size=2]0xE000ED08[/size][/color][size=2] [/size][color=#666600][size=2]=[/size][/color][size=2] [/size][color=#006666][size=2]0x00402000[/size][/color][color=#666600][size=2];  should be *((volatile int *)0xE000ED08) = 0x00402000; to make sure that the value written to the register.[/size][/color]
    [color=#666600][size=2]2. volatile asm("dsb") should added to make sure the stack base and vector base modification really happened before the jump.[/size][/color]
Children
No data