diff options
author | Keith Packard <keithp@keithp.com> | 2008-12-30 22:35:53 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2008-12-30 22:38:35 -0800 |
commit | 6c2a65c743a4ffae96ed27dbc38c1bf9242ed1df (patch) | |
tree | bea5fb122dfcc2edfcff0baca30dd1166a1d24af /lib/ccdbg-flash.c | |
parent | ea366058aa467a8a7caf17e7014758f3741ea7f7 (diff) |
Save/restore registers to host during memory operations. Cache ROM data.
Because the debug port uses instructions for most operations, the debug code
will clobber registers used by the running program. Save and restore these
to avoid corrupting application data.
If the ROM file is known, use that to return data instead of fetching it
from the target to improve performance.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'lib/ccdbg-flash.c')
-rw-r--r-- | lib/ccdbg-flash.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ccdbg-flash.c b/lib/ccdbg-flash.c index 8b3390c7..8a586a21 100644 --- a/lib/ccdbg-flash.c +++ b/lib/ccdbg-flash.c @@ -288,13 +288,14 @@ ccdbg_flash_hex_image(struct ccdbg *dbg, struct hex_image *image) ccdbg_debug(CC_DEBUG_FLASH, "Upload %d bytes at 0x%04x\n", this_time, ram_addr); ccdbg_write_memory(dbg, ram_addr, image->data + start, this_time); - +#if 0 ccdbg_debug(CC_DEBUG_FLASH, "Verify %d bytes in ram\n", this_time); ccdbg_read_memory(dbg, ram_addr, verify, this_time); if (memcmp (image->data + start, verify, this_time) != 0) { fprintf(stderr, "ram verify failed\n"); return 1; } +#endif flash_addr = image->address + start; flash_word_addr = flash_addr >> 1; @@ -324,10 +325,13 @@ ccdbg_flash_hex_image(struct ccdbg *dbg, struct hex_image *image) status = ccdbg_resume(dbg); for (times = 0; times < 10; times++) { status = ccdbg_read_status(dbg); - ccdbg_debug(CC_DEBUG_FLASH, "chip status is 0x%02x\n", status); + ccdbg_debug(CC_DEBUG_FLASH, "."); + ccdbg_flush(CC_DEBUG_FLASH); if ((status & CC_STATUS_CPU_HALTED) != 0) break; + usleep(10000); } + ccdbg_debug(CC_DEBUG_FLASH, "\n"); if (times == 10) { fprintf(stderr, "flash page timed out\n"); return 1; |