sim: simplify hardware m4 macro

Every port using this sets the 1st arg to yes and the 2nd arg to "".
These are the defaults we probably want anyways in order to unify the
codebase, so move them to the macro and only allow ports to declare
extra hardware models.
This commit is contained in:
Mike Frysinger 2021-04-23 21:58:21 -04:00
parent b2d14d3d8f
commit 9d90335212
30 changed files with 78 additions and 89 deletions

View File

@ -1,3 +1,9 @@
2021-04-23 Mike Frysinger <vapier@gentoo.org>
* README-HACKING (SIM_AC_OPTION_HARDWARE): Delete first two args.
* m4/sim_ac_option_hardware.m4 (SIM_AC_OPTION_HARDWARE): Replace [$1]
with yes. Delete test [$2]. Change [$3] to [$1]. Update comments.
2021-04-22 Tom Tromey <tom@tromey.com>
* m4/sim_ac_common.m4 (SIM_AC_COMMON): Don't check for sys/time.h

View File

@ -396,7 +396,7 @@ Hardware Devices
The simplest simulator doesn't include hardware device support. Once you're
ready to move on to the next level, call the common macro in your configure.ac:
SIM_AC_OPTION_HARDWARE(yes,,devone devtwo devthree)
SIM_AC_OPTION_HARDWARE(devone devtwo devthree)
The basic hardware API is documented in common/hw-device.h.

View File

@ -1,3 +1,8 @@
2021-04-23 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
* configure: Regenerate.
2021-04-22 Tom Tromey <tom@tromey.com>
* configure, config.in: Rebuild.

8
sim/bfin/configure vendored
View File

@ -12081,12 +12081,7 @@ $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
fi
if test ""; then
hardware=""
else
hardware="cfi core pal glue"
fi
hardware="$hardware \
hardware="cfi core pal glue \
bfin_cec \
bfin_ctimer \
bfin_dma \
@ -12119,7 +12114,6 @@ hardware="$hardware \
bfin_wp \
eth_phy \
"
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"

View File

@ -8,7 +8,7 @@ SIM_AC_OPTION_ENDIAN(LITTLE)
SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
SIM_AC_OPTION_DEFAULT_MODEL(bf537)
SIM_AC_OPTION_WARNINGS
SIM_AC_OPTION_HARDWARE(yes,,\
SIM_AC_OPTION_HARDWARE(\
bfin_cec \
bfin_ctimer \
bfin_dma \

View File

@ -1,3 +1,8 @@
2021-04-23 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
* configure: Regenerate.
2021-04-22 Tom Tromey <tom@tromey.com>
* rvdummy.c: Update includes.

8
sim/cris/configure vendored
View File

@ -12071,13 +12071,7 @@ $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
fi
if test ""; then
hardware=""
else
hardware="cfi core pal glue"
fi
hardware="$hardware rv cris cris_900000xx"
hardware="cfi core pal glue rv cris cris_900000xx"
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"

View File

@ -15,7 +15,7 @@ SIM_AC_OPTION_ENDIAN(LITTLE)
SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
SIM_AC_OPTION_SCACHE(16384)
SIM_AC_OPTION_WARNINGS(no)
SIM_AC_OPTION_HARDWARE(yes,,rv cris cris_900000xx)
SIM_AC_OPTION_HARDWARE(rv cris cris_900000xx)
# The default model shouldn't matter as long as there's a BFD.
SIM_AC_OPTION_DEFAULT_MODEL(crisv32)

View File

@ -1,3 +1,8 @@
2021-04-23 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HARDWARE): Delete arguments.
* configure: Regenerate.
2021-04-22 Tom Tromey <tom@tromey.com>
* configure, config.in: Rebuild.

8
sim/frv/configure vendored
View File

@ -12130,13 +12130,7 @@ fi
if test """"; then
hardware=""""
else
hardware="cfi core pal glue"
fi
hardware="$hardware """
hardware="cfi core pal glue "
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"

View File

@ -27,6 +27,6 @@ if test x"$silent" != x"yes" && test x"$sim_trapdump" != x""; then
fi],[sim_trapdump=""])dnl
AC_SUBST(sim_trapdump)
SIM_AC_OPTION_HARDWARE(yes,"","")
SIM_AC_OPTION_HARDWARE
SIM_AC_OUTPUT

