Skip to content

Commit

Permalink
riscv_debug: Populated target->cpuid and made use of it in gd32vf1_pr…
Browse files Browse the repository at this point in the history
…obe() for an even more positive part identification

Co-Authored-By: Rafael Silva <[email protected]>
  • Loading branch information
2 people authored and esden committed Oct 31, 2023
1 parent 8fd736a commit 903b005
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/target/riscv_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ static bool riscv_hart_init(riscv_hart_s *const hart)

/* If the hart implements mvendorid, this gives us the JEP-106, otherwise use the DTM designer code */
target->designer_code = hart->vendorid ? hart->vendorid : hart->dbg_module->dmi_bus->designer_code;
target->cpuid = hart->archid;

riscv_hart_discover_triggers(hart);

Expand Down
4 changes: 4 additions & 0 deletions src/target/stm32f1.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ bool gd32f1_probe(target_s *target)
/* Identify RISC-V GD32VF1 chips */
bool gd32vf1_probe(target_s *const target)
{
/* Make sure the architecture ID matches */
if (target->cpuid != 0x80000022U)
return false;
/* Then read out the device ID */
const uint16_t device_id = target_mem_read32(target, DBGMCU_IDCODE) & 0xfffU;
switch (device_id) {
case 0x410U: /* GD32VF103 */
Expand Down

0 comments on commit 903b005

Please sign in to comment.