Skip to content

Commit

Permalink
Adding 'size optimised' file list validity check (betaflight#14063)
Browse files Browse the repository at this point in the history
* Adding 'size optimised' file list validity check

* NL at EOF
  • Loading branch information
blckmn authored Dec 9, 2024
1 parent 2426f43 commit 8ef7344
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 37 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ ifneq ($(SKIPCHECKS),yes)
ifneq ($(filter-out $(SRC),$(SPEED_OPTIMISED_SRC)),)
$(error Speed optimised sources not valid: $(strip $(filter-out $(SRC),$(SPEED_OPTIMISED_SRC))))
endif

ifneq ($(filter-out $(SRC),$(SIZE_OPTIMISED_SRC)),)
$(error Size optimised sources not valid: $(strip $(filter-out $(SRC),$(SIZE_OPTIMISED_SRC))))
endif
endif

###############################################################################
Expand Down
60 changes: 23 additions & 37 deletions mk/source.mk
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,24 @@ SIZE_OPTIMISED_SRC += \
drivers/accgyro/accgyro_spi_mpu9250.c \
drivers/accgyro/accgyro_spi_icm20689.c \
drivers/accgyro/accgyro_spi_icm426xx.c \
drivers/accgyro/accgyro_spi_lsm6dso_init.c
drivers/accgyro/accgyro_spi_lsm6dso_init.c \
drivers/barometer/barometer_bmp085.c \
drivers/barometer/barometer_bmp280.c \
drivers/barometer/barometer_ms5611.c \
drivers/barometer/barometer_lps.c \
drivers/barometer/barometer_qmp6988.c \
drivers/barometer/barometer_2smpb_02b.c \
drivers/compass/compass_ak8963.c \
drivers/compass/compass_ak8975.c \
drivers/compass/compass_hmc5883l.c \
drivers/compass/compass_qmc5883l.c \
drivers/compass/compass_lis2mdl.c \
drivers/compass/compass_lis3mdl.c \
drivers/compass/compass_ist8310.c \
drivers/display_ug2864hsweg01.c \
drivers/vtx_rtc6705_soft_spi.c \
drivers/vtx_rtc6705.c


SPEED_OPTIMISED_SRC += \
drivers/bus_spi.c \
Expand Down Expand Up @@ -467,49 +484,21 @@ SPEED_OPTIMISED_SRC += \
$(CMSIS_SRC) \
$(DEVICE_STDPERIPH_SRC) \

SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
$(shell find $(SRC_DIR) -name '*_init.c') \
bus_bst_stm32f30x.c \
SIZE_OPTIMISED_SRC += \
sensors/gyro_init.c \
sensors/acceleration_init.c \
flight/pid_init.c \
flight/mixer_init.c \
cli/cli.c \
cli/settings.c \
drivers/accgyro/accgyro_fake.c \
drivers/barometer/barometer_bmp085.c \
drivers/barometer/barometer_bmp280.c \
drivers/barometer/barometer_fake.c \
drivers/barometer/barometer_ms5611.c \
drivers/barometer/barometer_lps.c \
drivers/barometer/barometer_qmp6988.c \
drivers/barometer/barometer_2smpb_02b.c \
drivers/bus_i2c_config.c \
drivers/bus_i2c_timing.c \
drivers/bus_spi_config.c \
drivers/bus_spi_pinconfig.c \
drivers/compass/compass_ak8963.c \
drivers/compass/compass_ak8975.c \
drivers/compass/compass_fake.c \
drivers/compass/compass_hmc5883l.c \
drivers/compass/compass_qmc5883l.c \
drivers/compass/compass_lis2mdl.c \
drivers/compass/compass_lis3mdl.c \
drivers/compass/compass_ist8310.c \
drivers/display_ug2864hsweg01.c \
drivers/inverter.c \
drivers/light_ws2811strip.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c \
drivers/serial_tcp.c \
drivers/serial_uart_pinconfig.c \
drivers/serial_usb_vcp.c \
drivers/vtx_rtc6705_soft_spi.c \
drivers/vtx_rtc6705.c \
drivers/vtx_common.c \
fc/init.c \
fc/board_info.c \
config/config_eeprom.c \
config/feature.c \
config/config_streamer.c \
config/simplified_tuning.c \
i2c_bst.c \
io/dashboard.c \
io/serial.c \
io/serial_4way.c \
Expand Down Expand Up @@ -551,9 +540,6 @@ SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
io/vtx_msp.c \
cms/cms_menu_vtx_msp.c

SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
drivers/bus_i2c_hal_init.c

# check if target.mk supplied
SRC := $(STARTUP_SRC) $(MCU_COMMON_SRC) $(TARGET_SRC) $(VARIANT_SRC)

Expand Down
10 changes: 10 additions & 0 deletions src/platform/APM32/mk/APM32F4.mk
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,15 @@ MSC_SRC = \
SPEED_OPTIMISED_SRC += \
common/stm32/system.c

SIZE_OPTIMISED_SRC += \
APM32/usb/vcp/serial_usb_vcp.c \
drivers/inverter.c \
drivers/bus_i2c_config.c \
drivers/bus_spi_config.c \
drivers/bus_spi_pinconfig.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c \
drivers/serial_uart_pinconfig.c

DSP_LIB := $(LIB_MAIN_DIR)/CMSIS/DSP
DEVICE_FLAGS += -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -DUNALIGNED_SUPPORT_DISABLE -DARM_MATH_CM4 -DUSE_FULL_DDL_DRIVER
10 changes: 10 additions & 0 deletions src/platform/AT32/mk/AT32F4.mk
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,13 @@ MCU_COMMON_SRC = \

SPEED_OPTIMISED_SRC += \
common/stm32/system.c

SIZE_OPTIMISED_SRC += \
drivers/bus_i2c_timing.c \
drivers/inverter.c \
drivers/bus_i2c_config.c \
drivers/bus_spi_config.c \
drivers/bus_spi_pinconfig.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c \
drivers/serial_uart_pinconfig.c
3 changes: 3 additions & 0 deletions src/platform/SIMULATOR/target/SITL/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ TARGET_SRC = \
drivers/barometer/barometer_virtual.c \
drivers/compass/compass_virtual.c \
drivers/serial_tcp.c

SIZE_OPTIMISED_SRC += \
drivers/serial_tcp.c
9 changes: 9 additions & 0 deletions src/platform/STM32/mk/STM32F4.mk
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ SPEED_OPTIMISED_SRC += \
common/stm32/system.c \
STM32/exti.c

SIZE_OPTIMISED_SRC += \
STM32/serial_usb_vcp.c \
drivers/inverter.c \
drivers/bus_i2c_config.c \
drivers/bus_spi_config.c \
drivers/bus_spi_pinconfig.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c

ifeq ($(PERIPH_DRIVER), HAL)
VCP_SRC = \
STM32/vcp_hal/usbd_desc.c \
Expand Down
11 changes: 11 additions & 0 deletions src/platform/STM32/mk/STM32F7.mk
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,16 @@ SPEED_OPTIMISED_SRC += \
STM32/pwm_output_dshot_hal.c \
STM32/exti.c

SIZE_OPTIMISED_SRC += \
drivers/bus_i2c_timing.c \
STM32/bus_i2c_hal_init.c \
STM32/serial_usb_vcp.c \
drivers/bus_i2c_config.c \
drivers/bus_spi_config.c \
drivers/bus_spi_pinconfig.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c \
drivers/serial_uart_pinconfig.c

DSP_LIB := $(LIB_MAIN_DIR)/CMSIS/DSP
DEVICE_FLAGS += -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -D__FPU_PRESENT=1 -DUNALIGNED_SUPPORT_DISABLE -DARM_MATH_CM7
11 changes: 11 additions & 0 deletions src/platform/STM32/mk/STM32G4.mk
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,16 @@ SPEED_OPTIMISED_SRC += \
common/stm32/system.c \
STM32/exti.c

SIZE_OPTIMISED_SRC += \
drivers/bus_i2c_timing.c \
STM32/bus_i2c_hal_init.c \
STM32/serial_usb_vcp.c \
drivers/bus_i2c_config.c \
drivers/bus_spi_config.c \
drivers/bus_spi_pinconfig.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c \
drivers/serial_uart_pinconfig.c

DSP_LIB := $(LIB_MAIN_DIR)/CMSIS/DSP
DEVICE_FLAGS += -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -D__FPU_PRESENT=1 -DUNALIGNED_SUPPORT_DISABLE -DARM_MATH_CM4
11 changes: 11 additions & 0 deletions src/platform/STM32/mk/STM32H5.mk
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,16 @@ SPEED_OPTIMISED_SRC += \
common/stm32/system.c \
STM32/exti.c

SIZE_OPTIMISED_SRC += \
drivers/bus_i2c_timing.c \
STM32/bus_i2c_hal_init.c \
STM32/serial_usb_vcp.c \
drivers/bus_i2c_config.c \
drivers/bus_spi_config.c \
drivers/bus_spi_pinconfig.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c \
drivers/serial_uart_pinconfig.c

DSP_LIB := $(LIB_MAIN_DIR)/CMSIS/DSP
DEVICE_FLAGS += -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -DUNALIGNED_SUPPORT_DISABLE -DARM_MATH_CM7
11 changes: 11 additions & 0 deletions src/platform/STM32/mk/STM32H7.mk
Original file line number Diff line number Diff line change
Expand Up @@ -320,5 +320,16 @@ SPEED_OPTIMISED_SRC += \
common/stm32/system.c \
STM32/exti.c

SIZE_OPTIMISED_SRC += \
drivers/bus_i2c_timing.c \
STM32/bus_i2c_hal_init.c \
STM32/serial_usb_vcp.c \
drivers/bus_i2c_config.c \
drivers/bus_spi_config.c \
drivers/bus_spi_pinconfig.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c \
drivers/serial_uart_pinconfig.c

DSP_LIB := $(LIB_MAIN_DIR)/CMSIS/DSP
DEVICE_FLAGS += -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -D__FPU_PRESENT=1 -DUNALIGNED_SUPPORT_DISABLE -DARM_MATH_CM7

0 comments on commit 8ef7344

Please sign in to comment.