diff --git a/radio/util/elf-size-report.sh b/radio/util/elf-size-report.sh index 6eb1c52d0..073f98347 100755 --- a/radio/util/elf-size-report.sh +++ b/radio/util/elf-size-report.sh @@ -63,6 +63,14 @@ for i in "$@" ; do esac done +# -- prefer gawk to awk if installed +which gawk 2>&1 > /dev/null +if [[ $? == 0 ]]; then + AWKCMD="gawk -nf" +else + AWKCMD="awk -nf" +fi + # -- defaults which may change based on MCU default_flash_addr=0x08000000 default_flash_sz=1024 # KB @@ -154,7 +162,7 @@ for elf in "$@"; do fi #${SIZE} -A -x ${elf} escelf="${elf//\\//}" - output=`${SIZE} -A -x ${elf} | "${base_dir}/elf-size-report.awk" \ + output=`${SIZE} -A -x ${elf} | ${AWKCMD} "${base_dir}/elf-size-report.awk" \ -v mcu="${MCU}" \ -v elf="${escelf}" \ -v skip_data=${skip_data} \ @@ -170,6 +178,6 @@ for elf in "$@"; do done # -- if more than one elf file was given, also run a comparison report if (( file_cnt > 1 && compare )) ; then - echo "$all_output" | "${base_dir}/elf-size-compare.awk" + echo "$all_output" | ${AWKCMD} "${base_dir}/elf-size-compare.awk" fi