diff --git a/Makefile b/Makefile index baff3fae1a7..827e74632f0 100644 --- a/Makefile +++ b/Makefile @@ -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 ############################################################################### diff --git a/mk/source.mk b/mk/source.mk index bcce271f261..317d4c43552 100644 --- a/mk/source.mk +++ b/mk/source.mk @@ -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 \ @@ -467,41 +484,14 @@ 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 \ @@ -509,7 +499,6 @@ SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \ config/feature.c \ config/config_streamer.c \ config/simplified_tuning.c \ - i2c_bst.c \ io/dashboard.c \ io/serial.c \ io/serial_4way.c \ @@ -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) diff --git a/src/platform/APM32/mk/APM32F4.mk b/src/platform/APM32/mk/APM32F4.mk index 1c7d8c42a68..6172080a02a 100644 --- a/src/platform/APM32/mk/APM32F4.mk +++ b/src/platform/APM32/mk/APM32F4.mk @@ -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 diff --git a/src/platform/AT32/mk/AT32F4.mk b/src/platform/AT32/mk/AT32F4.mk index dda6847b9c2..66c04b4af36 100644 --- a/src/platform/AT32/mk/AT32F4.mk +++ b/src/platform/AT32/mk/AT32F4.mk @@ -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 diff --git a/src/platform/SIMULATOR/target/SITL/target.mk b/src/platform/SIMULATOR/target/SITL/target.mk index 97a4d2bd2d3..c314728e480 100644 --- a/src/platform/SIMULATOR/target/SITL/target.mk +++ b/src/platform/SIMULATOR/target/SITL/target.mk @@ -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 diff --git a/src/platform/STM32/mk/STM32F4.mk b/src/platform/STM32/mk/STM32F4.mk index e9a37cb186d..712940f5615 100644 --- a/src/platform/STM32/mk/STM32F4.mk +++ b/src/platform/STM32/mk/STM32F4.mk @@ -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 \ diff --git a/src/platform/STM32/mk/STM32F7.mk b/src/platform/STM32/mk/STM32F7.mk index 9c294818157..2cf48120cc9 100644 --- a/src/platform/STM32/mk/STM32F7.mk +++ b/src/platform/STM32/mk/STM32F7.mk @@ -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 diff --git a/src/platform/STM32/mk/STM32G4.mk b/src/platform/STM32/mk/STM32G4.mk index 4131430398e..2c10613da38 100644 --- a/src/platform/STM32/mk/STM32G4.mk +++ b/src/platform/STM32/mk/STM32G4.mk @@ -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 diff --git a/src/platform/STM32/mk/STM32H5.mk b/src/platform/STM32/mk/STM32H5.mk index b6c1682c7bb..21c0bd5a95f 100644 --- a/src/platform/STM32/mk/STM32H5.mk +++ b/src/platform/STM32/mk/STM32H5.mk @@ -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 diff --git a/src/platform/STM32/mk/STM32H7.mk b/src/platform/STM32/mk/STM32H7.mk index 5651cbd122b..2129a1e11a1 100644 --- a/src/platform/STM32/mk/STM32H7.mk +++ b/src/platform/STM32/mk/STM32H7.mk @@ -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