سؤال

I want to make boot loader code for AVR, which can update firmware over the air.

Now I am able to write to the application area using some fixed data. I have a hex file of the new firmware to be updated. How do I convert that hex file to raw data so that I can update the application using that raw data?

هل كانت مفيدة؟

المحلول 2

You may use some tool (http://hex2bin.sourceforge.net/ or another hex2bin converter) or write your own hex parser that may have some caveats when coming to files > 64 KB.

نصائح أخرى

If you're using WinAVR for compilation you may do this using included avr-objcopy:

C:\WinAVR-20100110\bin> avr-objcopy.exe -I ihex -O binary input_file.hex output.bin

If you're developing on Linux, there's a package, avr-binutils, with the avr-objcopy program.

As you pointed out, the hex file is encoded in Intel Hex format. You have to extract the flash data from the data records. Each record (line) holds up to 16 bytes (common, but may vary) of data. Note that that there are different record types and some may introduce an address offset, depending on how the flash data is distributed. The Wiki description should be enough to get the concept.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top