I am trying to implement a bootloader for SAMD51 processors. At this stage, it looks like I will have to write my own bootloader, and I am new to this, so I have a few questions. However, considering that you don’t know what you don’t know, maybe my question are way off the mark, and somebody can point me in a better direction!
TOPIC ONE: Transmitting HEX file OTA
My hex file is currently larger than 600 kB. What is the best way to reduce the size of the data to be transmitted?
One way could be to generate a BIN file with just the Data Record types and include a Header with where these records go. When I run a script to extract this data, the BIN file is approx. 200 kB, and the header file looks like this:
(start address, length)
0,219791
219792,220
8404992,12
I am not confident that this is a realistic way to do this. Can anyone suggest alternative / reliable methods?
TOPIC TWO: Relocatable Code
Is the code in a hex file relocatable? Can I do the following: define three sectors in program memory: Boot Sector, Program Sector 1, Program Sector 2.
The initial code is in Program Sector 1, and the bootloader code is in Boot Sector. The new application file is loaded into Program Sector 2.
Option A: On boot up, the bootloader determines that the code in both Program Sectors is valid, and the code in Program Sector 2 is newer, to it runs the code in Program Sector 2 – where it is. Option B: The bootloader has to copy the code from Program Sector 2 to Program Sector 1, and then run it.
Is Option A possible?
I do not want to re-invent the wheel here. I would just like your opinion on the best way / most reliable / most common way to update the application in my SAMD51 controllers.
Thank you
-Osto optimize for size? Have you removed debugging symbols from the build? Those can take a lot of room up. Also, no, the code in a hex file is not relocatable, each line in the hex includes exactly which address the code goes at. As far as the second part of your question, just add a two byte version code in the program sector and have it compare which is larger.