Commit 4a395668 authored by Jan Kiene's avatar Jan Kiene
Browse files

add argument to instr script for passing "-s" to wmc_tool

parent a28d787e
Loading
Loading
Loading
Loading
+21 −5
Original line number Diff line number Diff line
@@ -35,12 +35,28 @@ function usage {
    echo "Usage:"
    echo "      prepare_instrumentation.sh [MODE]"
    echo 
    echo "      MODE - sr_off (default) or sr_on"
    echo "      MODE - full (default) or mem_only"
    exit
}

INCLUDE_SPLIT=1

wmc_opt=""
if [ $# -eq 1 ]; then
    mode=$1
    if [ "$mode" = "full" ]; then
        wmc_opt=""
    elif [ "$mode" = "mem_only" ]; then
        wmc_opt="-s"
    else
        echo "Invalid input for MODE"
        usage
        exit 1
    fi
elif [ $# -ge 2 ]; then
    usage
    exit 1
fi

system=`uname -s`
if [[ ($system == "Linux") && (`uname -a` =~ (microsoft|Microsoft|wsl|WSL) ) ]]; then
@@ -149,11 +165,11 @@ shopt -u extglob
find $targetdir -name "*.[ch]" -exec sed -i.bak -e "s/\(0x[0-9a-fA-F]*\)UL/\(\(unsigned long\)\1\)/" \{\} \;

# run wmc_tool
"tools/$system/wmc_tool" -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c"  >> /dev/null
"tools/$system/wmc_tool" -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null
"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c"  >> /dev/null
"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> /dev/null
if [ $INCLUDE_SPLIT -eq 1 ]; then
    "tools/$system/wmc_tool" -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null
    "tools/$system/wmc_tool" -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null
    "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null
    "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$targetdir/lib_lc3plus/fft/*.c" >> /dev/null
fi

# automatically enable #define WMOPS in options.h