echo -e "\"Number of types\"\tSize1\tSize2\tTime1\tTime2" ARMOPTS="-Os -s -std=c++17 -mthumb -mcpu=cortex-m0plus -fno-rtti -fno-exceptions \ -ffunction-sections -fdata-sections -Wl,--gc-sections \ ../../src/muut/etteplan_paroc_smartti/src/mbed/TARGET_ELMO_L072RZ/TOOLCHAIN_GCC_ARM/*.o \ -L../../src/muut/etteplan_paroc_smartti/src/mbed/TARGET_ELMO_L072RZ/TOOLCHAIN_GCC_ARM \ -T../../src/muut/etteplan_paroc_smartti/src/mbed/TARGET_ELMO_L072RZ/TOOLCHAIN_GCC_ARM/STM32L073XZ.ld \ -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_calloc_r \ --specs=nano.specs \ -Wl,--start-group -lnosys -lmbed -lc_nano -lstdc++_nano -Wl,--end-group" for NUM_TYPES in `seq 1 25`;do rm -rf previous mkdir previous mv 1.out 2.out 1a.out 2a.out previous/ rm -f 1.bin 2.bin 1a.bin 2a.bin 1o.out make CPPFLAGS='-DNUM_TYPES='$NUM_TYPES -j 1.out 1o.out &>/dev/null #(arm-none-eabi-g++ main.cc -DHEADER='"dump_1.hh"' -DNUM_TYPES=$NUM_TYPES -o 1a.elf $ARMOPTS #arm-none-eabi-objcopy -O binary 1a.elf 1a.out) & #(arm-none-eabi-g++ main.cc -DHEADER='"dump_2.hh"' -DNUM_TYPES=$NUM_TYPES -o 2a.elf $ARMOPTS #arm-none-eabi-objcopy -O binary 2a.elf 2a.out)& #wait #) &>/dev/null size1="` objcopy -Obinary -j.text -j.rodata 1.out 1.bin; stat -c%s 1.bin`" size1o="` objcopy -Obinary -j.text -j.rodata 1o.out 1o.bin; stat -c%s 1o.bin`" size2="` objcopy -Obinary -j.text -j.rodata 2.out 2.bin; stat -c%s 2.bin`" size1a="`arm-linux-gnueabi-objcopy -Obinary -j.text -j.rodata 1a.out 1a.bin; stat -c%s 1a.bin`" size2a="`arm-linux-gnueabi-objcopy -Obinary -j.text -j.rodata 2a.out 2a.bin; stat -c%s 2a.bin`" time1="`unset TIME;/usr/bin/time ./1.out 2>&1 >/dev/null |grep 'user.*system'|sed 's/user.*//'`" time2="`unset TIME;/usr/bin/time ./2.out 2>&1 >/dev/null |grep 'user.*system'|sed 's/user.*//'`" echo -e "$NUM_TYPES\t$size1\t$size1o\t$size2\t$size1a\t$size2a\t$time1\t$time2" done