diff options
author | drath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-08-14 09:48:54 +0000 |
---|---|---|
committer | drath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-08-14 09:48:54 +0000 |
commit | 29000b204d039bc1123027eba755329ab36a3dde (patch) | |
tree | 841d600e015592b5abd77b982dfb0d9cde51a399 /src/flash/at91sam7.c | |
parent | abbd2b62ad445d4056567e2573416498a55da9af (diff) | |
download | riscv-openocd-29000b204d039bc1123027eba755329ab36a3dde.zip riscv-openocd-29000b204d039bc1123027eba755329ab36a3dde.tar.gz riscv-openocd-29000b204d039bc1123027eba755329ab36a3dde.tar.bz2 |
- reworked presto.c to allow use of either FTD2XX or libftdi (libftdi not functional yet). Configure option changed from --enable-presto to
--enable-presto_ftd2xx and --enable-presto_libftdi
- completed trace point support for use with ARM7/9 DCC
- completed debug message output with support for HEX dumps (1, 2 or 4 byte quantities)
- fixed bug in delete_debug_msg_receiver (thanks to Pavel Chromy)
- fixed bug in image_add_section (thanks to Pavel Chromy)
- at91sam7 sector erase reworked (thanks to Pavel Chromy)
- merge consecutive sections during flash image write to work around possible section alignment issues with LPC2000 targets
git-svn-id: svn://svn.berlios.de/openocd/trunk@194 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash/at91sam7.c')
-rw-r--r-- | src/flash/at91sam7.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index fdc1c51..b4b3475 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -326,7 +326,15 @@ int at91sam7_read_part_info(struct flash_bank_s *bank) at91sam7_info->cidr_version = cidr&0x001F; bank->size = NVPSIZ[at91sam7_info->cidr_nvpsiz]; at91sam7_info->target_name = "Unknown"; - + + /* Support just for bulk erase of the whole device */ + bank->num_sectors = 1; + bank->sectors = malloc(sizeof(flash_sector_t)); + bank->sectors[0].offset = 0; + bank->sectors[0].size = bank->size; + bank->sectors[0].is_erased = -1; + bank->sectors[0].is_protected = -1; + DEBUG("nvptyp: 0x%3.3x, arch: 0x%4.4x", at91sam7_info->cidr_nvptyp, at91sam7_info->cidr_arch ); /* Read main and master clock freqency register */ @@ -565,22 +573,27 @@ int at91sam7_erase(struct flash_bank_s *bank, int first, int last) return ERROR_FLASH_OPERATION_FAILED; } - if ((first < 0) || (last < first) || (last >= at91sam7_info->num_lockbits)) + if ((first < 0) || (last < first) || (last >= bank->num_sectors)) { - return ERROR_FLASH_SECTOR_INVALID; + if ((first == 0) && (last == (at91sam7_info->num_lockbits-1))) + { + WARNING("Sector numbers based on lockbit count, probably a deprecated script"); + last = bank->num_sectors-1; + } + else return ERROR_FLASH_SECTOR_INVALID; } - /* Configure the flash controller timing */ - at91sam7_read_clock_info(bank); - at91sam7_set_flash_mode(bank,FMR_TIMING_FLASH); - - if ((first == 0) && (last == (at91sam7_info->num_lockbits-1))) + if ((first != 0) || (last != (bank->num_sectors-1))) { - return at91sam7_flash_command(bank, EA, 0); + WARNING("Can only erase the whole flash area, pages are autoerased on write"); + return ERROR_FLASH_OPERATION_FAILED; } - WARNING("Can only erase the whole flash area, pages are autoerased on write"); - return ERROR_FLASH_OPERATION_FAILED; + /* Configure the flash controller timing */ + at91sam7_read_clock_info(bank); + at91sam7_set_flash_mode(bank,FMR_TIMING_FLASH); + + return at91sam7_flash_command(bank, EA, 0); } int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last) |