Compare commits

...

3 Commits

Author SHA1 Message Date
Alexander Lerach 5ad85c1492 switch uxrce to space 2024-11-28 11:32:24 +01:00
Alexander Lerach 5854f8e5bf Moved everything driver/sensor related to SPACE opt 2024-11-28 10:32:56 +01:00
Alexander Lerach 03b805483e added module specific speed/space optimization selection. Set drivers to optimize for speed 2024-11-28 10:12:43 +01:00
52 changed files with 63 additions and 58 deletions
+10 -5
View File
@@ -241,19 +241,24 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "Coverage"))
set(MAX_CUSTOM_OPT_LEVEL -O0)
set(MAX_CUSTOM_OPT_LEVEL_SPEED -O0)
elseif(CMAKE_BUILD_TYPE MATCHES "Sanitizer")
set(MAX_CUSTOM_OPT_LEVEL -O1)
set(MAX_CUSTOM_OPT_LEVEL_SPEED -O1)
elseif(CMAKE_BUILD_TYPE MATCHES "Release")
set(MAX_CUSTOM_OPT_LEVEL -O3)
set(MAX_CUSTOM_OPT_LEVEL_SPEED -O3)
else()
if(px4_constrained_flash_build)
set(MAX_CUSTOM_OPT_LEVEL -Os)
set(MAX_CUSTOM_OPT_LEVEL_SPEED -Os)
else()
set(MAX_CUSTOM_OPT_LEVEL -O2)
set(MAX_CUSTOM_OPT_LEVEL_SPEED -O2)
set(MAX_CUSTOM_OPT_LEVEL_SPACE -Os)
endif()
endif()
if(NOT MAX_CUSTOM_OPT_LEVEL_SPACE)
set(MAX_CUSTOM_OPT_LEVEL_SPACE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Coverage;AddressSanitizer;UndefinedBehaviorSanitizer")
message(STATUS "cmake build type: ${CMAKE_BUILD_TYPE}")
@@ -43,4 +43,4 @@ if(PX4_TESTING)
add_subdirectory(test)
endif()
target_compile_options(px4_work_queue PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(px4_work_queue PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
+2 -2
View File
@@ -80,7 +80,7 @@ if (NOT DEFINED CONFIG_BUILD_FLAT AND "${PX4_PLATFORM}" MATCHES "nuttx")
${SRCS_KERNEL}
)
target_link_libraries(uORB_kernel PRIVATE cdev uorb_msgs nuttx_mm heatshrink)
target_compile_options(uORB_kernel PRIVATE ${MAX_CUSTOM_OPT_LEVEL} -D__KERNEL__)
target_compile_options(uORB_kernel PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED} -D__KERNEL__)
# User side library in nuttx kernel/protected build
px4_add_library(uORB
@@ -106,7 +106,7 @@ else()
endif()
target_link_libraries(uORB PRIVATE uorb_msgs heatshrink)
target_compile_options(uORB PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(uORB PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
if(PX4_TESTING)
add_subdirectory(uORB_tests)
@@ -34,4 +34,4 @@
px4_add_library(arch_dshot
dshot.c
)
target_compile_options(arch_dshot PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(arch_dshot PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
@@ -34,6 +34,6 @@
px4_add_library(arch_spi
spi.cpp
)
target_compile_options(arch_spi PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(arch_spi PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
target_link_libraries (arch_spi PRIVATE drivers_board) # px4_spi_buses
@@ -36,6 +36,6 @@ px4_add_library(arch_hrt
)
target_compile_options(arch_hrt
PRIVATE
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
-Wno-cast-align # TODO: fix and enable
)
@@ -39,6 +39,6 @@ px4_add_library(arch_io_pins
rp2040_pinset.c
)
target_compile_options(arch_io_pins PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(arch_io_pins PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
target_link_libraries(arch_io_pins PRIVATE drivers_board)
@@ -34,4 +34,4 @@
px4_add_library(arch_spi
spi.cpp
)
target_compile_options(arch_spi PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(arch_spi PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
@@ -34,4 +34,4 @@
px4_add_library(arch_dshot
dshot.c
)
target_compile_options(arch_dshot PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(arch_dshot PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
@@ -36,6 +36,6 @@ px4_add_library(arch_hrt
)
target_compile_options(arch_hrt
PRIVATE
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
-Wno-cast-align # TODO: fix and enable
)
@@ -37,6 +37,6 @@ px4_add_library(arch_io_pins
pwm_servo.c
pwm_trigger.c
)
target_compile_options(arch_io_pins PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(arch_io_pins PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
target_link_libraries(arch_io_pins PRIVATE drivers_board) # timer_io_channels
@@ -34,6 +34,6 @@
px4_add_library(arch_spi
spi.cpp
)
target_compile_options(arch_spi PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(arch_spi PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
target_link_libraries (arch_spi PRIVATE drivers_board) # px4_spi_buses
@@ -35,7 +35,7 @@ px4_add_module(
MODULE drivers__imu__analog_devices__adis16448
MAIN adis16448
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPACE}
#-DDEBUG_BUILD
SRCS
ADIS16448.cpp
@@ -34,7 +34,7 @@ px4_add_module(
MODULE drivers__imu__invensense__icm42688p
MAIN icm42688p
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPACE}
#-DDEBUG_BUILD
SRCS
icm42688p_main.cpp
@@ -34,7 +34,7 @@ px4_add_module(
MODULE drivers__imu__invensense__icm45686
MAIN icm45686
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPACE}
#-DDEBUG_BUILD
SRCS
icm45686_main.cpp
@@ -34,7 +34,7 @@ px4_add_module(
MODULE drivers__imu__invensense__iim42652
MAIN iim42652
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPACE}
#-DDEBUG_BUILD
SRCS
iim42652_main.cpp
@@ -34,7 +34,7 @@ px4_add_module(
MODULE drivers__imu__invensense__iim42653
MAIN iim42653
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPACE}
#-DDEBUG_BUILD
SRCS
iim42653_main.cpp
+1 -1
View File
@@ -35,7 +35,7 @@ px4_add_module(
MODULE modules__fake_imu
MAIN fake_imu
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPACE}
SRCS
FakeImu.cpp
FakeImu.hpp
+1 -1
View File
@@ -49,7 +49,7 @@ px4_add_library(cdev
CDev.hpp
${SRCS_PLATFORM}
)
target_compile_options(cdev PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(cdev PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
if (${PX4_PLATFORM} STREQUAL "nuttx")
target_link_libraries(cdev PRIVATE nuttx_fs) # register/unregister driver
+1 -1
View File
@@ -36,6 +36,6 @@ px4_add_library(conversion
rotation.h
)
target_compile_options(conversion PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(conversion PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
px4_add_unit_gtest(SRC RotationTest.cpp LINKLIBS conversion)
+1 -1
View File
@@ -36,4 +36,4 @@ add_library(crc STATIC EXCLUDE_FROM_ALL
crc.h
)
add_dependencies(crc prebuild_targets)
target_compile_options(crc PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(crc PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
+1 -1
View File
@@ -35,5 +35,5 @@ px4_add_library(drivers_accelerometer
PX4Accelerometer.cpp
PX4Accelerometer.hpp
)
target_compile_options(drivers_accelerometer PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(drivers_accelerometer PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPACE})
target_link_libraries(drivers_accelerometer PRIVATE conversion)
+1 -1
View File
@@ -35,5 +35,5 @@ px4_add_library(drivers_gyroscope
PX4Gyroscope.cpp
PX4Gyroscope.hpp
)
target_compile_options(drivers_gyroscope PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(drivers_gyroscope PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPACE})
target_link_libraries(drivers_gyroscope PRIVATE conversion)
+1 -1
View File
@@ -36,6 +36,6 @@ add_library(geo
geo.h
)
add_dependencies(geo prebuild_targets)
target_compile_options(geo PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(geo PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
px4_add_unit_gtest(SRC test_geo.cpp LINKLIBS geo)
+1 -1
View File
@@ -38,5 +38,5 @@ px4_add_library(heatshrink
)
target_compile_options(heatshrink PRIVATE
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
-DHEATSHRINK_DYNAMIC_ALLOC=0)
+1 -1
View File
@@ -61,7 +61,7 @@ px4_add_library(mixer_module
)
add_dependencies(mixer_module output_functions_header)
target_compile_options(mixer_module PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(mixer_module PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
target_include_directories(mixer_module PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
px4_add_functional_gtest(SRC mixer_module_tests.cpp LINKLIBS mixer_module)
+2 -2
View File
@@ -31,7 +31,7 @@
#
############################################################################
add_compile_options(${MAX_CUSTOM_OPT_LEVEL})
add_compile_options(${MAX_CUSTOM_OPT_LEVEL_SPEED})
if (NOT PARAM_DEFAULT_OVERRIDES)
set(PARAM_DEFAULT_OVERRIDES "{}")
@@ -157,7 +157,7 @@ add_custom_target(parameters_header DEPENDS px4_parameters.hpp)
set(SRCS)
list(APPEND SRCS
parameters.cpp
parameters.cpp
atomic_transaction.cpp
autosave.cpp
)
+1 -1
View File
@@ -33,4 +33,4 @@
add_library(perf perf_counter.cpp)
add_dependencies(perf prebuild_targets)
target_compile_options(perf PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(perf PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
+1 -1
View File
@@ -35,7 +35,7 @@ px4_add_library(RateControl
rate_control.cpp
rate_control.hpp
)
target_compile_options(RateControl PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(RateControl PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
target_include_directories(RateControl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(RateControl PRIVATE mathlib)
+1 -1
View File
@@ -47,4 +47,4 @@ if(${PX4_PLATFORM} STREQUAL "nuttx")
endif()
px4_add_library(systemlib ${SRCS})
target_compile_options(systemlib PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(systemlib PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
+1 -1
View File
@@ -39,7 +39,7 @@ target_compile_definitions(tinybson PRIVATE -DMODULE_NAME="tinybson")
target_compile_options(tinybson
PRIVATE
-Wno-sign-compare # TODO: fix this
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
)
add_dependencies(tinybson prebuild_targets)
+1 -1
View File
@@ -53,7 +53,7 @@ add_library(world_magnetic_model
geo_magnetic_tables.hpp
)
add_dependencies(world_magnetic_model prebuild_targets)
target_compile_options(world_magnetic_model PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(world_magnetic_model PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
if(BUILD_TESTING)
px4_add_unit_gtest(SRC test_geo_lookup.cpp LINKLIBS world_magnetic_model)
@@ -64,7 +64,7 @@ px4_add_library(ActuatorEffectiveness
ActuatorEffectivenessRoverAckermann.cpp
)
target_compile_options(ActuatorEffectiveness PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(ActuatorEffectiveness PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
target_include_directories(ActuatorEffectiveness PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(ActuatorEffectiveness
PRIVATE
+1 -1
View File
@@ -39,7 +39,7 @@ px4_add_module(
MODULE modules__control_allocator
MAIN control_allocator
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
STACK_MAIN
3000
SRCS
@@ -39,7 +39,7 @@ px4_add_library(ControlAllocation
ControlAllocationSequentialDesaturation.cpp
ControlAllocationSequentialDesaturation.hpp
)
target_compile_options(ControlAllocation PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(ControlAllocation PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
target_include_directories(ControlAllocation PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(ControlAllocation PRIVATE mathlib)
+1 -1
View File
@@ -238,7 +238,7 @@ px4_add_module(
MODULE modules__ekf2
MAIN ekf2
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
-fno-associative-math
#-DDEBUG_BUILD
#-O0
@@ -38,6 +38,6 @@ add_library(lat_lon_alt
add_dependencies(lat_lon_alt prebuild_targets)
target_include_directories(lat_lon_alt PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_options(lat_lon_alt PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(lat_lon_alt PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
px4_add_unit_gtest(SRC test_lat_lon_alt.cpp LINKLIBS lat_lon_alt geo)
@@ -35,7 +35,7 @@ px4_add_library(follow_target_estimator
TargetEstimator.cpp
)
target_compile_options(follow_target_estimator PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(follow_target_estimator PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
target_link_libraries(follow_target_estimator
PRIVATE
@@ -35,7 +35,7 @@ px4_add_module(
MODULE fw_autotune_attitude_control
MAIN fw_autotune_attitude_control
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
SRCS
fw_autotune_attitude_control.cpp
fw_autotune_attitude_control.hpp
+1 -1
View File
@@ -51,7 +51,7 @@ px4_add_module(
STACK_MAIN
4096
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
-DARM_ALL_FFT_TABLES
-DARM_MATH_LOOPUNROLL
INCLUDES
+1 -1
View File
@@ -37,7 +37,7 @@ px4_add_module(
PRIORITY "SCHED_PRIORITY_MAX-30"
STACK_MAIN 2500
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
-Wno-cast-align # TODO: fix and enable
SRCS
logged_topics.cpp
@@ -36,7 +36,7 @@ px4_add_library(AttitudeControl
AttitudeControl.hpp
AttitudeControlMath.hpp
)
target_compile_options(AttitudeControl PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(AttitudeControl PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPEED})
target_include_directories(AttitudeControl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
px4_add_unit_gtest(SRC AttitudeControlTest.cpp LINKLIBS AttitudeControl)
+1 -1
View File
@@ -37,7 +37,7 @@ px4_add_module(
MODULE modules__mc_att_control
MAIN mc_att_control
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
SRCS
mc_att_control_main.cpp
mc_att_control.hpp
@@ -35,7 +35,7 @@ px4_add_module(
MODULE mc_autotune_attitude_control
MAIN mc_autotune_attitude_control
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
SRCS
mc_autotune_attitude_control.cpp
mc_autotune_attitude_control.hpp
@@ -40,7 +40,7 @@ px4_add_module(
MODULE modules__mc_hover_thrust_estimator
MAIN mc_hover_thrust_estimator
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
SRCS
MulticopterHoverThrustEstimator.cpp
MulticopterHoverThrustEstimator.hpp
+1 -1
View File
@@ -35,7 +35,7 @@ px4_add_module(
MODULE modules__mc_rate_control
MAIN mc_rate_control
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
SRCS
MulticopterRateControl.cpp
MulticopterRateControl.hpp
@@ -36,7 +36,7 @@ px4_add_library(vehicle_acceleration
VehicleAcceleration.hpp
)
target_compile_options(vehicle_acceleration PRIVATE ${MAX_CUSTOM_OPT_LEVEL})
target_compile_options(vehicle_acceleration PRIVATE ${MAX_CUSTOM_OPT_LEVEL_SPACE})
target_link_libraries(vehicle_acceleration
PRIVATE
@@ -38,7 +38,7 @@ px4_add_library(vehicle_angular_velocity
target_compile_options(vehicle_angular_velocity
PRIVATE
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPACE}
#-DDEBUG_BUILD
)
@@ -38,7 +38,7 @@ px4_add_library(vehicle_imu
target_compile_options(vehicle_imu
PRIVATE
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPACE}
#-DDEBUG_BUILD
)
@@ -51,7 +51,7 @@ if(gz-transport_FOUND)
MODULE modules__simulation__gz_bridge
MAIN gz_bridge
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
SRCS
GZBridge.cpp
GZBridge.hpp
@@ -35,7 +35,7 @@ px4_add_module(
MODULE modules__simulation__simulator_sih
MAIN simulator_sih
COMPILE_FLAGS
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPEED}
SRCS
aero.hpp
sih.cpp
+1 -1
View File
@@ -138,7 +138,7 @@ else()
COMPILE_FLAGS
#-O0
# -DDEBUG_BUILD
${MAX_CUSTOM_OPT_LEVEL}
${MAX_CUSTOM_OPT_LEVEL_SPACE}
SRCS
${CMAKE_CURRENT_BINARY_DIR}/dds_topics.h
uxrce_dds_client.cpp