X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Fao-load%2Fao-load.c;h=a2de42bc02b3d0672907795c3dae0183dda5f511;hp=1b729d393a7bba5f7f3942f4768b3bee480e946c;hb=HEAD;hpb=d007bccf6cb36d24a9c7c48de7d80759ac6f2e37 diff --git a/ao-tools/ao-load/ao-load.c b/ao-tools/ao-load/ao-load.c index 1b729d39..a2de42bc 100644 --- a/ao-tools/ao-load/ao-load.c +++ b/ao-tools/ao-load/ao-load.c @@ -26,7 +26,7 @@ #define AO_USB_DESC_STRING 3 -struct sym { +static struct sym { unsigned addr; char *name; int required; @@ -80,7 +80,7 @@ find_symbols(FILE *map) } static int -rewrite(struct hex_image *image, unsigned addr, char *data, int len) +rewrite(struct ao_hex_image *image, unsigned addr, char *data, int len) { int i; if (addr < image->address || image->address + image->length < addr + len) @@ -93,6 +93,7 @@ rewrite(struct hex_image *image, unsigned addr, char *data, int len) printf (" %02x", data[i]); printf("\n"); memcpy(image->data + addr - image->address, data, len); + return 1; } static const struct option options[] = { @@ -112,10 +113,8 @@ int main (int argc, char **argv) { struct ccdbg *dbg; - uint8_t status; - uint16_t pc; - struct hex_file *hex; - struct hex_image *image; + struct ao_hex_file *hex; + struct ao_hex_image *image; char *filename; FILE *file; FILE *map; @@ -182,22 +181,22 @@ main (int argc, char **argv) } fclose(map); - hex = ccdbg_hex_file_read(file, filename); + hex = ao_hex_file_read(file, filename); fclose(file); if (!hex) { perror(filename); exit (1); } - image = ccdbg_hex_image_create(hex); + image = ao_hex_image_create(hex); if (!image) { fprintf(stderr, "image create failed\n"); exit (1); } - ccdbg_hex_file_free(hex); + ao_hex_file_free(hex); serial = strtoul(serial_string, NULL, 0); if (!serial) -(argv[0]); + usage(argv[0]); serial_int[0] = serial & 0xff; serial_int[1] = (serial >> 8) & 0xff; @@ -276,7 +275,7 @@ main (int argc, char **argv) } else { printf("Cannot load code to 0x%04x\n", image->address); - ccdbg_hex_image_free(image); + ao_hex_image_free(image); ccdbg_close(dbg); exit(1); }