run ci with -DCMAKE_BUILD_TYPE=MinSizeRel

This commit is contained in:
hathach 2023-06-25 00:05:23 +07:00
parent 30ccfe0832
commit 15376397b1
No known key found for this signature in database
GPG Key ID: F5D50C6D51D17CBA
5 changed files with 20 additions and 11 deletions

View File

@ -47,4 +47,4 @@ jobs:
run: python3 tools/get_deps.py ${{ matrix.family }}
- name: Build
run: python3 tools/build_cmake.py ${{ matrix.family }} -DTOOLCHAIN=iar
run: python3 tools/build_cmake.py ${{ matrix.family }} -DTOOLCHAIN=iar -DCMAKE_BUILD_TYPE=MinSizeRel

View File

@ -75,7 +75,7 @@ jobs:
run: python3 tools/get_deps.py ${{ matrix.family }}
- name: Build
run: python tools/build_cmake.py ${{ matrix.family }}
run: python tools/build_cmake.py ${{ matrix.family }} -DCMAKE_BUILD_TYPE=MinSizeRel
env:
# for rp2040, there is no harm if defined for other families
PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk

View File

@ -143,9 +143,19 @@ void board_init(void)
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
// Suppress warning caused by mcu driver
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
/* Enable USB FS Clocks */
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#if OTG_FS_VBUS_SENSE
/* Configure VBUS Pin */
GPIO_InitStruct.Pin = GPIO_PIN_9;

View File

@ -33,7 +33,7 @@ CFLAGS_GCC += \
-nostdlib -nostartfiles
# mcu driver cause following warnings
CFLAGS_GCC += -Wno-error=shadow -Wno-error=cast-align
CFLAGS_GCC += -Wno-error=cast-align
# -----------------
# Sources & Include

View File

@ -13,8 +13,6 @@ SKIPPED = "\033[33mskipped\033[0m"
build_separator = '-' * 106
toolchain_iar = '-DTOOLCHAIN=iar'
def filter_with_input(mylist):
if len(sys.argv) > 1:
input_args = list(set(mylist).intersection(sys.argv))
@ -22,7 +20,7 @@ def filter_with_input(mylist):
mylist[:] = input_args
def build_family(family, toolchain_option):
def build_family(family, cmake_option):
all_boards = []
for entry in os.scandir("hw/bsp/{}/boards".format(family)):
if entry.is_dir() and entry.name != 'pico_sdk':
@ -38,7 +36,7 @@ def build_family(family, toolchain_option):
# Generate build
r = subprocess.run(f"cmake examples -B {build_dir} -G \"Ninja\" -DFAMILY={family} -DBOARD"
f"={board} {toolchain_option}", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
f"={board} {cmake_option}", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# Build
if r.returncode == 0:
@ -74,9 +72,10 @@ def build_family(family, toolchain_option):
if __name__ == '__main__':
# IAR CC
if toolchain_iar not in sys.argv:
toolchain_iar = ''
cmake_options = ''
for a in sys.argv[1:]:
if a.startswith('-'):
cmake_options += ' ' + a
# If family are not specified in arguments, build all supported
all_families = []
@ -93,7 +92,7 @@ if __name__ == '__main__':
# succeeded, failed, skipped
total_result = [0, 0, 0]
for family in all_families:
fret = build_family(family, toolchain_iar)
fret = build_family(family, cmake_options)
if len(fret) == len(total_result):
total_result = [total_result[i] + fret[i] for i in range(len(fret))]