diff options
Diffstat (limited to 'target-xtensa')
-rw-r--r-- | target-xtensa/cpu.h | 1 | ||||
-rwxr-xr-x | target-xtensa/import_core.sh | 53 | ||||
-rw-r--r-- | target-xtensa/overlay_tool.h | 32 |
3 files changed, 74 insertions, 12 deletions
diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h index 9cf52758c7..beb5486fc7 100644 --- a/target-xtensa/cpu.h +++ b/target-xtensa/cpu.h @@ -266,6 +266,7 @@ typedef enum { INTTYPE_TIMER, INTTYPE_DEBUG, INTTYPE_WRITE_ERR, + INTTYPE_PROFILING, INTTYPE_MAX } interrupt_type; diff --git a/target-xtensa/import_core.sh b/target-xtensa/import_core.sh new file mode 100755 index 0000000000..73791ec545 --- /dev/null +++ b/target-xtensa/import_core.sh @@ -0,0 +1,53 @@ +#! /bin/bash -e + +OVERLAY="$1" +NAME="$2" +FREQ=40000 +BASE=$(dirname "$0") +TARGET="$BASE"/core-$NAME + +[ $# -ge 2 -a -f "$OVERLAY" ] || { cat <<EOF +Usage: $0 overlay-archive-to-import core-name [frequency-in-KHz] + overlay-archive-to-import: file name of xtensa-config-overlay.tar.gz + to import configuration from. + core-name: QEMU name of the imported core. Must be valid + C identifier. + frequency-in-KHz: core frequency (40MHz if not specified). +EOF +exit +} + +[ $# -ge 3 ] && FREQ="$3" +mkdir -p "$TARGET" +tar -xf "$OVERLAY" -C "$TARGET" --strip-components=1 \ + --xform='s/core/core-isa/' config/core.h +tar -xf "$OVERLAY" -O gdb/xtensa-config.c | \ + sed -n '1,/*\//p;/pc/,/a15/p' > "$TARGET"/gdb-config.c +NUM_REGS=$(grep XTREG "$TARGET"/gdb-config.c | wc -l) + +cat <<EOF > "${TARGET}.c" +#include "cpu.h" +#include "exec/exec-all.h" +#include "exec/gdbstub.h" +#include "qemu/host-utils.h" + +#include "core-$NAME/core-isa.h" +#include "overlay_tool.h" + +static const XtensaConfig $NAME __attribute__((unused)) = { + .name = "$NAME", + .gdb_regmap = { + .num_regs = $NUM_REGS, + .reg = { +#include "core-$NAME/gdb-config.c" + } + }, + .clock_freq_khz = $FREQ, + DEFAULT_SECTIONS +}; + +REGISTER_CORE($NAME) +EOF + +grep -q core-${NAME}.o "$BASE"/Makefile.objs || \ + echo "obj-y += core-${NAME}.o" >> "$BASE"/Makefile.objs diff --git a/target-xtensa/overlay_tool.h b/target-xtensa/overlay_tool.h index 4c0de7f06a..6105d4c8ff 100644 --- a/target-xtensa/overlay_tool.h +++ b/target-xtensa/overlay_tool.h @@ -108,20 +108,27 @@ #define XCHAL_WINDOW_UF12_VECOFS 0x00000140 #endif +#if XCHAL_HAVE_WINDOWED +#define WINDOW_VECTORS \ + [EXC_WINDOW_OVERFLOW4] = XCHAL_WINDOW_OF4_VECOFS + \ + XCHAL_WINDOW_VECTORS_VADDR, \ + [EXC_WINDOW_UNDERFLOW4] = XCHAL_WINDOW_UF4_VECOFS + \ + XCHAL_WINDOW_VECTORS_VADDR, \ + [EXC_WINDOW_OVERFLOW8] = XCHAL_WINDOW_OF8_VECOFS + \ + XCHAL_WINDOW_VECTORS_VADDR, \ + [EXC_WINDOW_UNDERFLOW8] = XCHAL_WINDOW_UF8_VECOFS + \ + XCHAL_WINDOW_VECTORS_VADDR, \ + [EXC_WINDOW_OVERFLOW12] = XCHAL_WINDOW_OF12_VECOFS + \ + XCHAL_WINDOW_VECTORS_VADDR, \ + [EXC_WINDOW_UNDERFLOW12] = XCHAL_WINDOW_UF12_VECOFS + \ + XCHAL_WINDOW_VECTORS_VADDR, +#else +#define WINDOW_VECTORS +#endif + #define EXCEPTION_VECTORS { \ [EXC_RESET] = XCHAL_RESET_VECTOR_VADDR, \ - [EXC_WINDOW_OVERFLOW4] = XCHAL_WINDOW_OF4_VECOFS + \ - XCHAL_WINDOW_VECTORS_VADDR, \ - [EXC_WINDOW_UNDERFLOW4] = XCHAL_WINDOW_UF4_VECOFS + \ - XCHAL_WINDOW_VECTORS_VADDR, \ - [EXC_WINDOW_OVERFLOW8] = XCHAL_WINDOW_OF8_VECOFS + \ - XCHAL_WINDOW_VECTORS_VADDR, \ - [EXC_WINDOW_UNDERFLOW8] = XCHAL_WINDOW_UF8_VECOFS + \ - XCHAL_WINDOW_VECTORS_VADDR, \ - [EXC_WINDOW_OVERFLOW12] = XCHAL_WINDOW_OF12_VECOFS + \ - XCHAL_WINDOW_VECTORS_VADDR, \ - [EXC_WINDOW_UNDERFLOW12] = XCHAL_WINDOW_UF12_VECOFS + \ - XCHAL_WINDOW_VECTORS_VADDR, \ + WINDOW_VECTORS \ [EXC_KERNEL] = XCHAL_KERNEL_VECTOR_VADDR, \ [EXC_USER] = XCHAL_USER_VECTOR_VADDR, \ [EXC_DOUBLE] = XCHAL_DOUBLEEXC_VECTOR_VADDR, \ @@ -163,6 +170,7 @@ #define XTHAL_INTTYPE_TBD1 INTTYPE_DEBUG #define XTHAL_INTTYPE_TBD2 INTTYPE_WRITE_ERR #define XTHAL_INTTYPE_WRITE_ERROR INTTYPE_WRITE_ERR +#define XTHAL_INTTYPE_PROFILING INTTYPE_PROFILING #define INTERRUPT(i) { \ |