Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit ec38a28

Browse files
committed
riscv32, jtag: Detect Nucleisys DTM of GD32VW553
* Proper JEP-106 value of 0xa36 belonging to Nuclei Systems Technology * 307 is related to Nuclei N307 processor core
1 parent 8fc1e28 commit ec38a28

6 files changed

Lines changed: 30 additions & 1 deletion

File tree

src/target/jep106.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
* This JEP code is used on RISC-V by GigaDevice, because
7373
* "Note: The Bumblebee core used for this MCU is jointly developed by Nuclei System Technology and Andes Technology."
7474
*/
75-
#define JEP106_MANUFACTURER_ANDES 0x61eU /* Andes Technology Corporation */
75+
#define JEP106_MANUFACTURER_ANDES 0x61eU /* Andes Technology Corporation */
76+
#define JEP106_MANUFACTURER_NUCLEI 0xa36U /* Nuclei System Technology */
7677

7778
/*
7879
* Used by WCH (WinChipHead) aka Nanjing Qinheng Microelectronics

src/target/jtag_devs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,15 @@ const jtag_dev_descr_s dev_descr[] = {
414414
#endif
415415
.handler = riscv_jtag_dtm_handler,
416416
},
417+
{
418+
.idcode = 0x00307a6dU,
419+
.idmask = 0x0fffffffU,
420+
#if ENABLE_DEBUG == 1
421+
.descr = "Nuclei Systems DTM",
417422
#endif
423+
.handler = riscv_jtag_dtm_handler,
424+
},
425+
#endif // CONFIG_RISCV
418426
#if defined(CONFIG_CORTEXAR) && defined(CONFIG_TI_ICEPICK)
419427
{
420428
.idcode = 0x0b90002fU,

src/target/riscv32.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ bool riscv32_probe(target_s *const target)
9292
case JEP106_MANUFACTURER_ANDES:
9393
PROBE(gd32vf1_probe);
9494
break;
95+
case JEP106_MANUFACTURER_NUCLEI:
96+
PROBE(gd32vw5_probe);
97+
break;
9598
case JEP106_MANUFACTURER_RASPBERRY:
9699
PROBE(rp2350_probe);
97100
break;

src/target/stm32f1.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,21 @@ static void gd32vf1_detach(target_s *const target)
393393
/* Now defer to the normal Cortex-M detach routine to complete the detach */
394394
riscv_detach(target);
395395
}
396+
397+
/* Identify RISC-V GD32VW5 chips */
398+
bool gd32vw5_probe(target_s *const target)
399+
{
400+
const uint16_t device_id = target_mem32_read32(target, GD32E5_DBGMCU_BASE) & 0xfffU;
401+
const uint32_t signature = target_mem32_read32(target, GD32Fx_FLASHSIZE);
402+
const uint16_t flash_size = signature & 0xffffU;
403+
const uint16_t ram_size = signature >> 16U;
404+
DEBUG_WARN("Stub for detection of GD32VW553. DBG_ID=0x%x, RAM=%u, flash=%u\n", device_id, ram_size, flash_size);
405+
target->driver = "GD32VW5";
406+
target->part_id = device_id;
407+
target_add_ram32(target, STM32F1_SRAM_BASE, ram_size * 1024U);
408+
target_add_ram32(target, STM32F1_FLASH_BANK1_BASE, flash_size * 1024U);
409+
return true;
410+
}
396411
#endif
397412
#endif
398413

src/target/target_probe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ TARGET_PROBE_WEAK_NOP(efm32_probe)
114114
TARGET_PROBE_WEAK_NOP(gd32f1_probe)
115115
TARGET_PROBE_WEAK_NOP(gd32f4_probe)
116116
TARGET_PROBE_WEAK_NOP(gd32vf1_probe)
117+
TARGET_PROBE_WEAK_NOP(gd32vw5_probe)
117118
TARGET_PROBE_WEAK_NOP(hc32l110_probe)
118119
TARGET_PROBE_WEAK_NOP(imxrt_probe)
119120
TARGET_PROBE_WEAK_NOP(ke04_probe)

src/target/target_probe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ bool ch32vx_probe(target_s *target);
6565
bool gd32f1_probe(target_s *target);
6666
bool gd32f4_probe(target_s *target);
6767
bool gd32vf1_probe(target_s *target);
68+
bool gd32vw5_probe(target_s *target);
6869
bool hc32l110_probe(target_s *target);
6970
bool imxrt_probe(target_s *target);
7071
bool ke04_probe(target_s *target);

0 commit comments

Comments
 (0)