From 8fd736a2a51c944e3412c1f4902e471dfd6df01b Mon Sep 17 00:00:00 2001 From: dragonmux Date: Thu, 9 Feb 2023 11:09:47 +0000 Subject: [PATCH] riscv32: Implemented probing for the GD32VF1 --- src/target/jep106.h | 5 +++++ src/target/riscv32.c | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/target/jep106.h b/src/target/jep106.h index 83317b9f9dd..bc410a982ec 100644 --- a/src/target/jep106.h +++ b/src/target/jep106.h @@ -68,6 +68,11 @@ #define JEP106_MANUFACTURER_RASPBERRY 0x913U /* Raspberry Pi */ #define JEP106_MANUFACTURER_RENESAS 0x423U /* Renesas */ #define JEP106_MANUFACTURER_XILINX 0x309U /* Xilinx */ +/* + * 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. + */ +#define JEP106_MANUFACTURER_RV_GIGADEVICE 0x61eU /* * This code is not listed in the JEP106 standard, but is used by some stm32f1 clones diff --git a/src/target/riscv32.c b/src/target/riscv32.c index b044a6c6e2c..5f2ce004ed4 100644 --- a/src/target/riscv32.c +++ b/src/target/riscv32.c @@ -35,7 +35,9 @@ #include "target.h" #include "target_internal.h" #include "target_probe.h" +#include "jep106.h" #include "riscv_debug.h" +#include "gdb_packet.h" typedef struct riscv32_regs { uint32_t gprs[32]; @@ -91,6 +93,17 @@ bool riscv32_probe(target_s *const target) target->breakwatch_set = riscv32_breakwatch_set; target->breakwatch_clear = riscv32_breakwatch_clear; + switch (target->designer_code) { + case JEP106_MANUFACTURER_RV_GIGADEVICE: + PROBE(gd32vf1_probe); + break; + } + +#if PC_HOSTED == 0 + gdb_outf("Please report unknown device with Designer 0x%x\n", target->designer_code); +#else + DEBUG_WARN("Please report unknown device with Designer 0x%x\n", target->designer_code); +#endif return false; }