]> git.proxmox.com Git - mirror_qemu.git/blame - target-xtensa/import_core.sh
tcg: Move emit of INDEX_op_end into gen_tb_end
[mirror_qemu.git] / target-xtensa / import_core.sh
CommitLineData
9bea2e91
MF
1#! /bin/bash -e
2
3OVERLAY="$1"
4NAME="$2"
5FREQ=40000
6BASE=$(dirname "$0")
7TARGET="$BASE"/core-$NAME
8
9[ $# -ge 2 -a -f "$OVERLAY" ] || { cat <<EOF
10Usage: $0 overlay-archive-to-import core-name [frequency-in-KHz]
11 overlay-archive-to-import: file name of xtensa-config-overlay.tar.gz
12 to import configuration from.
13 core-name: QEMU name of the imported core. Must be valid
14 C identifier.
15 frequency-in-KHz: core frequency (40MHz if not specified).
16EOF
17exit
18}
19
20[ $# -ge 3 ] && FREQ="$3"
21mkdir -p "$TARGET"
22tar -xf "$OVERLAY" -C "$TARGET" --strip-components=1 \
23 --xform='s/core/core-isa/' config/core.h
24tar -xf "$OVERLAY" -O gdb/xtensa-config.c | \
25 sed -n '1,/*\//p;/pc/,/a15/p' > "$TARGET"/gdb-config.c
26NUM_REGS=$(grep XTREG "$TARGET"/gdb-config.c | wc -l)
27
28cat <<EOF > "${TARGET}.c"
29#include "cpu.h"
30#include "exec/exec-all.h"
31#include "exec/gdbstub.h"
32#include "qemu/host-utils.h"
33
34#include "core-$NAME/core-isa.h"
35#include "overlay_tool.h"
36
37static const XtensaConfig $NAME __attribute__((unused)) = {
38 .name = "$NAME",
39 .gdb_regmap = {
40 .num_regs = $NUM_REGS,
41 .reg = {
42#include "core-$NAME/gdb-config.c"
43 }
44 },
45 .clock_freq_khz = $FREQ,
46 DEFAULT_SECTIONS
47};
48
49REGISTER_CORE($NAME)
50EOF
51
52grep -q core-${NAME}.o "$BASE"/Makefile.objs || \
53 echo "obj-y += core-${NAME}.o" >> "$BASE"/Makefile.objs