From be0387eed099dbc2f2bdc92fbf60e04f846c3b2b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 19 Jun 2021 19:36:39 -0400 Subject: sim: hw: rework configure option & device selection The sim-hardware configure option allows builders to select a set of device models to enable. But this seems like unnecessary overkill: the existence of individual device models doesn't affect performance at all as they are only enabled at runtime if the config uses them, and individually these are all <5KB a piece. Stripping off a total of ~50KB from a ~1MB binary doesn't seem useful, and it's extremely unlikely anyone will ever bother. So let's simplify the configure/make logic by turning sim-hardware into a boolean option like many of the other sim options. Any ports that have unique device models will declare them in their Makefile instead of at configure time. This will allow us to (eventually) unify the setting into the common dir. --- sim/mn10300/ChangeLog | 6 +++++ sim/mn10300/Makefile.in | 2 ++ sim/mn10300/configure | 60 +++++++++++++++++++----------------------------- sim/mn10300/configure.ac | 1 - 4 files changed, 32 insertions(+), 37 deletions(-) (limited to 'sim/mn10300') diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog index 170d679..99d7a1c 100644 --- a/sim/mn10300/ChangeLog +++ b/sim/mn10300/ChangeLog @@ -1,3 +1,9 @@ +2021-06-21 Mike Frysinger + + * Makefile.in (SIM_EXTRA_HW_DEVICES): Define. + * configure.ac (SIM_AC_OPTION_HARDWARE): Delete call. + * configure: Regenerate. + 2021-06-20 Mike Frysinger * configure.ac (SIM_AC_COMMON): Delete. diff --git a/sim/mn10300/Makefile.in b/sim/mn10300/Makefile.in index ba48273..968378c 100644 --- a/sim/mn10300/Makefile.in +++ b/sim/mn10300/Makefile.in @@ -25,6 +25,8 @@ MN10300_OBJS = \ SIM_OBJS = $(MN10300_OBJS) interp.o +SIM_EXTRA_HW_DEVICES = mn103cpu mn103int mn103tim mn103ser mn103iop + SIM_EXTRA_CLEAN = clean-igen # Extra dependencies for "sim-main.h" SIM_EXTRA_DEPS = mn10300_sim.h itable.h idecode.h diff --git a/sim/mn10300/configure b/sim/mn10300/configure index 8efbbc0..126b69a 100755 --- a/sim/mn10300/configure +++ b/sim/mn10300/configure @@ -588,6 +588,10 @@ sim_default_model sim_scache sim_float cgen_breaks +sim_hw_sockser +sim_hw_cflags +SIM_ENABLE_HW_FALSE +SIM_ENABLE_HW_TRUE target_alias host_alias build_alias @@ -627,9 +631,6 @@ PACKAGE_NAME PATH_SEPARATOR SHELL sim_reserved_bits -sim_hw -sim_hw_objs -sim_hw_cflags sim_bitsize' ac_subst_files='' ac_user_opts=' @@ -1252,8 +1253,7 @@ Optional Features: Specify whether to check reserved bits in instruction --enable-sim-bitsize=N Specify target bitsize (32 or 64) - --enable-sim-hardware=LIST - Specify the hardware to be included in the build. + --enable-sim-hardware Whether to enable hardware/device simulation Report bugs to the package provider. _ACEOF @@ -1761,11 +1761,8 @@ fi fi -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'`" - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sim hardware settings" >&5 +$as_echo_n "checking for sim hardware settings... " >&6; } # Check whether --enable-sim-hardware was given. if test "${enable_sim_hardware+set}" = set; then : enableval=$enable_sim_hardware; @@ -1773,44 +1770,38 @@ else enable_sim_hardware="yes" fi -case ${enable_sim_hardware} in - yes|no) ;; - ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";; - *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";; - *) hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';; -esac - +sim_hw_sockser= if test "$enable_sim_hardware" = no; then - sim_hw_objs= sim_hw_cflags="-DWITH_HW=0" - sim_hw= -else +elif test "$enable_sim_hardware" = yes; then sim_hw_cflags="-DWITH_HW=1" - # remove duplicates - sim_hw="" - sim_hw_objs="\$(SIM_COMMON_HW_OBJS)" - for i in $hardware ; do - case " $sim_hw " in - *" $i "*) ;; - *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";; - esac - done # mingw does not support sockser case ${host} in *mingw*) ;; *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device # that you instatiate. Instead, other code will call into it directly. # At some point, we should convert it over. - sim_hw_objs="$sim_hw_objs dv-sockser.o" + sim_hw_sockser="dv-sockser.o" sim_hw_cflags="$sim_hw_cflags -DHAVE_DV_SOCKSER" ;; esac - if test x"$silent" != x"yes"; then - echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs" - fi +else + as_fn_error $? "unknown argument \"$enable_sim_hardware\"" "$LINENO" 5 +fi +if test "$enable_sim_hardware" = "yes"; then + SIM_ENABLE_HW_TRUE= + SIM_ENABLE_HW_FALSE='#' +else + SIM_ENABLE_HW_TRUE='#' + SIM_ENABLE_HW_FALSE= fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${enable_sim_hardware}" >&5 +$as_echo "${enable_sim_hardware}" >&6; } + + + cgen_breaks="" if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then @@ -1834,9 +1825,6 @@ ac_config_commands="$ac_config_commands stamp-h" - - - cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure diff --git a/sim/mn10300/configure.ac b/sim/mn10300/configure.ac index e531be9..74eb1fa 100644 --- a/sim/mn10300/configure.ac +++ b/sim/mn10300/configure.ac @@ -4,6 +4,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config]) SIM_AC_OPTION_RESERVED_BITS SIM_AC_OPTION_BITSIZE(32,31) -SIM_AC_OPTION_HARDWARE(mn103cpu mn103int mn103tim mn103ser mn103iop) SIM_AC_OUTPUT -- cgit v1.1