diff --git a/src/command.c b/src/command.c index 03903096..85b77a0b 100644 --- a/src/command.c +++ b/src/command.c @@ -225,7 +225,8 @@ bool cmd_swdp_scan(void) static void display_target(int i, target *t, void *context) { (void)context; - gdb_outf("%2d %c %s\n", i, target_attached(t)?'*':' ', target_driver_name(t)); + gdb_outf("%2d %c %s %s\n", i, target_attached(t)?'*':' ', + target_driver_name(t), target_core_name(t)); } bool cmd_targets(void) diff --git a/src/include/target.h b/src/include/target.h index 20c8ded7..ee3e5fb3 100644 --- a/src/include/target.h +++ b/src/include/target.h @@ -46,6 +46,7 @@ target *target_attach_n(int n, struct target_controller *); void target_detach(target *t); bool target_attached(target *t); const char *target_driver_name(target *t); +const char *target_core_name(target *t); /* Memory access functions */ bool target_mem_map(target *t, char *buf, size_t len); diff --git a/src/target/cortexm.c b/src/target/cortexm.c index 1c52777e..7def372f 100644 --- a/src/target/cortexm.c +++ b/src/target/cortexm.c @@ -5,7 +5,8 @@ * Written by Gareth McMullin * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under tSchreibe Objekte: 100% (21/21), 3.20 KiB | 3.20 MiB/s, Fertig. +he terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * @@ -269,6 +270,7 @@ bool cortexm_probe(ADIv5_AP_t *ap, bool forced) } adiv5_ap_ref(ap); + uint32_t identity = ap->idr & 0xff; struct cortexm_priv *priv = calloc(1, sizeof(*priv)); if (!priv) { /* calloc failed: heap exhaustion */ DEBUG("calloc: failed in %s\n", __func__); @@ -284,6 +286,20 @@ bool cortexm_probe(ADIv5_AP_t *ap, bool forced) t->mem_write = cortexm_mem_write; t->driver = cortexm_driver_str; + switch (identity) { + case 0x11: /* M3/M4 */ + t->core = "M3/M4"; + break; + case 0x21: /* M0 */ + t->core = "M0"; + break; + case 0x31: /* M0+ */ + t->core = "M0+"; + break; + case 0x01: /* M7 */ + t->core = "M7"; + break; + } t->attach = cortexm_attach; t->detach = cortexm_detach; diff --git a/src/target/target.c b/src/target/target.c index ed5f36ce..48dc7488 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -425,6 +425,11 @@ const char *target_driver_name(target *t) return t->driver; } +const char *target_core_name(target *t) +{ + return t->core; +} + uint32_t target_mem_read32(target *t, uint32_t addr) { uint32_t ret; diff --git a/src/target/target_internal.h b/src/target/target_internal.h index 6c18d070..5f4e41e7 100644 --- a/src/target/target_internal.h +++ b/src/target/target_internal.h @@ -115,6 +115,7 @@ struct target_s { /* Other stuff */ const char *driver; + const char *core; struct target_command_s *commands; struct target_s *next;