1

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

2
  • What language are you writing the bootloader in? Have you turned on, say, -Os to 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. Commented Nov 8, 2024 at 11:55
  • Thank you. C language. I will try the -Os option to reduce the file size etc. I understand hex files contains addresses. I suppose what I am asking is if the entire file can be offset by an amount. Does the actual code in the hex file use real addresses for goto/jump, or relative addresses? Finally, it just seem safer to have 2 sectors for program memory. Run from 1, write new app to the 2nd sector. Then, after verifying, then run from 2nd sector, and next time use 1st sector for updating app. But I am guessing this is not what anybody does? Commented Nov 11, 2024 at 13:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.