How to program application firmware to a specific address

Microchip in-system programming solution: SAM-BA

Moderators: nferre, fab

Posts: 9
Joined: Thu Sep 18, 2014 6:01 pm

How to program application firmware to a specific address

Tue Dec 16, 2014 3:43 am

I am using the Atmel ARM M0+ MCU (ATSAMD20J18). I have written a bootload for it. The bootloader will check the first few bytes (lets call it magic key) from an external SPI flash memory to determine whether to enter the bootload mode. If the bytes are correct, it will copy data from the same SPI flash to the MCU's internal flash.
The problem is for the first time programming (for example in manufacturing), I need to have both the bootloader and the first version application firmware programmed in the MCU before we send out the product. Therefore I am thinking that if there is any method so that I can program the bootloader at address 0x0000, and the application firmware starting at address 0x4000?
Another method is I can program the bootloader to the MCU, and then using some method to program the external SPI flash with the application firmware and the magic key. The question is how can I program the extenal SPI flash? I know there are tools that can program a SPI flash. However besides to write the binary format application firmware, I also need to write the magic key and the length of the application firmware to the first few bytes of the flash.
Posts: 1
Joined: Wed Jan 28, 2015 3:08 pm

Re: How to program application firmware to a specific addres

Wed Jan 28, 2015 3:26 pm

Hi garypty!

You can "merge" the bootloader and the application ".hex" files.
To do that, remove the last line from your bootloader.hex file:

Code: Select all

Then, copy and paste the content of the application.hex file, after the content of the bootloader.hex file.
Now you have a bootloader+application.hex file that you can use to program your MCU.

Best Regards.

Return to “SAM-BA”

Who is online

Users browsing this forum: No registered users and 3 guests