2014-06-14 10:26:22 +04:00
|
|
|
#! /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 | \
|
2015-07-01 13:00:29 +03:00
|
|
|
sed -n '1,/*\//p;/XTREG/,/XTREG_END/p' > "$TARGET"/gdb-config.c
|
2014-06-14 10:26:22 +04:00
|
|
|
|
|
|
|
cat <<EOF > "${TARGET}.c"
|
2017-02-10 06:13:42 +03:00
|
|
|
#include "qemu/osdep.h"
|
2014-06-14 10:26:22 +04:00
|
|
|
#include "cpu.h"
|
|
|
|
#include "exec/exec-all.h"
|
|
|
|
#include "exec/gdbstub.h"
|
2017-02-10 06:13:42 +03:00
|
|
|
#include "qemu-common.h"
|
2014-06-14 10:26:22 +04:00
|
|
|
#include "qemu/host-utils.h"
|
|
|
|
|
|
|
|
#include "core-$NAME/core-isa.h"
|
|
|
|
#include "overlay_tool.h"
|
|
|
|
|
2015-07-01 13:00:29 +03:00
|
|
|
static XtensaConfig $NAME __attribute__((unused)) = {
|
2014-06-14 10:26:22 +04:00
|
|
|
.name = "$NAME",
|
|
|
|
.gdb_regmap = {
|
|
|
|
.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
|