mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 22:45:48 +01:00
Add --check option to scripts/baremetal.sh
Only effective together with --rom, makes two changes: - abort in case of build warnings - skip writing statistics The goal is to make sure we build cleanly in the configuration used for measuring code size, with all the compilers we use, both because we care about that configuration and those compilers, and because any warnings would cast a shadow on the code size measurements. Currently the build fails with armc5 due to a pre-existing warning in PK, this will be fixed in the next commit. The next commit will also add an all.sh component to make sure we have no regression in the future. (Which is the motivation for --check skipping statistics: an all.sh component should probably not leave files around.) While at it, fix two things: 1. The call to gcc --version was redundant with the echo line below 2. WARNING_CFLAGS shouldn't be overriden with armclang, as it would remove the -Wall -Wextra and any directory-specific warning (such as -Wdeclaration-after-statement in library). It's meant to be overriden only with compilers that don't accept the default value (namely armc5 here).
This commit is contained in:
parent
889bbc70b6
commit
070f107a61
@ -75,15 +75,20 @@ baremetal_build_gcc()
|
||||
echo "Create 32-bit library-only baremetal build (GCC, config: $BAREMETAL_CONFIG)"
|
||||
gcc_ver=$($GCC_CC --version | head -n 1 | sed -n 's/^.*\([0-9]\.[0-9]\.[0-9]\).*$/\1/p')
|
||||
|
||||
CFLAGS_BAREMETAL="-Os -mthumb -mcpu=cortex-m0plus"
|
||||
CFLAGS_BAREMETAL="-Os -mthumb -mcpu=cortex-m0plus --std=c99"
|
||||
if [ $check -ne 0 ]; then
|
||||
CFLAGS_BAREMETAL="$CFLAGS_BAREMETAL -Werror"
|
||||
fi
|
||||
CFLAGS="$CFLAGS_BAREMETAL $CFLAGS_CONFIG"
|
||||
|
||||
$GCC_CC --version
|
||||
|
||||
echo "GCC version: $gcc_ver"
|
||||
echo "Flags: $CFLAGS_BAREMETAL"
|
||||
make CC=$GCC_CC AR=$GCC_AR CFLAGS="$CFLAGS" lib -j > /dev/null
|
||||
|
||||
if [ $check -ne 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
ROM_OUT_FILE="rom_files__${date}__${NAME}__gcc_${gcc_ver}"
|
||||
ROM_OUT_SYMS="rom_syms__${date}__${NAME}__gcc_${gcc_ver}"
|
||||
echo "Generate file statistics..."
|
||||
@ -108,10 +113,18 @@ baremetal_build_armc5()
|
||||
CFLAGS="$CFLAGS_BAREMETAL $CFLAGS_CONFIG"
|
||||
WARNING_CFLAGS="--strict --c99"
|
||||
|
||||
if [ $check -ne 0 ]; then
|
||||
WARNING_CFLAGS="$WARNING_CFLAGS --diag_error=warning"
|
||||
fi
|
||||
|
||||
echo "ARMC5 version: $armc5_ver"
|
||||
echo "Flags: $WARNING_CFLAGS $CFLAGS_BAREMETAL"
|
||||
make WARNING_CFLAGS="$WARNING_CFLAGS" CC=$ARMC5_CC AR=$ARMC5_AR CFLAGS="$CFLAGS" lib -j > /dev/null
|
||||
|
||||
if [ $check -ne 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
ROM_OUT_FILE="rom_files__${date}__${NAME}__armc5_${armc5_ver}"
|
||||
ROM_OUT_SYMS="rom_syms__${date}__${NAME}__armc5_${armc5_ver}"
|
||||
echo "Generate file statistics..."
|
||||
@ -132,13 +145,19 @@ baremetal_build_armc6()
|
||||
echo "Create 32-bit library-only baremetal build (ARMC6, Config: $BAREMETAL_CONFIG)"
|
||||
armc6_ver=$($ARMC6_CC --version | sed -n 's/.*ARM Compiler \([^ ]*\)$/\1/p')
|
||||
|
||||
CFLAGS_BAREMETAL="-Os --target=arm-arm-none-eabi -mthumb -mcpu=cortex-m0plus"
|
||||
CFLAGS_BAREMETAL="-Os --target=arm-arm-none-eabi -mthumb -mcpu=cortex-m0plus -xc --std=c99"
|
||||
if [ $check -ne 0 ]; then
|
||||
CFLAGS_BAREMETAL="$CFLAGS_BAREMETAL -Werror"
|
||||
fi
|
||||
CFLAGS="$CFLAGS_BAREMETAL $CFLAGS_CONFIG"
|
||||
WARNING_CFLAGS="-xc -std=c99"
|
||||
|
||||
echo "ARMC6 version: $armc6_ver"
|
||||
echo "Flags: $WARNING_CFLAGS $CFLAGS_BAREMETAL"
|
||||
make WARNING_CFLAGS="$WARNING_CFLAGS" CC=$ARMC6_CC AR=$ARMC6_AR CFLAGS="$CFLAGS" lib -j > /dev/null
|
||||
echo "Flags: $CFLAGS_BAREMETAL"
|
||||
make CC=$ARMC6_CC AR=$ARMC6_AR CFLAGS="$CFLAGS" lib -j > /dev/null
|
||||
|
||||
if [ $check -ne 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
ROM_OUT_FILE="rom_files__${date}__${NAME}__armc6_${armc6_ver}"
|
||||
ROM_OUT_SYMS="rom_syms__${date}__${NAME}__armc6_${armc6_ver}"
|
||||
@ -284,7 +303,7 @@ baremetal_ram_stack() {
|
||||
}
|
||||
|
||||
show_usage() {
|
||||
echo "Usage: $0 [--rom [--gcc] [--armc5] [--armc6]|--ram [--stack] [--heap]]"
|
||||
echo "Usage: $0 [--rom [--check] [--gcc] [--armc5] [--armc6]|--ram [--stack] [--heap]]"
|
||||
}
|
||||
|
||||
test_build=0
|
||||
@ -297,6 +316,8 @@ build_armc6=0
|
||||
measure_heap=0
|
||||
measure_stack=0
|
||||
|
||||
check=0
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--gcc) build_gcc=1;;
|
||||
@ -306,6 +327,7 @@ while [ $# -gt 0 ]; do
|
||||
--rom) raw_build=1;;
|
||||
--heap) measure_heap=1;;
|
||||
--stack) measure_stack=1;;
|
||||
--check) check=1;;
|
||||
-*)
|
||||
echo >&2 "Unknown option: $1"
|
||||
show_usage
|
||||
|
Loading…
Reference in New Issue
Block a user