selectively increase optimization -Os -> -O2

- targetted at modules/libraries that benefit without drastically
increasing flash usage
 - ignored on boards with CONSTRAINED_FLASH set
This commit is contained in:
Daniel Agar
2020-06-04 20:59:52 -04:00
parent 7f73b9a131
commit 31fe7af454
26 changed files with 71 additions and 34 deletions
+2 -6
View File
@@ -35,9 +35,5 @@ px4_add_library(drivers_accelerometer
PX4Accelerometer.cpp
PX4Accelerometer.hpp
)
target_link_libraries(drivers_accelerometer
PRIVATE
conversion
drivers__device
mathlib
)
target_compile_options(drivers_accelerometer PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_link_libraries(drivers_accelerometer PRIVATE conversion drivers__device)
+1
View File
@@ -35,4 +35,5 @@ px4_add_library(drivers_gyroscope
PX4Gyroscope.cpp
PX4Gyroscope.hpp
)
target_compile_options(drivers_gyroscope PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_link_libraries(drivers_gyroscope PRIVATE conversion drivers__device)
+2 -1
View File
@@ -32,4 +32,5 @@
############################################################################
add_library(perf perf_counter.cpp)
add_dependencies(perf prebuild_targets)
add_dependencies(perf prebuild_targets)
target_compile_options(perf PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
+5
View File
@@ -33,13 +33,17 @@
set(SRCS
conversions.c
conversions.h
crc.c
crc.h
mavlink_log.cpp
mavlink_log.h
)
if(${PX4_PLATFORM} STREQUAL "nuttx")
list(APPEND SRCS
cpuload.c
cpuload.h
print_load_nuttx.c
otp.c
)
@@ -50,3 +54,4 @@ else()
endif()
px4_add_library(systemlib ${SRCS})
target_compile_options(systemlib PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
@@ -33,10 +33,9 @@
px4_add_library(AttitudeControl
AttitudeControl.cpp
AttitudeControl.hpp
)
target_include_directories(AttitudeControl
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_options(AttitudeControl PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_include_directories(AttitudeControl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
px4_add_unit_gtest(SRC AttitudeControlTest.cpp LINKLIBS AttitudeControl)
+3 -1
View File
@@ -37,10 +37,12 @@ px4_add_module(
MODULE modules__mc_att_control
MAIN mc_att_control
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
SRCS
mc_att_control_main.cpp
mc_att_control.hpp
DEPENDS
mathlib
AttitudeControl
mathlib
px4_work_queue
)
@@ -37,6 +37,7 @@ px4_add_module(
MODULE modules__mc_rate_control
MAIN mc_rate_control
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
SRCS
MulticopterRateControl.cpp
MulticopterRateControl.hpp
@@ -33,12 +33,10 @@
px4_add_library(RateControl
RateControl.cpp
RateControl.hpp
)
target_include_directories(RateControl
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_options(RateControl PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_include_directories(RateControl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(RateControl PRIVATE mathlib)
px4_add_unit_gtest(SRC RateControlTest.cpp LINKLIBS RateControl)
@@ -35,3 +35,4 @@ px4_add_library(sensor_corrections
SensorCorrections.cpp
SensorCorrections.hpp
)
target_compile_options(sensor_corrections PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
@@ -35,6 +35,9 @@ px4_add_library(vehicle_acceleration
VehicleAcceleration.cpp
VehicleAcceleration.hpp
)
target_compile_options(vehicle_acceleration PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_link_libraries(vehicle_acceleration
PRIVATE
mathlib
@@ -35,6 +35,9 @@ px4_add_library(vehicle_angular_velocity
VehicleAngularVelocity.cpp
VehicleAngularVelocity.hpp
)
target_compile_options(vehicle_angular_velocity PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_link_libraries(vehicle_angular_velocity
PRIVATE
mathlib
@@ -37,4 +37,5 @@ px4_add_library(vehicle_imu
VehicleIMU.cpp
VehicleIMU.hpp
)
target_compile_options(vehicle_imu PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_link_libraries(vehicle_imu PRIVATE sensor_corrections px4_work_queue)
+3 -1
View File
@@ -31,7 +31,7 @@
#
############################################################################
if(NOT "${PX4_BOARD}" MATCHES "px4_io") # TODO: fix this hack (move uORB to platform layer)
if(NOT PX4_BOARD MATCHES "px4_io") # TODO: fix this hack (move uORB to platform layer)
# this includes the generated topics directory
include_directories(${CMAKE_CURRENT_BINARY_DIR})
@@ -39,6 +39,8 @@ if(NOT "${PX4_BOARD}" MATCHES "px4_io") # TODO: fix this hack (move uORB to plat
px4_add_module(
MODULE modules__uORB
MAIN uorb
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
SRCS
ORBSet.hpp
Publication.hpp