diff options
author | asier70 <asier70@gmail.com> | 2021-09-01 22:00:51 +0200 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2021-11-15 15:35:50 +0000 |
commit | 5a0b4889d0d46639b38effd24102f0d5fca1ca31 (patch) | |
tree | bbe74975b248e77b139fbcac3fceb02dce8b5b2e /src/flash | |
parent | a498a3deaaec7ee87d73cf753bdddefaf4779666 (diff) | |
download | riscv-openocd-5a0b4889d0d46639b38effd24102f0d5fca1ca31.zip riscv-openocd-5a0b4889d0d46639b38effd24102f0d5fca1ca31.tar.gz riscv-openocd-5a0b4889d0d46639b38effd24102f0d5fca1ca31.tar.bz2 |
flash/nor/stm32f1x: Add support for GD32E23x
GD32E23x from GigaDevice is cortex-M23 microcontroller and it can work with the stm32f1x driver.
Modifications are similar to this done for GD32F1x0 in #6164 (https://review.openocd.org/c/openocd/+/6164).
Configuration file is added because its cortex-M23 CPU ID is different.
I think that GigaDevice microcontrollers should be handled in an independent unit to separate them from STM32,
but nowadays quick solution is welcome.
Signed-off-by: asier70Andrzej Sierżęga <asier70@gmail.com>
Change-Id: I91f31f5f66808bc50a8f607ac2c107e6b7c5e2b8
Reviewed-on: https://review.openocd.org/c/openocd/+/6527
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/flash')
-rw-r--r-- | src/flash/nor/stm32f1x.c | 19 | ||||
-rw-r--r-- | src/flash/startup.tcl | 3 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c index 3bda9bc..6744779 100644 --- a/src/flash/nor/stm32f1x.c +++ b/src/flash/nor/stm32f1x.c @@ -640,6 +640,9 @@ static int stm32x_get_device_id(struct flash_bank *bank, uint32_t *device_id) case CORTEX_M4_PARTNO: /* STM32F3x devices */ device_id_register = 0xE0042000; break; + case CORTEX_M23_PARTNO: /* GD32E23x devices */ + device_id_register = 0x40015800; + break; default: LOG_ERROR("Cannot identify target as a stm32x"); return ERROR_FAIL; @@ -674,6 +677,9 @@ static int stm32x_get_flash_size(struct flash_bank *bank, uint16_t *flash_size_i case CORTEX_M4_PARTNO: /* STM32F3x devices */ flash_size_reg = 0x1FFFF7CC; break; + case CORTEX_M23_PARTNO: /* GD32E23x devices */ + flash_size_reg = 0x1FFFF7E0; + break; default: LOG_ERROR("Cannot identify target as a stm32x"); return ERROR_FAIL; @@ -756,8 +762,8 @@ static int stm32x_probe(struct flash_bank *bank) page_size = 1024; stm32x_info->ppage_size = 4; max_flash_size_in_kb = 128; - /* GigaDevice GD32F1x0 & GD32F3x0 series devices share DEV_ID - with STM32F101/2/3 medium-density line, + /* GigaDevice GD32F1x0 & GD32F3x0 & GD32E23x series devices + share DEV_ID with STM32F101/2/3 medium-density line, however they use a REV_ID different from any STM32 device. The main difference is another offset of user option bits (like WDG_SW, nRST_STOP, nRST_STDBY) in option byte register @@ -774,6 +780,11 @@ static int stm32x_probe(struct flash_bank *bank) stm32x_info->user_data_offset = 16; stm32x_info->option_offset = 6; break; + case 0x1909: /* gd32e23x */ + stm32x_info->user_data_offset = 16; + stm32x_info->option_offset = 6; + max_flash_size_in_kb = 64; + break; } break; case 0x412: /* stm32f1x low-density */ @@ -984,6 +995,10 @@ static int get_stm32x_info(struct flash_bank *bank, struct command_invocation *c device_str = "GD32F3x0"; break; + case 0x1909: /* gd32e23x */ + device_str = "GD32E23x"; + break; + case 0x2000: rev_str = "B"; break; diff --git a/src/flash/startup.tcl b/src/flash/startup.tcl index 93ef82c..16cbe19 100644 --- a/src/flash/startup.tcl +++ b/src/flash/startup.tcl @@ -121,3 +121,6 @@ proc stm32l5x args { eval stm32l4x $args } proc stm32u5x args { eval stm32l4x $args } proc stm32wbx args { eval stm32l4x $args } proc stm32wlx args { eval stm32l4x $args } + +# gd32e23x uses the same flash driver as the stm32f1x +proc gd32e23x args { eval stm32f1x $args } |