X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Fao-stmload%2Fao-stmload.c;h=7f521bbc58f02c83e52cd0213d9efe727fb797ce;hp=71d1ec572409e6ebd54d71a7ea40e90db22869aa;hb=e6c9ca218d944443c86555e513534d82713af936;hpb=d93a65a90f19e4816231e03b1f399af6e3742aee diff --git a/ao-tools/ao-stmload/ao-stmload.c b/ao-tools/ao-stmload/ao-stmload.c index 71d1ec57..7f521bbc 100644 --- a/ao-tools/ao-stmload/ao-stmload.c +++ b/ao-tools/ao-stmload/ao-stmload.c @@ -56,10 +56,8 @@ struct ao_sym ao_symbols[] = { }; #define NUM_SYMBOLS 5 -#define NUM_REQUIRED_SYMBOLS 3 int ao_num_symbols = NUM_SYMBOLS; -int ao_num_required_symbols = NUM_REQUIRED_SYMBOLS; /* * Edit the to-be-written memory block @@ -82,40 +80,6 @@ rewrite(struct ao_hex_image *load, unsigned address, uint8_t *data, int length) memcpy(load->data + address - load->address, data, length); } -/* - * Read a 16-bit value from the USB target - */ - -static uint16_t -get_uint16_cc(struct cc_usb *cc, uint32_t addr) -{ - struct ao_hex_image *hex = ao_self_read(cc, addr, 2); - uint16_t v; - uint8_t *data; - - if (!hex) - return 0; - data = hex->data + addr - hex->address; - v = data[0] | (data[1] << 8); - free(hex); - return v; -} - -static uint32_t -get_uint32_cc(struct cc_usb *cc, uint32_t addr) -{ - struct ao_hex_image *hex = ao_self_read(cc, addr, 4); - uint32_t v; - uint8_t *data; - - if (!hex) - return 0; - data = hex->data + addr - hex->address; - v = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); - free(hex); - return v; -} - /* * Read a 16-bit value from the target device with arbitrary * alignment @@ -148,7 +112,7 @@ get_uint16(stlink_t *sl, struct cc_usb *cc, uint32_t addr) { uint16_t result; if (cc) - result = get_uint16_cc(cc, addr); + result = ao_self_get_uint16(cc, addr); else result = get_uint16_sl(sl, addr); printf ("read 0x%08x = 0x%04x\n", addr, result); @@ -193,7 +157,7 @@ get_uint32(stlink_t *sl, struct cc_usb *cc, uint32_t addr) uint32_t result; if (cc) - result = get_uint32_cc(cc, addr); + result = ao_self_get_uint32(cc, addr); else result = get_uint32_sl(sl, addr); printf ("read 0x%08x = 0x%08x\n", addr, result);