View File

@ -1,3 +1,8 @@
2021-04-23 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HARDWARE): Delete arguments.
* configure: Regenerate.
2021-04-22 Tom Tromey <tom@tromey.com>
* configure, config.in: Rebuild.

View File

@ -12109,13 +12109,7 @@ fi
if test """"; then
hardware=""""
else
hardware="cfi core pal glue"
fi
hardware="$hardware """
hardware="cfi core pal glue "
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"

View File

@ -11,6 +11,6 @@ SIM_AC_OPTION_DEFAULT_MODEL(iq2000)
SIM_AC_OPTION_WARNINGS(no)
SIM_AC_OPTION_CGEN_MAINT
SIM_AC_OPTION_HARDWARE(yes,"","")
SIM_AC_OPTION_HARDWARE
SIM_AC_OUTPUT

View File

@ -1,3 +1,8 @@
2021-04-23 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
* configure: Regenerate.
2021-04-22 Tom Tromey <tom@tromey.com>
* configure, config.in: Rebuild.

8
sim/lm32/configure vendored
View File

@ -12108,13 +12108,7 @@ fi
if test ""; then
hardware=""
else
hardware="cfi core pal glue"
fi
hardware="$hardware lm32cpu lm32timer lm32uart"
hardware="cfi core pal glue lm32cpu lm32timer lm32uart"
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"

View File

@ -10,6 +10,6 @@ SIM_AC_OPTION_SCACHE(16384)
SIM_AC_OPTION_DEFAULT_MODEL(lm32)
SIM_AC_OPTION_WARNINGS(no)
SIM_AC_OPTION_CGEN_MAINT
SIM_AC_OPTION_HARDWARE(yes,,lm32cpu lm32timer lm32uart)
SIM_AC_OPTION_HARDWARE(lm32cpu lm32timer lm32uart)
SIM_AC_OUTPUT

View File

@ -1,3 +1,8 @@
2021-04-23 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
* configure: Regenerate.
2021-04-22 Tom Tromey <tom@tromey.com>
* configure, config.in: Rebuild.

8
sim/m32r/configure vendored
View File

@ -12124,13 +12124,7 @@ fi
if test ""; then
hardware=""
else
hardware="cfi core pal glue"
fi
hardware="$hardware m32r_cache m32r_uart"
hardware="cfi core pal glue m32r_cache m32r_uart"
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"

View File

@ -24,6 +24,6 @@ SIM_AC_OPTION_CGEN_MAINT
AC_SUBST(traps_obj)
AC_SUBST(sim_extra_cflags)
SIM_AC_OPTION_HARDWARE(yes,,m32r_cache m32r_uart)
SIM_AC_OPTION_HARDWARE(m32r_cache m32r_uart)
SIM_AC_OUTPUT

View File

@ -14,18 +14,10 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl
dnl --enable-sim-hardware is for users of the simulator
dnl arg[1] Enable sim-hw by default? ("yes" or "no")
dnl arg[2] is a space separated list of devices that override the defaults
dnl arg[3] is a space separated list of extra target specific devices.
dnl arg[1] is a space separated list of extra target specific devices.
AC_DEFUN([SIM_AC_OPTION_HARDWARE],
[
if test "[$2]"; then
hardware="[$2]"
else
hardware="cfi core pal glue"
fi
hardware="$hardware [$3]"
hardware="cfi core pal glue [$1]"
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
@ -33,7 +25,7 @@ sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/
AC_ARG_ENABLE(sim-hardware,
[AS_HELP_STRING([--enable-sim-hardware=LIST],
[Specify the hardware to be included in the build.])],
,[enable_sim_hardware="[$1]"])
,[enable_sim_hardware="yes"])
case ${enable_sim_hardware} in
yes|no) ;;
,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;

