Atmel SAM4E Bootloader/VTOR executing new application

I've written a boot loader for the Atmel SAM4E device which is working to a point, it can receive new application code via SPI, erase flash and write to flash, but I don't understand how to execute the new application. I've learned the VTOR can be relocated, but I'm not sure how. (my application sits at address 0x00420000).
I'm very new to writing code for ARM, so I'd appreciate any help.

Many thanks

Paul

Parents
  • Hello Yusuhiko, thank for your reply.

    • aren't your boot program located on SRAM?

    no, my boot program is located at the lowest point of flash (0x00400000).

    • By the way, what is the stack pointer value when you execute  "((start_fn *)  *((uint32_t *) 0x00420004))()"?
      Was it reasonable?

    Yes, my stack point after I pause the debugging is showing as - 0x200148FC

    • When you located your app codes from 0x00400000, to what address did the boot loader jump?

    it jumped to 0x004220f9

    • Was it the address in 0x00420004?

    the same as the one it jumped to - 0x004220f9

    The disassembly show that I'm stuck in an infinte loop;

    0042206C   b #-4 

    I assume this is an error trap to stop the processor just running off and doing crazy things.

    I will try your suggested restart code.

Reply
  • Hello Yusuhiko, thank for your reply.

    • aren't your boot program located on SRAM?

    no, my boot program is located at the lowest point of flash (0x00400000).

    • By the way, what is the stack pointer value when you execute  "((start_fn *)  *((uint32_t *) 0x00420004))()"?
      Was it reasonable?

    Yes, my stack point after I pause the debugging is showing as - 0x200148FC

    • When you located your app codes from 0x00400000, to what address did the boot loader jump?

    it jumped to 0x004220f9

    • Was it the address in 0x00420004?

    the same as the one it jumped to - 0x004220f9

    The disassembly show that I'm stuck in an infinte loop;

    0042206C   b #-4 

    I assume this is an error trap to stop the processor just running off and doing crazy things.

    I will try your suggested restart code.

Children
No data