summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authorntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-12-29 13:51:48 +0000
committerntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-12-29 13:51:48 +0000
commit6c9b804d6187edda4f46f8458deec0b17ec76bb9 (patch)
treebb557b729b05e00b4839b199e58e066cdfa4c4b5 /src/flash
parent2ec5bd2864e55654258070381ce58c126e9fbe7b (diff)
downloadopenocd+libswd-6c9b804d6187edda4f46f8458deec0b17ec76bb9.tar.gz
openocd+libswd-6c9b804d6187edda4f46f8458deec0b17ec76bb9.tar.bz2
openocd+libswd-6c9b804d6187edda4f46f8458deec0b17ec76bb9.tar.xz
openocd+libswd-6c9b804d6187edda4f46f8458deec0b17ec76bb9.zip
- 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
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/flash.c28
-rw-r--r--src/flash/flash.h1
2 files changed, 21 insertions, 8 deletions
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);