View File

@ -1,3 +1,8 @@
2021-04-23 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
* configure: Regenerate.
2021-04-22 Tom Tromey <tom@tromey.com>
* configure, config.in: Rebuild.

View File

@ -12029,13 +12029,8 @@ $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
fi
if test ""; then
hardware=""
else
hardware="cfi core pal glue"
fi
hardware="$hardware m68hc11 m68hc11sio m68hc11eepr m68hc11tim m68hc11spi nvram"
hardware="cfi core pal glue \
m68hc11 m68hc11sio m68hc11eepr m68hc11tim m68hc11spi nvram"
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"

View File

@ -8,7 +8,7 @@ dnl Options available in this module
SIM_AC_OPTION_ENDIAN(BIG)
SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
SIM_AC_OPTION_WARNINGS(no)
SIM_AC_OPTION_HARDWARE(yes,,
SIM_AC_OPTION_HARDWARE(\
m68hc11 m68hc11sio m68hc11eepr m68hc11tim m68hc11spi nvram)
SIM_AC_OUTPUT

View File

@ -1,3 +1,9 @@
2021-04-23 Mike Frysinger <vapier@gentoo.org>
* configure.ac (hw_enabled): Delete.
(SIM_AC_OPTION_HARDWARE): Delete first two args.
* configure: Regenerate.
2021-04-22 Tom Tromey <tom@tromey.com>
* configure, config.in: Rebuild.

13
sim/mips/configure vendored
View File

@ -12575,23 +12575,16 @@ sim_micromips_flags=" -F ${sim_micromips_filter} ${sim_micromips_machine} ${si
#
# Add simulated hardware devices
#
hw_enabled=no
hw_extra_devices=""
case "${target}" in
mips*tx39*)
hw_enabled=yes
hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
;;
*)
;;
esac
if test "$hw_devices"; then
hardware="$hw_devices"
else
hardware="cfi core pal glue"
fi
hardware="$hardware $hw_extra_devices"
hardware="cfi core pal glue $hw_extra_devices"
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
@ -12600,7 +12593,7 @@ sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\
if test "${enable_sim_hardware+set}" = set; then :
enableval=$enable_sim_hardware;
else
enable_sim_hardware="$hw_enabled"
enable_sim_hardware="yes"
fi
case ${enable_sim_hardware} in

View File

@ -426,16 +426,15 @@ AC_SUBST(sim_multi_obj)
#
# Add simulated hardware devices
#
hw_enabled=no
hw_extra_devices=""
case "${target}" in
mips*tx39*)
hw_enabled=yes
hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
;;
*)
;;
esac
SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
SIM_AC_OPTION_HARDWARE($hw_extra_devices)
# Choose simulator engine

View File

@ -1,3 +1,8 @@
2021-04-23 Mike Frysinger <vapier@gentoo.org>
* configure.ac (SIM_AC_OPTION_HARDWARE): Delete first two args.
* configure: Regenerate.
2021-04-22 Tom Tromey <tom@tromey.com>
* configure, config.in: Rebuild.

View File

@ -12110,13 +12110,7 @@ fi
fi
if test ""; then
hardware=""
else
hardware="cfi core pal glue"
fi
hardware="$hardware mn103cpu mn103int mn103tim mn103ser mn103iop"
hardware="cfi core pal glue mn103cpu mn103int mn103tim mn103ser mn103iop"
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"

View File

@ -9,6 +9,6 @@ SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
SIM_AC_OPTION_WARNINGS(no)
SIM_AC_OPTION_RESERVED_BITS
SIM_AC_OPTION_BITSIZE(32,31)
SIM_AC_OPTION_HARDWARE(yes,,mn103cpu mn103int mn103tim mn103ser mn103iop)
SIM_AC_OPTION_HARDWARE(mn103cpu mn103int mn103tim mn103ser mn103iop)
SIM_AC_OUTPUT