Example code bootloader SAM4S

Discussion around product based on ARM Cortex M4 core.

Moderators: nferre, ncollot

Posts: 1
Joined: Tue Jun 07, 2016 8:34 pm

Example code bootloader SAM4S

Tue Jun 07, 2016 9:08 pm


Has anyone of you already wrote a bootloader for a SAM4S?
I use ATMEL Studio 7.

Where is to set the addresses for the Flash (program start)?
Application and Bootlaoder.

Posts: 53
Joined: Wed Aug 19, 2015 9:44 pm

Re: Example code bootloader SAM4S

Tue Jun 07, 2016 10:15 pm

I set the bootloader to the first 64kbyte block of flash, 0x00400000 - 0x0040ffff. The application area starts then at 0x00410000. There is sense to keep the partition boundaries at the flash erase block boundaries.

You can build the startup / exception vector to the start of the target area and during startup from bootloader move the vector base register to it. You have to pick the stack pointer and initial PC from the vector, the hardware won't do it for the target code. Of course, the vector can also be in RAM, but you need to pick an area with a suitable starting address, as the vector is pretty fussy about proper start address.

Return to “SAM4 Cortex-M4 MCU”

Who is online

Users browsing this forum: No registered users and 1 guest