# hex2bin **Repository Path**: wwwbbk1/hex2bin ## Basic Information - **Project Name**: hex2bin - **Description**: No description available - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-07 - **Last Updated**: 2021-07-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README hex2bin extracts all the bytes in a HEX file for a given range of addresses. Those addresses are output into a binary file, suitable for programming with the Minipro TL866CS or possibly using other tools. hexinfo prints out all the contiguous regions in a HEX file, for verification or to better understand a tool's output. hexinfo will also print out if there are checksum errors and if the HEX file specifies an address to start execution, which I believe is set by GNU binutils' objcopy for an ELF file. I used this sequence to break a single .hex output from Microchip's XC8 into pieces that can be burned onto a PIC 18F452: ``` hex2bin -r 256 0x300000 ../io_pic_v2/io_pic.hex ../io_pic_v2/io_pic.config.bin hex2bin -r 32768 0 ../io_pic_v2/io_pic.hex ../io_pic_v2/io_pic.code.bin minipro -p PIC18F452 -c code -w io_pic.code.bin minipro -p PIC18F452 -e -c data -w io_pic.config.bin # optional verification step: minipro -p PIC18F452 -c code -r foo.bin cmp foo.bin io_pic.code.bin minipro -p PIC18F452 -c data -r foo.bin cmp foo.bin io_pic.config.bin ``` The function readhex() in readhex.c that hex2bin uses is very old code (thus C language). It probably could be improved. I don't actively use this tool any more. I generally have been using STM32 parts, and the [stm32flash](https://github.com/bradgrantham/stm32flash) tool I use can read .hex files directly. But if you submit a pull request, I'll try to merge within a week or so or start a thread about the merge. Thank you! Thanks to other individual contributors! * [milesfrain](https://github.com/milesfrain) * [bootladder](https://github.com/bootladder)