diff --git a/scripts/prepare_instrumentation.sh b/scripts/prepare_instrumentation.sh index 4ed7098442b93ab58b6a5fddfd5065dda5137da8..35bbfe4420a11ce0234995f0d4a81f66cfe0e582 100755 --- a/scripts/prepare_instrumentation.sh +++ b/scripts/prepare_instrumentation.sh @@ -160,6 +160,12 @@ if [ $? -ne 0 ]; then exit -1 fi +# Floating point code has lib_lc3plus/fft folder while BASOP code does not +fftdir="" +if [ -d $targetdir/lib_lc3plus/fft ]; then + fftdir="$targetdir/lib_lc3plus/fft/*.c" +fi + # strip switches, to remove the macros (turn on extended globing to allow !(pattern*) matching) shopt -s extglob if coan_exists; then @@ -171,7 +177,9 @@ if coan_exists; then if [ "$PROJECT" = "FLOAT" ]; then coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_{com,dec,enc,isar,rend,util,debug}/!(wmc_auto*).[hc] coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_lc3plus/!(wmc_auto*).[hc] - coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_lc3plus/fft/!(wmc_auto*).[hc] + if [ -n "$fftdir" ];then + coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_lc3plus/fft/!(wmc_auto*).[hc] + fi else # same as first call from if, but without "isar" and "debug" to avoid coan warning coan source --replace --no-transients -E -K --file $ifdef_list $targetdir/lib_{com,dec,enc,rend,util}/!(wmc_auto*).[hc] @@ -185,18 +193,20 @@ 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" $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 +"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/encoder.c" "$targetdir/lib_enc/*.c" "$targetdir/lib_com/*.c" >> output.txt 2>&1 +"tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/decoder.c" "$targetdir/lib_dec/*.c" "$targetdir/lib_rend/*.c" >> output.txt 2>&1 # ISAR post-renderer and lc3plus sources only need to be instrumented in float code if [ "$PROJECT" = "FLOAT" ]; then for bak_file in $targetdir/lib_rend/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - "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/renderer.c" "$targetdir/lib_rend/*.c" "$targetdir/lib_lc3plus/*.c" "$fftdir" >> output.txt 2>&1 for bak_file in $targetdir/lib_lc3plus/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - for bak_file in $targetdir/lib_lc3plus/fft/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - "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 + if [ -n "$fftdir" ];then + for bak_file in $targetdir/lib_lc3plus/fft/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool + fi + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/isar_post_rend.c" "$targetdir/lib_isar/*.c" "$targetdir/lib_lc3plus/*.c" "$fftdir" >> output.txt 2>&1 else for bak_file in $targetdir/lib_rend/*.bak; do mv "$bak_file" "${bak_file%.*}"; done # restore fresh .c files to avoid time-consuming des-instrumentation of files by the WMC tool - "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" >> /dev/null + "tools/$system/wmc_tool" $wmc_opt -m "$targetdir/apps/renderer.c" "$targetdir/lib_rend/*.c" >> output.txt 2>&1 fi # automatically enable #define WMOPS in options.h