diff options
author | ntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-02-10 15:46:14 +0000 |
---|---|---|
committer | ntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-02-10 15:46:14 +0000 |
commit | fb74f48b53a035a4bcbffba4057a5bf2e4e50d1f (patch) | |
tree | cb89f0a94411bc481b9ea0c79c61aa80e3a25d38 /src/flash | |
parent | 53bbd36c7d5adfe86aef071e2effbbfa804d0054 (diff) | |
download | riscv-openocd-fb74f48b53a035a4bcbffba4057a5bf2e4e50d1f.zip riscv-openocd-fb74f48b53a035a4bcbffba4057a5bf2e4e50d1f.tar.gz riscv-openocd-fb74f48b53a035a4bcbffba4057a5bf2e4e50d1f.tar.bz2 |
- stm32 flash driver now checks for correct target
git-svn-id: svn://svn.berlios.de/openocd/trunk@288 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash')
-rw-r--r-- | src/flash/stm32x.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index 5b16f57..7039a3d 100644 --- a/src/flash/stm32x.c +++ b/src/flash/stm32x.c @@ -644,9 +644,20 @@ int stm32x_probe(struct flash_bank_s *bank) stm32x_flash_bank_t *stm32x_info = bank->driver_priv; int i; u16 num_sectors; + u32 device_id; stm32x_info->probed = 0; + /* read stm32 device id register */ + target_read_u32(target, 0xE0042000, &device_id); + INFO( "device id = 0x%08x", device_id ); + + if (!(device_id & 0x410)) + { + WARNING( "Cannot identify target as a STM32 family." ); + return ERROR_FLASH_OPERATION_FAILED; + } + /* get flash size from target */ target_read_u16(target, 0x1FFFF7E0, &num_sectors); INFO( "flash size = %dkbytes", num_sectors ); |