From 664c7105e5467d774eef21473ea7567eb0f8ad4e Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Fri, 29 Nov 2024 04:22:06 -0800 Subject: [PATCH 1/3] overlays/xtensa/mtk: Fixup and normalize file paths The new directory structure in the upstream Cadence tarballs wasn't as compatible as I thought. Binutils will produce a working assembler, but only if it does NOT see the new xtensa-config.h (which was added in a path it doesn't look at). Also gcc ends up hitting the in-tree/non-overlayed xtensa-config.h and produces a big endian compiler! Don't be fancy. Move stuff around to match the older overlays exactly. Also add the "defs.h" inclusion as generated by make-overlay.sh, and rename the copy of xtensa-xtregs.c in gdbserver to .cc as required by current binutils and done by other sdk-ng overlays. And I'd forgotten the copy of core-isa.h for newlib (which SOF doesn't use, but should still be present in the SDK). Signed-off-by: Andy Ross squashme defs.h --- .../binutils/{ => bfd}/xtensa-modules.c | 0 .../binutils/{ => include}/xtensa-config.h | 0 .../gcc/{ => include}/xtensa-config.h | 0 .../gdb/{ => bfd}/xtensa-modules.c | 0 .../gdb/{ => gdb/gdbserver}/xtensa-regmap.c | 0 .../gdbserver/xtensa-xtregs.cc} | 0 .../gdb/{ => gdb/regformats}/reg-xtensa.dat | 0 .../gdb/{ => gdb}/xtensa-config.c | 1 + .../gdb}/gdb/xtensa-xtregs.c | 0 .../gdb/{ => include}/xtensa-config.h | 0 .../xtensa/include}/xtensa/config/core-isa.h | 0 .../{xtensa-xtregs.c => xtensa-xtregs.cc} | 0 .../binutils/{ => bfd}/xtensa-modules.c | 0 .../binutils/{ => include}/xtensa-config.h | 0 .../gcc/{ => include}/xtensa-config.h | 0 .../gdb/{ => bfd}/xtensa-modules.c | 0 .../gdb/{ => gdb/gdbserver}/xtensa-regmap.c | 0 .../gdb/gdb/gdbserver/xtensa-xtregs.cc | 95 +++++++++++++++++++ .../gdb/{ => gdb/regformats}/reg-xtensa.dat | 0 .../gdb/{ => gdb}/xtensa-config.c | 1 + .../gdb/gdb/xtensa-xtregs.c | 95 +++++++++++++++++++ .../gdb/{ => include}/xtensa-config.h | 0 .../xtensa/include}/xtensa/config/core-isa.h | 0 23 files changed, 192 insertions(+) rename overlays/xtensa_mtk_mt818x_adsp/binutils/{ => bfd}/xtensa-modules.c (100%) rename overlays/xtensa_mtk_mt818x_adsp/binutils/{ => include}/xtensa-config.h (100%) rename overlays/xtensa_mtk_mt818x_adsp/gcc/{ => include}/xtensa-config.h (100%) rename overlays/xtensa_mtk_mt818x_adsp/gdb/{ => bfd}/xtensa-modules.c (100%) rename overlays/xtensa_mtk_mt818x_adsp/gdb/{ => gdb/gdbserver}/xtensa-regmap.c (100%) rename overlays/xtensa_mtk_mt818x_adsp/gdb/{xtensa-xtregs.c => gdb/gdbserver/xtensa-xtregs.cc} (100%) rename overlays/xtensa_mtk_mt818x_adsp/gdb/{ => gdb/regformats}/reg-xtensa.dat (100%) rename overlays/xtensa_mtk_mt818x_adsp/gdb/{ => gdb}/xtensa-config.c (99%) rename overlays/{xtensa_mtk_mt8196_adsp => xtensa_mtk_mt818x_adsp/gdb}/gdb/xtensa-xtregs.c (100%) rename overlays/xtensa_mtk_mt818x_adsp/gdb/{ => include}/xtensa-config.h (100%) rename overlays/xtensa_mtk_mt818x_adsp/{ => newlib/newlib/libc/sys/xtensa/include}/xtensa/config/core-isa.h (100%) rename overlays/xtensa_mtk_mt8195_adsp/gdb/gdb/gdbserver/{xtensa-xtregs.c => xtensa-xtregs.cc} (100%) rename overlays/xtensa_mtk_mt8196_adsp/binutils/{ => bfd}/xtensa-modules.c (100%) rename overlays/xtensa_mtk_mt8196_adsp/binutils/{ => include}/xtensa-config.h (100%) rename overlays/xtensa_mtk_mt8196_adsp/gcc/{ => include}/xtensa-config.h (100%) rename overlays/xtensa_mtk_mt8196_adsp/gdb/{ => bfd}/xtensa-modules.c (100%) rename overlays/xtensa_mtk_mt8196_adsp/gdb/{ => gdb/gdbserver}/xtensa-regmap.c (100%) create mode 100644 overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/gdbserver/xtensa-xtregs.cc rename overlays/xtensa_mtk_mt8196_adsp/gdb/{ => gdb/regformats}/reg-xtensa.dat (100%) rename overlays/xtensa_mtk_mt8196_adsp/gdb/{ => gdb}/xtensa-config.c (99%) create mode 100644 overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-xtregs.c rename overlays/xtensa_mtk_mt8196_adsp/gdb/{ => include}/xtensa-config.h (100%) rename overlays/xtensa_mtk_mt8196_adsp/{ => newlib/newlib/libc/sys/xtensa/include}/xtensa/config/core-isa.h (100%) diff --git a/overlays/xtensa_mtk_mt818x_adsp/binutils/xtensa-modules.c b/overlays/xtensa_mtk_mt818x_adsp/binutils/bfd/xtensa-modules.c similarity index 100% rename from overlays/xtensa_mtk_mt818x_adsp/binutils/xtensa-modules.c rename to overlays/xtensa_mtk_mt818x_adsp/binutils/bfd/xtensa-modules.c diff --git a/overlays/xtensa_mtk_mt818x_adsp/binutils/xtensa-config.h b/overlays/xtensa_mtk_mt818x_adsp/binutils/include/xtensa-config.h similarity index 100% rename from overlays/xtensa_mtk_mt818x_adsp/binutils/xtensa-config.h rename to overlays/xtensa_mtk_mt818x_adsp/binutils/include/xtensa-config.h diff --git a/overlays/xtensa_mtk_mt818x_adsp/gcc/xtensa-config.h b/overlays/xtensa_mtk_mt818x_adsp/gcc/include/xtensa-config.h similarity index 100% rename from overlays/xtensa_mtk_mt818x_adsp/gcc/xtensa-config.h rename to overlays/xtensa_mtk_mt818x_adsp/gcc/include/xtensa-config.h diff --git a/overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-modules.c b/overlays/xtensa_mtk_mt818x_adsp/gdb/bfd/xtensa-modules.c similarity index 100% rename from overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-modules.c rename to overlays/xtensa_mtk_mt818x_adsp/gdb/bfd/xtensa-modules.c diff --git a/overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-regmap.c b/overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/gdbserver/xtensa-regmap.c similarity index 100% rename from overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-regmap.c rename to overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/gdbserver/xtensa-regmap.c diff --git a/overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-xtregs.c b/overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/gdbserver/xtensa-xtregs.cc similarity index 100% rename from overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-xtregs.c rename to overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/gdbserver/xtensa-xtregs.cc diff --git a/overlays/xtensa_mtk_mt818x_adsp/gdb/reg-xtensa.dat b/overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/regformats/reg-xtensa.dat similarity index 100% rename from overlays/xtensa_mtk_mt818x_adsp/gdb/reg-xtensa.dat rename to overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/regformats/reg-xtensa.dat diff --git a/overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-config.c b/overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/xtensa-config.c similarity index 99% rename from overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-config.c rename to overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/xtensa-config.c index c8a4aca3..beaf6464 100644 --- a/overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-config.c +++ b/overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/xtensa-config.c @@ -23,6 +23,7 @@ #define XTENSA_CONFIG_VERSION 0x70 +#include "defs.h" #include "xtensa-config.h" #include "xtensa-tdep.h" diff --git a/overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-xtregs.c b/overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/xtensa-xtregs.c similarity index 100% rename from overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-xtregs.c rename to overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/xtensa-xtregs.c diff --git a/overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-config.h b/overlays/xtensa_mtk_mt818x_adsp/gdb/include/xtensa-config.h similarity index 100% rename from overlays/xtensa_mtk_mt818x_adsp/gdb/xtensa-config.h rename to overlays/xtensa_mtk_mt818x_adsp/gdb/include/xtensa-config.h diff --git a/overlays/xtensa_mtk_mt818x_adsp/xtensa/config/core-isa.h b/overlays/xtensa_mtk_mt818x_adsp/newlib/newlib/libc/sys/xtensa/include/xtensa/config/core-isa.h similarity index 100% rename from overlays/xtensa_mtk_mt818x_adsp/xtensa/config/core-isa.h rename to overlays/xtensa_mtk_mt818x_adsp/newlib/newlib/libc/sys/xtensa/include/xtensa/config/core-isa.h diff --git a/overlays/xtensa_mtk_mt8195_adsp/gdb/gdb/gdbserver/xtensa-xtregs.c b/overlays/xtensa_mtk_mt8195_adsp/gdb/gdb/gdbserver/xtensa-xtregs.cc similarity index 100% rename from overlays/xtensa_mtk_mt8195_adsp/gdb/gdb/gdbserver/xtensa-xtregs.c rename to overlays/xtensa_mtk_mt8195_adsp/gdb/gdb/gdbserver/xtensa-xtregs.cc diff --git a/overlays/xtensa_mtk_mt8196_adsp/binutils/xtensa-modules.c b/overlays/xtensa_mtk_mt8196_adsp/binutils/bfd/xtensa-modules.c similarity index 100% rename from overlays/xtensa_mtk_mt8196_adsp/binutils/xtensa-modules.c rename to overlays/xtensa_mtk_mt8196_adsp/binutils/bfd/xtensa-modules.c diff --git a/overlays/xtensa_mtk_mt8196_adsp/binutils/xtensa-config.h b/overlays/xtensa_mtk_mt8196_adsp/binutils/include/xtensa-config.h similarity index 100% rename from overlays/xtensa_mtk_mt8196_adsp/binutils/xtensa-config.h rename to overlays/xtensa_mtk_mt8196_adsp/binutils/include/xtensa-config.h diff --git a/overlays/xtensa_mtk_mt8196_adsp/gcc/xtensa-config.h b/overlays/xtensa_mtk_mt8196_adsp/gcc/include/xtensa-config.h similarity index 100% rename from overlays/xtensa_mtk_mt8196_adsp/gcc/xtensa-config.h rename to overlays/xtensa_mtk_mt8196_adsp/gcc/include/xtensa-config.h diff --git a/overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-modules.c b/overlays/xtensa_mtk_mt8196_adsp/gdb/bfd/xtensa-modules.c similarity index 100% rename from overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-modules.c rename to overlays/xtensa_mtk_mt8196_adsp/gdb/bfd/xtensa-modules.c diff --git a/overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-regmap.c b/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/gdbserver/xtensa-regmap.c similarity index 100% rename from overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-regmap.c rename to overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/gdbserver/xtensa-regmap.c diff --git a/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/gdbserver/xtensa-xtregs.cc b/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/gdbserver/xtensa-xtregs.cc new file mode 100644 index 00000000..a1086beb --- /dev/null +++ b/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/gdbserver/xtensa-xtregs.cc @@ -0,0 +1,95 @@ +/* Customized table mapping between kernel xtregset and GDB register cache. + + Copyright (c) 2007-2010 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + +typedef struct { + int gdb_regnum; + int gdb_offset; + int ptrace_cp_offset; + int ptrace_offset; + int size; + int coproc; + int dbnum; + char* name +;} xtensa_regtable_t; + +#define XTENSA_ELF_XTREG_SIZE 404 + +const xtensa_regtable_t xtensa_regmap_table[] = { + /* gnum,gofs,cpofs,ofs,siz,cp, dbnum, name */ + { 76, 304, 0, 0, 4, -1, 0x0204, "br" }, + { 78, 312, 16, 32, 4, 1, 0x03f0, "ae_ovf_sar" }, + { 79, 316, 20, 36, 4, 1, 0x03f1, "ae_bithead" }, + { 80, 320, 24, 40, 4, 1, 0x03f2, "ae_ts_fts_bu_bp" }, + { 81, 324, 28, 44, 4, 1, 0x03f3, "ae_cw_sd_no" }, + { 82, 328, 32, 48, 4, 1, 0x03f6, "ae_cbegin0" }, + { 83, 332, 36, 52, 4, 1, 0x03f7, "ae_cend0" }, + { 84, 336, 40, 56, 4, 1, 0x03f8, "ae_cbegin1" }, + { 85, 340, 44, 60, 4, 1, 0x03f9, "ae_cend1" }, + { 86, 344, 48, 64, 4, 1, 0x03fa, "ae_cbegin2" }, + { 87, 348, 52, 68, 4, 1, 0x03fb, "ae_cend2" }, + { 88, 352, 128, 144, 8, 1, 0x1000, "aed0" }, + { 89, 360, 136, 152, 8, 1, 0x1001, "aed1" }, + { 90, 368, 144, 160, 8, 1, 0x1002, "aed2" }, + { 91, 376, 152, 168, 8, 1, 0x1003, "aed3" }, + { 92, 384, 160, 176, 8, 1, 0x1004, "aed4" }, + { 93, 392, 168, 184, 8, 1, 0x1005, "aed5" }, + { 94, 400, 176, 192, 8, 1, 0x1006, "aed6" }, + { 95, 408, 184, 200, 8, 1, 0x1007, "aed7" }, + { 96, 416, 192, 208, 8, 1, 0x1008, "aed8" }, + { 97, 424, 200, 216, 8, 1, 0x1009, "aed9" }, + { 98, 432, 208, 224, 8, 1, 0x100a, "aed10" }, + { 99, 440, 216, 232, 8, 1, 0x100b, "aed11" }, + { 100, 448, 224, 240, 8, 1, 0x100c, "aed12" }, + { 101, 456, 232, 248, 8, 1, 0x100d, "aed13" }, + { 102, 464, 240, 256, 8, 1, 0x100e, "aed14" }, + { 103, 472, 248, 264, 8, 1, 0x100f, "aed15" }, + { 104, 480, 256, 272, 8, 1, 0x1010, "aed16" }, + { 105, 488, 264, 280, 8, 1, 0x1011, "aed17" }, + { 106, 496, 272, 288, 8, 1, 0x1012, "aed18" }, + { 107, 504, 280, 296, 8, 1, 0x1013, "aed19" }, + { 108, 512, 288, 304, 8, 1, 0x1014, "aed20" }, + { 109, 520, 296, 312, 8, 1, 0x1015, "aed21" }, + { 110, 528, 304, 320, 8, 1, 0x1016, "aed22" }, + { 111, 536, 312, 328, 8, 1, 0x1017, "aed23" }, + { 112, 544, 320, 336, 8, 1, 0x1018, "aed24" }, + { 113, 552, 328, 344, 8, 1, 0x1019, "aed25" }, + { 114, 560, 336, 352, 8, 1, 0x101a, "aed26" }, + { 115, 568, 344, 360, 8, 1, 0x101b, "aed27" }, + { 116, 576, 352, 368, 8, 1, 0x101c, "aed28" }, + { 117, 584, 360, 376, 8, 1, 0x101d, "aed29" }, + { 118, 592, 368, 384, 8, 1, 0x101e, "aed30" }, + { 119, 600, 376, 392, 8, 1, 0x101f, "aed31" }, + { 120, 608, 64, 80, 16, 1, 0x1020, "u0" }, + { 121, 624, 80, 96, 16, 1, 0x1021, "u1" }, + { 122, 640, 96, 112, 16, 1, 0x1022, "u2" }, + { 123, 656, 112, 128, 16, 1, 0x1023, "u3" }, + { 124, 672, 384, 400, 1, 1, 0x1024, "aep0" }, + { 125, 673, 385, 401, 1, 1, 0x1025, "aep1" }, + { 126, 674, 386, 402, 1, 1, 0x1026, "aep2" }, + { 127, 675, 387, 403, 1, 1, 0x1027, "aep3" }, + { 128, 676, 0, 16, 4, 1, 0x1029, "ae_zbiasv8c" }, + { 129, 680, 8, 24, 4, 1, 0x102a, "fcr_fsr" }, + { 0 } +}; + diff --git a/overlays/xtensa_mtk_mt8196_adsp/gdb/reg-xtensa.dat b/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/regformats/reg-xtensa.dat similarity index 100% rename from overlays/xtensa_mtk_mt8196_adsp/gdb/reg-xtensa.dat rename to overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/regformats/reg-xtensa.dat diff --git a/overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-config.c b/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-config.c similarity index 99% rename from overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-config.c rename to overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-config.c index e00fd002..464661f2 100644 --- a/overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-config.c +++ b/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-config.c @@ -23,6 +23,7 @@ #define XTENSA_CONFIG_VERSION 0x70 +#include "defs.h" #include "xtensa-config.h" #include "xtensa-tdep.h" diff --git a/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-xtregs.c b/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-xtregs.c new file mode 100644 index 00000000..a1086beb --- /dev/null +++ b/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-xtregs.c @@ -0,0 +1,95 @@ +/* Customized table mapping between kernel xtregset and GDB register cache. + + Copyright (c) 2007-2010 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + +typedef struct { + int gdb_regnum; + int gdb_offset; + int ptrace_cp_offset; + int ptrace_offset; + int size; + int coproc; + int dbnum; + char* name +;} xtensa_regtable_t; + +#define XTENSA_ELF_XTREG_SIZE 404 + +const xtensa_regtable_t xtensa_regmap_table[] = { + /* gnum,gofs,cpofs,ofs,siz,cp, dbnum, name */ + { 76, 304, 0, 0, 4, -1, 0x0204, "br" }, + { 78, 312, 16, 32, 4, 1, 0x03f0, "ae_ovf_sar" }, + { 79, 316, 20, 36, 4, 1, 0x03f1, "ae_bithead" }, + { 80, 320, 24, 40, 4, 1, 0x03f2, "ae_ts_fts_bu_bp" }, + { 81, 324, 28, 44, 4, 1, 0x03f3, "ae_cw_sd_no" }, + { 82, 328, 32, 48, 4, 1, 0x03f6, "ae_cbegin0" }, + { 83, 332, 36, 52, 4, 1, 0x03f7, "ae_cend0" }, + { 84, 336, 40, 56, 4, 1, 0x03f8, "ae_cbegin1" }, + { 85, 340, 44, 60, 4, 1, 0x03f9, "ae_cend1" }, + { 86, 344, 48, 64, 4, 1, 0x03fa, "ae_cbegin2" }, + { 87, 348, 52, 68, 4, 1, 0x03fb, "ae_cend2" }, + { 88, 352, 128, 144, 8, 1, 0x1000, "aed0" }, + { 89, 360, 136, 152, 8, 1, 0x1001, "aed1" }, + { 90, 368, 144, 160, 8, 1, 0x1002, "aed2" }, + { 91, 376, 152, 168, 8, 1, 0x1003, "aed3" }, + { 92, 384, 160, 176, 8, 1, 0x1004, "aed4" }, + { 93, 392, 168, 184, 8, 1, 0x1005, "aed5" }, + { 94, 400, 176, 192, 8, 1, 0x1006, "aed6" }, + { 95, 408, 184, 200, 8, 1, 0x1007, "aed7" }, + { 96, 416, 192, 208, 8, 1, 0x1008, "aed8" }, + { 97, 424, 200, 216, 8, 1, 0x1009, "aed9" }, + { 98, 432, 208, 224, 8, 1, 0x100a, "aed10" }, + { 99, 440, 216, 232, 8, 1, 0x100b, "aed11" }, + { 100, 448, 224, 240, 8, 1, 0x100c, "aed12" }, + { 101, 456, 232, 248, 8, 1, 0x100d, "aed13" }, + { 102, 464, 240, 256, 8, 1, 0x100e, "aed14" }, + { 103, 472, 248, 264, 8, 1, 0x100f, "aed15" }, + { 104, 480, 256, 272, 8, 1, 0x1010, "aed16" }, + { 105, 488, 264, 280, 8, 1, 0x1011, "aed17" }, + { 106, 496, 272, 288, 8, 1, 0x1012, "aed18" }, + { 107, 504, 280, 296, 8, 1, 0x1013, "aed19" }, + { 108, 512, 288, 304, 8, 1, 0x1014, "aed20" }, + { 109, 520, 296, 312, 8, 1, 0x1015, "aed21" }, + { 110, 528, 304, 320, 8, 1, 0x1016, "aed22" }, + { 111, 536, 312, 328, 8, 1, 0x1017, "aed23" }, + { 112, 544, 320, 336, 8, 1, 0x1018, "aed24" }, + { 113, 552, 328, 344, 8, 1, 0x1019, "aed25" }, + { 114, 560, 336, 352, 8, 1, 0x101a, "aed26" }, + { 115, 568, 344, 360, 8, 1, 0x101b, "aed27" }, + { 116, 576, 352, 368, 8, 1, 0x101c, "aed28" }, + { 117, 584, 360, 376, 8, 1, 0x101d, "aed29" }, + { 118, 592, 368, 384, 8, 1, 0x101e, "aed30" }, + { 119, 600, 376, 392, 8, 1, 0x101f, "aed31" }, + { 120, 608, 64, 80, 16, 1, 0x1020, "u0" }, + { 121, 624, 80, 96, 16, 1, 0x1021, "u1" }, + { 122, 640, 96, 112, 16, 1, 0x1022, "u2" }, + { 123, 656, 112, 128, 16, 1, 0x1023, "u3" }, + { 124, 672, 384, 400, 1, 1, 0x1024, "aep0" }, + { 125, 673, 385, 401, 1, 1, 0x1025, "aep1" }, + { 126, 674, 386, 402, 1, 1, 0x1026, "aep2" }, + { 127, 675, 387, 403, 1, 1, 0x1027, "aep3" }, + { 128, 676, 0, 16, 4, 1, 0x1029, "ae_zbiasv8c" }, + { 129, 680, 8, 24, 4, 1, 0x102a, "fcr_fsr" }, + { 0 } +}; + diff --git a/overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-config.h b/overlays/xtensa_mtk_mt8196_adsp/gdb/include/xtensa-config.h similarity index 100% rename from overlays/xtensa_mtk_mt8196_adsp/gdb/xtensa-config.h rename to overlays/xtensa_mtk_mt8196_adsp/gdb/include/xtensa-config.h diff --git a/overlays/xtensa_mtk_mt8196_adsp/xtensa/config/core-isa.h b/overlays/xtensa_mtk_mt8196_adsp/newlib/newlib/libc/sys/xtensa/include/xtensa/config/core-isa.h similarity index 100% rename from overlays/xtensa_mtk_mt8196_adsp/xtensa/config/core-isa.h rename to overlays/xtensa_mtk_mt8196_adsp/newlib/newlib/libc/sys/xtensa/include/xtensa/config/core-isa.h From f13ee751edb7212187b79ebcee772e9c74aabbf4 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Fri, 29 Nov 2024 04:38:00 -0800 Subject: [PATCH 2/3] overlays/mtk: Add back Cadence-removed macro There is no "predicted branches" extension in any version of the Xtensa ISA reference I have. Newer versions of Cadence tooling have removed (and presumably deprecated) this symbol, but binutils still relies on seeing it (even just to evaluate to a zero to diable the feature). Really the proper fix would be to patch binutils upstream, but let's have compatible headers here first. Signed-off-by: Andy Ross --- .../xtensa_mtk_mt818x_adsp/binutils/include/xtensa-config.h | 4 ++++ overlays/xtensa_mtk_mt818x_adsp/gcc/include/xtensa-config.h | 4 ++++ overlays/xtensa_mtk_mt818x_adsp/gdb/include/xtensa-config.h | 4 ++++ .../xtensa_mtk_mt8196_adsp/binutils/include/xtensa-config.h | 4 ++++ overlays/xtensa_mtk_mt8196_adsp/gcc/include/xtensa-config.h | 4 ++++ overlays/xtensa_mtk_mt8196_adsp/gdb/include/xtensa-config.h | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/overlays/xtensa_mtk_mt818x_adsp/binutils/include/xtensa-config.h b/overlays/xtensa_mtk_mt818x_adsp/binutils/include/xtensa-config.h index 84aeb9ea..06d58bc9 100644 --- a/overlays/xtensa_mtk_mt818x_adsp/binutils/include/xtensa-config.h +++ b/overlays/xtensa_mtk_mt818x_adsp/binutils/include/xtensa-config.h @@ -183,3 +183,7 @@ #endif /* !XTENSA_CONFIG_H */ + +#ifndef XCHAL_HAVE_PREDICTED_BRANCHES +#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* Needed by Zephyr SDK binutils */ +#endif diff --git a/overlays/xtensa_mtk_mt818x_adsp/gcc/include/xtensa-config.h b/overlays/xtensa_mtk_mt818x_adsp/gcc/include/xtensa-config.h index 84aeb9ea..06d58bc9 100644 --- a/overlays/xtensa_mtk_mt818x_adsp/gcc/include/xtensa-config.h +++ b/overlays/xtensa_mtk_mt818x_adsp/gcc/include/xtensa-config.h @@ -183,3 +183,7 @@ #endif /* !XTENSA_CONFIG_H */ + +#ifndef XCHAL_HAVE_PREDICTED_BRANCHES +#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* Needed by Zephyr SDK binutils */ +#endif diff --git a/overlays/xtensa_mtk_mt818x_adsp/gdb/include/xtensa-config.h b/overlays/xtensa_mtk_mt818x_adsp/gdb/include/xtensa-config.h index 84aeb9ea..06d58bc9 100644 --- a/overlays/xtensa_mtk_mt818x_adsp/gdb/include/xtensa-config.h +++ b/overlays/xtensa_mtk_mt818x_adsp/gdb/include/xtensa-config.h @@ -183,3 +183,7 @@ #endif /* !XTENSA_CONFIG_H */ + +#ifndef XCHAL_HAVE_PREDICTED_BRANCHES +#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* Needed by Zephyr SDK binutils */ +#endif diff --git a/overlays/xtensa_mtk_mt8196_adsp/binutils/include/xtensa-config.h b/overlays/xtensa_mtk_mt8196_adsp/binutils/include/xtensa-config.h index 036261de..aa287209 100644 --- a/overlays/xtensa_mtk_mt8196_adsp/binutils/include/xtensa-config.h +++ b/overlays/xtensa_mtk_mt8196_adsp/binutils/include/xtensa-config.h @@ -183,3 +183,7 @@ #endif /* !XTENSA_CONFIG_H */ + +#ifndef XCHAL_HAVE_PREDICTED_BRANCHES +#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* Needed by Zephyr SDK binutils */ +#endif diff --git a/overlays/xtensa_mtk_mt8196_adsp/gcc/include/xtensa-config.h b/overlays/xtensa_mtk_mt8196_adsp/gcc/include/xtensa-config.h index 036261de..aa287209 100644 --- a/overlays/xtensa_mtk_mt8196_adsp/gcc/include/xtensa-config.h +++ b/overlays/xtensa_mtk_mt8196_adsp/gcc/include/xtensa-config.h @@ -183,3 +183,7 @@ #endif /* !XTENSA_CONFIG_H */ + +#ifndef XCHAL_HAVE_PREDICTED_BRANCHES +#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* Needed by Zephyr SDK binutils */ +#endif diff --git a/overlays/xtensa_mtk_mt8196_adsp/gdb/include/xtensa-config.h b/overlays/xtensa_mtk_mt8196_adsp/gdb/include/xtensa-config.h index 036261de..aa287209 100644 --- a/overlays/xtensa_mtk_mt8196_adsp/gdb/include/xtensa-config.h +++ b/overlays/xtensa_mtk_mt8196_adsp/gdb/include/xtensa-config.h @@ -183,3 +183,7 @@ #endif /* !XTENSA_CONFIG_H */ + +#ifndef XCHAL_HAVE_PREDICTED_BRANCHES +#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* Needed by Zephyr SDK binutils */ +#endif From 9eb7be048c54b12c0340c200cbd0ceca996dc3c4 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Sun, 1 Dec 2024 13:44:45 -0800 Subject: [PATCH 3/3] overlays/mtk: Fix linker API The name of the rmap array changed in upstream bintuils commit 2b16913cdca2 ("gdb: make gdbarch_alloc take ownership of the tdep"). At the same time it seems like the xtensa_tdep definition (which contra the filename is actually a C++ object definition and not a function prototype!) moved into this file from elsewhere in binutils. The xtensa_rmap symbol is only used by newer binutils versions than the Zephyr SDK builds, but add an alias so it builds with upstream crosstools-ng, and commit it here as a reference if we want to port the other Xtensa overlays. Signed-off-by: Andy Ross --- overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/xtensa-config.c | 2 ++ overlays/xtensa_mtk_mt8195_adsp/gdb/gdb/xtensa-config.c | 4 +++- overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-config.c | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/xtensa-config.c b/overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/xtensa-config.c index beaf6464..b5d201da 100644 --- a/overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/xtensa-config.c +++ b/overlays/xtensa_mtk_mt818x_adsp/gdb/gdb/xtensa-config.c @@ -555,7 +555,9 @@ xtensa_register_t rmap[] = XTREG_END }; +extern xtensa_register_t xtensa_rmap[] __attribute__((alias("rmap"))); +xtensa_gdbarch_tdep xtensa_tdep (rmap); #ifdef XTENSA_CONFIG_INSTANTIATE XTENSA_CONFIG_INSTANTIATE(rmap,16) diff --git a/overlays/xtensa_mtk_mt8195_adsp/gdb/gdb/xtensa-config.c b/overlays/xtensa_mtk_mt8195_adsp/gdb/gdb/xtensa-config.c index 9d106c9f..7aaff74b 100644 --- a/overlays/xtensa_mtk_mt8195_adsp/gdb/gdb/xtensa-config.c +++ b/overlays/xtensa_mtk_mt8195_adsp/gdb/gdb/xtensa-config.c @@ -113,7 +113,7 @@ const xtensa_mask_t xtensa_mask39 = { 1, xtensa_submask39 }; /* Register map. */ -static xtensa_register_t rmap[] = +xtensa_register_t rmap[] = { /* idx ofs bi sz al targno flags cp typ group name */ XTREG( 0, 0,32, 4, 4,0x0020,0x0006,-2, 9,0x2100,pc, 0,0,0,0,0,0) @@ -496,4 +496,6 @@ static xtensa_register_t rmap[] = XTREG_END }; +extern xtensa_register_t xtensa_rmap[] __attribute__((alias("rmap"))); + xtensa_gdbarch_tdep xtensa_tdep (rmap); diff --git a/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-config.c b/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-config.c index 464661f2..e0bcf7a2 100644 --- a/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-config.c +++ b/overlays/xtensa_mtk_mt8196_adsp/gdb/gdb/xtensa-config.c @@ -555,7 +555,9 @@ xtensa_register_t rmap[] = XTREG_END }; +extern xtensa_register_t xtensa_rmap[] __attribute__((alias("rmap"))); +xtensa_gdbarch_tdep xtensa_tdep (rmap); #ifdef XTENSA_CONFIG_INSTANTIATE XTENSA_CONFIG_INSTANTIATE(rmap,16)