Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/target/jep106.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@
#define JEP106_MANUFACTURER_RENESAS 0x423U /* Renesas */
#define JEP106_MANUFACTURER_XILINX 0x309U /* Xilinx - Technically 0x049, but they use Ikanos Communications' code */
/*
* This JEP code should belong to "Andes Technology Corporation", but is used on RISC-V by GigaDevice,
* so in the unlikely event we need to support chips by them, here be dragons.
* This JEP code is used on RISC-V by GigaDevice, because
* "Note: The Bumblebee core used for this MCU is jointly developed by Nuclei System Technology and Andes Technology."
*/
#define JEP106_MANUFACTURER_RV_GIGADEVICE 0x61eU
#define JEP106_MANUFACTURER_ANDES 0x61eU /* Andes Technology Corporation */
#define JEP106_MANUFACTURER_NUCLEI 0xa36U /* Nuclei System Technology */

/*
* Used by WCH (WinChipHead) aka Nanjing Qinheng Microelectronics
Expand Down
10 changes: 9 additions & 1 deletion src/target/jtag_devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,19 @@ const jtag_dev_descr_s dev_descr[] = {
.idcode = 0x0000563dU,
.idmask = 0x0fffffffU,
#if ENABLE_DEBUG == 1
.descr = "RISC-V debug v0.13.",
.descr = "Andes Tech RISC-V DTM.",
#endif
.handler = riscv_jtag_dtm_handler,
},
{
.idcode = 0x00307a6dU,
.idmask = 0x0fffffffU,
#if ENABLE_DEBUG == 1
.descr = "Nuclei Systems RISC-V DTM.",
#endif
.handler = riscv_jtag_dtm_handler,
},
#endif // CONFIG_RISCV
#if defined(CONFIG_CORTEXAR) && defined(CONFIG_TI_ICEPICK)
{
.idcode = 0x0b90002fU,
Expand Down
9 changes: 6 additions & 3 deletions src/target/riscv32.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,21 @@ bool riscv32_probe(target_s *const target)
target->breakwatch_clear = riscv32_breakwatch_clear;

switch (target->designer_code) {
case JEP106_MANUFACTURER_RV_GIGADEVICE:
case JEP106_MANUFACTURER_ANDES:
PROBE(gd32vf1_probe);
break;
case JEP106_MANUFACTURER_NUCLEI:
PROBE(gd32vw5_probe);
break;
case JEP106_MANUFACTURER_RASPBERRY:
PROBE(rp2350_probe);
break;
default:
break;
case JEP106_MANUFACTURER_WCH:
PROBE(ch32v003x_probe);
PROBE(ch32vx_probe);
break;
default:
break;
}

#if CONFIG_BMDA == 0
Expand Down
19 changes: 17 additions & 2 deletions src/target/stm32f1.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,21 @@ static void gd32vf1_detach(target_s *const target)
/* Now defer to the normal Cortex-M detach routine to complete the detach */
riscv_detach(target);
}

/* Identify RISC-V GD32VW5 chips */
bool gd32vw5_probe(target_s *const target)
{
const uint16_t device_id = target_mem32_read32(target, GD32E5_DBGMCU_BASE) & 0xfffU;
const uint32_t signature = target_mem32_read32(target, GD32Fx_FLASHSIZE);
const uint16_t flash_size = signature & 0xffffU;
const uint16_t ram_size = signature >> 16U;
DEBUG_WARN("Stub for detection of GD32VW553. DBG_ID=0x%x, RAM=%u, flash=%u\n", device_id, ram_size, flash_size);
target->driver = "GD32VW5";
target->part_id = device_id;
target_add_ram32(target, STM32F1_SRAM_BASE, ram_size * 1024U);
target_add_ram32(target, STM32F1_FLASH_BANK1_BASE, flash_size * 1024U);
return true;
}
#endif
#endif

Expand Down Expand Up @@ -1139,7 +1154,7 @@ static bool stm32f1_flash_write(

target_mem32_write32(target, STM32F1_FPEC_CTRL, STM32F1_FPEC_PG);
/* Use the target API instead of a direct Cortex-M call for GD32VF103 parts */
if (target->designer_code == JEP106_MANUFACTURER_RV_GIGADEVICE && target->cpuid == 0x80000022U)
if (target->designer_code == JEP106_MANUFACTURER_ANDES && target->cpuid == 0x80000022U)
target_mem32_write(target, dest, src, offset);
else
cortexm_mem_write_aligned(target, dest, src, offset, psize);
Expand All @@ -1157,7 +1172,7 @@ static bool stm32f1_flash_write(

target_mem32_write32(target, STM32F1_FPEC_CTRL + STM32F1_FPEC_BANK2_OFFSET, STM32F1_FPEC_PG);
/* Use the target API instead of a direct Cortex-M call for GD32VF103 parts */
if (target->designer_code == JEP106_MANUFACTURER_RV_GIGADEVICE && target->cpuid == 0x80000022U)
if (target->designer_code == JEP106_MANUFACTURER_ANDES && target->cpuid == 0x80000022U)
target_mem32_write(target, dest + offset, data + offset, remainder);
else
cortexm_mem_write_aligned(target, dest + offset, data + offset, remainder, psize);
Expand Down
1 change: 1 addition & 0 deletions src/target/target_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ TARGET_PROBE_WEAK_NOP(efm32_probe)
TARGET_PROBE_WEAK_NOP(gd32f1_probe)
TARGET_PROBE_WEAK_NOP(gd32f4_probe)
TARGET_PROBE_WEAK_NOP(gd32vf1_probe)
TARGET_PROBE_WEAK_NOP(gd32vw5_probe)
TARGET_PROBE_WEAK_NOP(hc32l110_probe)
TARGET_PROBE_WEAK_NOP(imxrt_probe)
TARGET_PROBE_WEAK_NOP(ke04_probe)
Expand Down
1 change: 1 addition & 0 deletions src/target/target_probe.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ bool ch32vx_probe(target_s *target);
bool gd32f1_probe(target_s *target);
bool gd32f4_probe(target_s *target);
bool gd32vf1_probe(target_s *target);
bool gd32vw5_probe(target_s *target);
bool hc32l110_probe(target_s *target);
bool imxrt_probe(target_s *target);
bool ke04_probe(target_s *target);
Expand Down
Loading