FreeCalypso > hg > fc-usbser-tools
comparison cp2102/patch_ee_file.c @ 92:915a6fa7723e
cp2102-patch-ee-image program written, compiles
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 28 Sep 2023 01:37:43 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 91:f4a7ac90cf39 | 92:915a6fa7723e |
|---|---|
| 1 /* | |
| 2 * This program reads a CP2102 EEPROM image from an Intel HEX file, | |
| 3 * applies patches to it from a patch specification file, and writes out | |
| 4 * a new Intel HEX image. | |
| 5 */ | |
| 6 | |
| 7 #include <sys/types.h> | |
| 8 #include <stdio.h> | |
| 9 #include <stdlib.h> | |
| 10 #include "cp210x_defs.h" | |
| 11 | |
| 12 u_char eeprom[SIZE_EEPROM]; | |
| 13 | |
| 14 main(argc, argv) | |
| 15 char **argv; | |
| 16 { | |
| 17 FILE *outf; | |
| 18 | |
| 19 if (argc != 4) { | |
| 20 fprintf(stderr, | |
| 21 "usage: %s input-hex-file patch-spec output-hex-file\n", | |
| 22 argv[0]); | |
| 23 exit(1); | |
| 24 } | |
| 25 read_intel_hex(argv[1]); | |
| 26 apply_eeprom_patch_file(argv[2]); | |
| 27 outf = fopen(argv[3], "w"); | |
| 28 if (!outf) { | |
| 29 perror(argv[3]); | |
| 30 exit(1); | |
| 31 } | |
| 32 intel_hex_out(eeprom, outf); | |
| 33 fclose(outf); | |
| 34 exit(0); | |
| 35 } |
