diff --git a/Kconfig b/Kconfig index cc6b9e95ac..2b8ef70f7f 100644 --- a/Kconfig +++ b/Kconfig @@ -7,6 +7,12 @@ comment "Vendor: $(VENDOR)" comment "Model: $(MODEL)" comment "Label: $(LABEL)" +if $(HAS_CUSTOM_BOARD_KCONFIG) + menu "Custom board config" + osource "$(CUSTOM_BOARD_KCONFIG)" + endmenu +endif + menu "Toolchain" choice prompt "Platform" diff --git a/boards/nxp/ucans32k146/default.px4board b/boards/nxp/ucans32k146/default.px4board index e13f8628d7..1cdac3e899 100644 --- a/boards/nxp/ucans32k146/default.px4board +++ b/boards/nxp/ucans32k146/default.px4board @@ -7,6 +7,7 @@ CONFIG_DRIVERS_BOOTLOADERS=y CONFIG_DRIVERS_GPS=y CONFIG_DRIVERS_LIGHTS_RGBLED_PWM=y CONFIG_DRIVERS_PWM_OUT=y +CONFIG_DRIVERS_UAVCANNODE_GPS_DEMO=y CONFIG_SYSTEMCMDS_I2CDETECT=y CONFIG_SYSTEMCMDS_LED_CONTROL=y CONFIG_SYSTEMCMDS_MFT=y diff --git a/boards/px4/sitl/Kconfig b/boards/px4/sitl/Kconfig new file mode 100644 index 0000000000..4d1465c6b5 --- /dev/null +++ b/boards/px4/sitl/Kconfig @@ -0,0 +1,9 @@ +config BOARD_LOCKSTEP + bool "Force enable lockstep" + help + forces lockstep behaviour, despite REPLAY env variable + +config BOARD_NOLOCKSTEP + bool "Force disable lockstep" + help + forces nolockstep behaviour, despite REPLAY env variable diff --git a/boards/px4/sitl/nolockstep.px4board b/boards/px4/sitl/nolockstep.px4board index e69de29bb2..61671c9a77 100644 --- a/boards/px4/sitl/nolockstep.px4board +++ b/boards/px4/sitl/nolockstep.px4board @@ -0,0 +1 @@ +CONFIG_BOARD_NOLOCKSTEP=y diff --git a/boards/px4/sitl/replay.px4board b/boards/px4/sitl/replay.px4board index e69de29bb2..aab3a2793d 100644 --- a/boards/px4/sitl/replay.px4board +++ b/boards/px4/sitl/replay.px4board @@ -0,0 +1,2 @@ +CONFIG_BOARD_COMPILE_DEFINITIONS="-DORB_USE_PUBLISHER_RULES" +CONFIG_BOARD_LOCKSTEP=y diff --git a/boards/px4/sitl/sitl.cmake b/boards/px4/sitl/sitl.cmake new file mode 100644 index 0000000000..abbedac2fd --- /dev/null +++ b/boards/px4/sitl/sitl.cmake @@ -0,0 +1,18 @@ +set(config_sitl_viewer jmavsim CACHE STRING "viewer for sitl") +set_property(CACHE config_sitl_viewer PROPERTY STRINGS "jmavsim;none") + +set(config_sitl_debugger disable CACHE STRING "debugger for sitl") +set_property(CACHE config_sitl_debugger PROPERTY STRINGS "disable;gdb;lldb") + +# If the environment variable 'replay' is defined, we are building with replay +# support. In this case, we enable the orb publisher rules. +set(REPLAY_FILE "$ENV{replay}") +if(REPLAY_FILE) + message(STATUS "Building with uorb publisher rules support") + add_definitions(-DORB_USE_PUBLISHER_RULES) + + message(STATUS "Building without lockstep for replay") + set(ENABLE_LOCKSTEP_SCHEDULER no) +else() + set(ENABLE_LOCKSTEP_SCHEDULER yes) +endif() diff --git a/boards/px4/sitl/test.px4board b/boards/px4/sitl/test.px4board index 37f8b40f5a..13c824e409 100644 --- a/boards/px4/sitl/test.px4board +++ b/boards/px4/sitl/test.px4board @@ -1 +1,2 @@ +CONFIG_BOARD_NOLOCKSTEP=y CONFIG_MODULES_CONTROL_ALLOCATOR=y diff --git a/cmake/kconfig.cmake b/cmake/kconfig.cmake index 5a61545e34..393b4e2dae 100644 --- a/cmake/kconfig.cmake +++ b/cmake/kconfig.cmake @@ -23,6 +23,8 @@ set(COMMON_KCONFIG_ENV_SETTINGS TOOLCHAIN=${CMAKE_TOOLCHAIN_FILE} ARCHITECTURE=${CMAKE_SYSTEM_PROCESSOR} ROMFSROOT=${config_romfs_root} + HAS_CUSTOM_BOARD_KCONFIG=${HAS_CUSTOM_BOARD_KCONFIG} + CUSTOM_BOARD_KCONFIG=${CUSTOM_BOARD_KCONFIG} ) if(EXISTS ${BOARD_DEFCONFIG}) @@ -299,6 +301,14 @@ if(EXISTS ${BOARD_DEFCONFIG}) add_definitions( "-D__PX4_LINUX" ) endif() + if(LOCKSTEP) + set(ENABLE_LOCKSTEP_SCHEDULER yes) + endif() + + if(NOLOCKSTEP) + set(ENABLE_LOCKSTEP_SCHEDULER no) + endif() + include(px4_impl_os) px4_os_prebuild_targets(OUT prebuild_targets BOARD ${PX4_BOARD}) diff --git a/cmake/px4_config.cmake b/cmake/px4_config.cmake index 6cf8b8039f..07baafa4fc 100644 --- a/cmake/px4_config.cmake +++ b/cmake/px4_config.cmake @@ -111,3 +111,15 @@ set(PX4_CONFIG "${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_${PX4_BOARD_LABEL}" CACHE if(EXISTS "${PX4_BOARD_DIR}/uavcan_board_identity") include ("${PX4_BOARD_DIR}/uavcan_board_identity") endif() + +if(EXISTS "${PX4_BOARD_DIR}/sitl.cmake") +include ("${PX4_BOARD_DIR}/sitl.cmake") +endif() + +set(CUSTOM_BOARD_KCONFIG "${PX4_BOARD_DIR}/Kconfig" CACHE STRING "PX4 board custom config" FORCE) + +if(EXISTS ${CUSTOM_BOARD_KCONFIG}) + set(HAS_CUSTOM_BOARD_KCONFIG "y" CACHE STRING "PX4 board custom config" FORCE) +else() + set(HAS_CUSTOM_BOARD_KCONFIG "n" CACHE STRING "PX4 board custom config" FORCE) +endif()