This is an automated email from Gerrit.

"Erhan Kurubas <erhan.kuru...@espressif.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7536

-- gerrit

commit 5d9b9d2dde809ef7ed39c70dc7d59af8f5163cdd
Author: Erhan Kurubas <erhan.kuru...@espressif.com>
Date:   Wed Mar 15 01:22:10 2023 +0300

    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.kuru...@espressif.com>
    Change-Id: I20f3fdced176c3b9ab00f889743161ecad7280f9

diff --git a/src/target/espressif/esp_semihosting.c 
b/src/target/espressif/esp_semihosting.c
index 5e9cb94573..51d499866d 100644
--- a/src/target/espressif/esp_semihosting.c
+++ b/src/target/espressif/esp_semihosting.c
@@ -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;
 }

-- 

Reply via email to