| 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 |
| frequency-in-KHz: core frequency (40MHz if not specified). |
| [ $# -ge 3 ] && FREQ="$3" |
| 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 "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)) = { |
| #include "core-$NAME/gdb-config.c" |
| grep -q core-${NAME}.o "$BASE"/Makefile.objs || \ |
| echo "obj-y += core-${NAME}.o" >> "$BASE"/Makefile.objs |