AhmedYousriSobhi / Hex-To-array-txt

C code to convert Hex file to array Txt file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hex-To-array-txt

C code to convert Hex file to array Txt file.

This code is used to Covert Hex file to Txt file, so you can easily extract hex bytes into array in 'txt' file.

So this txt file would be input in bootloader code.

Code Idea:

  • First you need to understand Intel Hex Format
  • This code is simple just open the hex file:
    • Reads every line byte by byte.
    • Check the number of data bytes in this line and reads these data.
    • Store these data in the output txt file which i named OutputArray.txt and fill the reset of bytes by 0xFF until the code size is equivlent to const integer * PAGE_SIZE in ATmega-16. The Page size in AVR is 128 bytes = 64 word.
    • The OutputArray.txt file contains the Data bytes of the Application code, Code size, and number of pages needed for this code in the flash memory.

CMD Command:

CMD

.HEX File:

Hex file

.TXT File:

txt file

About

C code to convert Hex file to array Txt file


Languages

Language:C 100.0%