summaryrefslogtreecommitdiff
path: root/ccdbg-memory.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-12-18 12:07:06 -0800
committerKeith Packard <keithp@keithp.com>2008-12-18 12:07:06 -0800
commitdc03adc179669d41e3551d74b3c5a60db41ff217 (patch)
treedc9558efc881efbb3c22cde85cb870889becb37f /ccdbg-memory.c
parent807e2adacb025af77bb53c03209e9c8e0d7a5f95 (diff)
Add ability to load Intel HEX files. Add sample sdcc LED blinker.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ccdbg-memory.c')
-rw-r--r--ccdbg-memory.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ccdbg-memory.c b/ccdbg-memory.c
index ffc09679..fa953d17 100644
--- a/ccdbg-memory.c
+++ b/ccdbg-memory.c
@@ -73,3 +73,21 @@ ccdbg_read_memory(struct ccdbg *dbg, uint16_t addr, uint8_t *bytes, int nbytes)
*bytes++ = ccdbg_execute(dbg, read8);
return 0;
}
+
+uint8_t
+ccdbg_write_hex(struct ccdbg *dbg, struct hex_file *hex)
+{
+ int i;
+ struct hex_record *record;
+
+ for (i = 0; i < hex->nrecord; i++) {
+ record = hex->records[i];
+ if (record->type == HEX_RECORD_EOF)
+ break;
+ printf("Write %d bytes at 0x%04x\n",
+ record->length, record->address);
+ ccdbg_write_memory(dbg, record->address,
+ record->data, record->length);
+ }
+ return 0;
+}