From 6c9b804d6187edda4f46f8458deec0b17ec76bb9 Mon Sep 17 00:00:00 2001 From: ntfreak Date: Sat, 29 Dec 2007 13:51:48 +0000 Subject: - minimum autoconf 2.59 is now required and verified - due to issues with AS_HELP_STRING - native win32 now handles WSAECONNRESET - no longer exits openocd - qCRC packet now works correctly under cygwin (gdb compare-sections command) - removed __USE_GNU define from gdbserver.c - gdb qSupported packet is now handled, with this we are able to tell gdb packet size, memory map of target - added new target script gdb_program_config - called before gdb flash programming - new gdb server command gdb_memory_map (enable|disable> - default is disable - new gdb server command gdb_flash_program (enable|disable> - default is disable - gdb flash programming supported - vFlash packets - image_elf_read_section now does not clear any remaining data, this was causing the gdb checksum to fail with certain files - reformat of usbprog.c - memory leak in command_print fixed - updated texi doc to include new commands - added gdb programming section to docs git-svn-id: svn://svn.berlios.de/openocd/trunk@246 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/flash/flash.c | 28 ++++++++++++++++++++-------- src/flash/flash.h | 1 + 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src/flash') diff --git a/src/flash/flash.c b/src/flash/flash.c index efd16c34..de42fcde 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -393,6 +393,9 @@ int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, char * return ERROR_INVALID_ARGUMENTS; } + /* We can't know if we did a resume + halt, in which case we no longer know the erased state */ + flash_set_dirty(); + duration_start_measure(&duration); if ((retval = flash_erase(target, address, length)) != ERROR_OK) @@ -766,6 +769,21 @@ int handle_flash_write_binary_command(struct command_context_s *cmd_ctx, char *c return ERROR_OK; } +void flash_set_dirty(void) +{ + flash_bank_t *c; + int i; + + /* set all flash to require erasing */ + for (c = flash_banks; c; c = c->next) + { + for (i = 0; i < c->num_sectors; i++) + { + c->sectors[i].is_erased = 0; + } + } +} + /* lookup flash bank by address */ flash_bank_t *get_flash_bank_by_addr(target_t *target, u32 addr) { @@ -852,14 +870,8 @@ int flash_write(target_t *target, image_t *image, u32 *written, char **error_str { /* assume all sectors need erasing - stops any problems * when flash_write is called multiple times */ - - for (c = flash_banks; c; c = c->next) - { - for (i = 0; i < c->num_sectors; i++) - { - c->sectors[i].is_erased = 0; - } - } + + flash_set_dirty(); } /* loop until we reach end of the image */ diff --git a/src/flash/flash.h b/src/flash/flash.h index e8f91500..0f616a9a 100644 --- a/src/flash/flash.h +++ b/src/flash/flash.h @@ -68,6 +68,7 @@ extern int flash_init(struct command_context_s *cmd_ctx); extern int flash_erase(target_t *target, u32 addr, u32 length); extern int flash_write(target_t *target, image_t *image, u32 *written, char **error, int *failed, int erase); +extern void flash_set_dirty(void); extern flash_bank_t *get_flash_bank_by_num(int num); extern flash_bank_t *get_flash_bank_by_addr(target_t *target, u32 addr); -- cgit v1.2.3-18-g5258