target/espressif: check common_magic instead of gdb_arch string
The value returned by target_get_gdb_arch() is something specific for GDB. There could be several variants of the same CPU. If we start implementing all the variants, checking the string value, could become incorrect. It's better to check for xtensa->common_magic == XTENSA_COMMON_MAGIC Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I20f3fdced176c3b9ab00f889743161ecad7280f9 Reviewed-on: https://review.openocd.org/c/openocd/+/7536 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
ee31f1578a
commit
faeae51d7f
|
@ -17,12 +17,10 @@
|
|||
|
||||
static struct esp_semihost_data __attribute__((unused)) *target_to_esp_semihost_data(struct target *target)
|
||||
{
|
||||
const char *arch = target_get_gdb_arch(target);
|
||||
if (arch) {
|
||||
if (strncmp(arch, "xtensa", 6) == 0)
|
||||
return &target_to_esp_xtensa(target)->semihost;
|
||||
/* TODO: add riscv */
|
||||
}
|
||||
struct xtensa *xtensa = target->arch_info;
|
||||
if (xtensa->common_magic == XTENSA_COMMON_MAGIC)
|
||||
return &target_to_esp_xtensa(target)->semihost;
|
||||
/* TODO: add riscv */
|
||||
LOG_ERROR("Unknown target arch!");
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue