{"id":50614691,"url":"https://github.com/algodesigner/hex2bin","last_synced_at":"2026-06-06T07:03:16.475Z","repository":{"id":38380845,"uuid":"403980858","full_name":"algodesigner/hex2bin","owner":"algodesigner","description":"hex2bin converts an Intel hex file to binary","archived":false,"fork":false,"pushed_at":"2025-01-09T20:09:35.000Z","size":119,"stargazers_count":27,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-09T21:24:14.463Z","etag":null,"topics":["assembler","clanguage","compilers","hex","hex2bin","sdcc"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/algodesigner.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-07T13:04:03.000Z","updated_at":"2025-01-09T20:09:40.000Z","dependencies_parsed_at":"2025-01-09T21:31:38.564Z","dependency_job_id":null,"html_url":"https://github.com/algodesigner/hex2bin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/algodesigner/hex2bin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algodesigner%2Fhex2bin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algodesigner%2Fhex2bin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algodesigner%2Fhex2bin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algodesigner%2Fhex2bin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/algodesigner","download_url":"https://codeload.github.com/algodesigner/hex2bin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algodesigner%2Fhex2bin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33972398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembler","clanguage","compilers","hex","hex2bin","sdcc"],"created_at":"2026-06-06T07:03:13.553Z","updated_at":"2026-06-06T07:03:16.468Z","avatar_url":"https://github.com/algodesigner.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Yet Another Hex to bin converter\n\nIt can handle the extended Intel hex format in segmented and linear address\nmodes. Records need not be sorted and there can be gaps between records.\n\nSome hex files are produced by compilers. They generate objects files for each\nmodule in a project, and when the linker generates the final hex file, the\nobject files are stored within the hex files, but modules can appear not\nnecessary in order of address.\n\nHow does it work?\n\nHex2bin/mot2bin allocates a buffer and just place the converted bytes in its buffer.\nAt the end, the buffer is written to disk. Using a buffer eliminates the need to\nsort records. Hex2bin and mot2bin will calculate the needed buffer size directly\nfrom the hex file.\n\nBefore reading the hex file, the buffer is filled with a default value. These\npadding bytes are all FF by default so an EPROM programmer can skip these bytes\nwhen programming. The padding value can be changed with the -p option.\n\n1. Compiling on Linux or other unix platforms\n\n\tmake\n\n\tthen\n\n\tmake install\n\n\tThis will install the program to /usr/local/bin.\n\n1a. Compiling for Windows on Msys, Cygwin or DOS prompt\n\n\tVersions already compiled for Windows are in bin/Release\n\n\tThe programs can be compiled as follows:\n\t  gcc -O2 -Wall -o hex2bin.exe hex2bin.c common.c libcrc.c binary.c\n\t  gcc -O2 -Wall -o mot2bin.exe mot2bin.c common.c libcrc.c binary.c\n\n2. Using hex2bin\n\n\thex2bin example.hex\n\n\thex2bin will generate a binary file example.bin starting at the\n\tlowest address in the hex file.\n\n3. Binary file starting address and length\n\n\tIf the lowest address isn't 0000,\n\t    ex: 0100: (the first record begins with :nn010000xxx )\n\n\tthere will be problems when using the binary file to program a EPROM\n\tsince the first byte supposed to be at 0100 is stored in the binary file\n\tat 0000.\n\n\tyou can specify a starting address for the binary file on the command line:\n\n\thex2bin -s 0000 start_at_0100.hex\n\n\t\tThis start address is not the same thing as the start address record in\n\t\tthe hex file. The start address record is used to specify the starting\n\t\taddress for execution of the binary code.\n\n\tThe bytes will be stored in the binary file with a padding from 0000\n\tto the lowest address minus 1 (00FF in this case).\n\n\tSimilarly, the binary file can be padded up to Length -1 with FF or another byte.\n\n\tHere, the space between the last byte and 07FF will be filled with FF.\n\thex2bin -l 0800 ends_before_07FF.hex\n\n\tEPROM, EEPROM and Flash memories contain all FF when erased.\n\n\tThis program does minimal error checking since many hex files are\n\tgenerated by known good assemblers.\n\n\tWhen the source file name is\n\t\tfor-example.test.hex\n\tthe binary created will have the name\n\t\tfor-example.bin\n\tthe \".test\" part will be dropped.\n\n\tHex2bin/mot2bin assume the source file doesn't contain overlapping records,\n\tif so, overlaps will be reported.\n\n4. Checksum of source file\n\n\tBy default, it ignores record checksum errors, so that someone can change\n\tby hand some bytes allowing quick and dirty changes.\n\tIf you want checksum error reporting, specify the option -c.\n\n\thex2bin -c example.hex\n\n\tIf there is a record checksum error somewhere, the program will continue the\n\tconversion anyway.\n\n\tThe example file example.hex contains some records with checksum errors.\n\n5. Check value inserted inside binary file\n\n\tA check value can be inserted in the resulting binary file.\n\n\thex2bin -k [0-4] -r [start] [end] -f [address] -C [Poly] [Init] [RefIn] [RefOut] [XorOut]\n\n\t-k  Select the check method:\n\t\t   0:  Checksum  8-bit\n\t\t   1:  Checksum 16-bit\n\t\t   2:  CRC8\n\t\t   3:  CRC16\n\t\t   4:  CRC32\n\n    -r\tRange to compute checksum over (default is min and max addresses)\n\n    -f  Address of the result to write\n\n    -C  Parameters for CRC\n        Parameters for common CRCs are listed in doc/CRC list.txt. They appear in\n        the same order. Feed them as is and use t for TRUE, f for FALSE.\n\n        See also the test/Makefile for these common CRCs; since they're tested,\n        you'll have the command line figured out.\n\n    -E  Endian for storing the check result or forcing it\n           0: little\n           1: big\n\n    Change from previous versions of hex2bin/mot2bin:\n\tReplace former options to this version\n\t\t  -k 1\t\t-\u003e\t\t-k 1 -E 0\n\t\t  -k 2\t\t-\u003e\t\t-k 1 -E 1\n\n6. Value inserted directly inside binary file\n    Instead of calculating a value, it can be inserted directly into the file at a specified address.\n\n    hex2bin -k [0|1|2] -F [address] [value]\n\n\t-k  Select the value format:\n\n\t\t0 = 8-bit\n\t\t1 = 16-bit\n\t\t2 = 32-bit\n\n    -F\tAddress and value of checksum to force\n\n    -E  Endian for storing the check result or forcing it\n           0: little\n           1: big\n\n7. Motorola S files\n\n\tmot2bin example.s19\n\n\tOptions for mot2bin are the same as hex2bin. Executing the program\n\twithout argument will display available options. Some are specific to\n\tMotorola files.\n\n\tThis program will handle S19 files generated for Motorola micropro-\n\tcessors. 32, 24 bits or 16 bits address records are supported up to\n\tthe memory available.\n\n8. Support for byte-swapped hex/S19 files\n\n    -w\tWordwise swap: for each pair of bytes, exchange the low and high part.\n\tIf a checksum needs to be generated to insert in the binary file, select\n\tone of the 16-bit checksums.\n\n\thex2bin -w test-byte-swap.hex\n\n9. Batch file/script mode\n\n    Hex2bin won't ask for replacement files if the one specified is not found.\n    This is convenient in batch files, Makefiles or scripts.\n\n    hex2bin -b test.hex\n\n10. Goodies\n\n\tDescription of the file formats is included.\n\tAdded examples files for extended addressing.\n\n\tCheck for overlapping records. The check is rather basic: supposing\n\tthat the buffer is filled with pad bytes, when a record overlaps a\n\tprevious one, value in the buffer will be different from the pad bytes.\n\tThis will not detect the case when the previous value equals the pad byte,\n\tbut it's more likely that more than one byte will be overlapped.\n\n11. Error messages\n\n    \"Can't allocate memory.\"\n\n    Can't do anything in this case, so the program simply exits.\n\n    \"Error occurred while reading from file\"\n\n    Problem with fgets.\n\n\t\"Input/Output file %s cannot be opened. Enter new filename: \"\n\n\tThe user may not have permissions to open the file.\n\n\t\"0 byte length data record ignored\"\n\n\tThis means that an empty data record was read. Since it's empty, it's simply\n\tignored and should have no impact on the binary file.\n\n\t\"Data record skipped at ...\"\n\n\tThis means that the records are falling outside the memory buffer.\n\n\t\"Overlapped record detected\"\n\n\tA record is overwritten by a subsequent record. If you're using SDCC, check\n\tif more than one area is specified with a starting address. Checking the map\n\tfile generated by the linker can help.\n\n\t\"Some error occurred when parsing options.\"\n\n\n12. History\n\n        See ChangeLog\n\n13. Other hex tool\n\n\tThere is a program that supports more formats and has more features.\n\tSee SRecord at http://srecord.sourceforge.net/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgodesigner%2Fhex2bin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falgodesigner%2Fhex2bin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgodesigner%2Fhex2bin/lists"}