NuttX cmake support optional compressed defconfigs

This commit is contained in:
Daniel Agar 2019-01-30 10:54:53 -05:00 committed by GitHub
parent 2f4f4c6623
commit 40e42a677b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 249 additions and 145 deletions

View File

@ -235,6 +235,10 @@ set_property(GLOBAL PROPERTY PX4_MODULE_CONFIG_FILES)
include(platforms/${PX4_PLATFORM}/cmake/px4_impl_os.cmake)
list(APPEND CMAKE_MODULE_PATH ${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake)
if(EXISTS "${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake/init.cmake")
include(init)
endif()
# CMake build type (Debug Release RelWithDebInfo MinSizeRel Coverage)
if (NOT CMAKE_BUILD_TYPE)
if (${PX4_PLATFORM} STREQUAL "nuttx")

View File

@ -46,7 +46,7 @@ function(px4_add_library target)
# all PX4 libraries have access to parameters and uORB
add_dependencies(${target} uorb_headers)
target_link_libraries(${target} PRIVATE prebuild_targets parameters_interface uorb_msgs)
target_link_libraries(${target} PRIVATE prebuild_targets parameters_interface px4_platform uorb_msgs)
# TODO: move to platform layer
if ("${PX4_PLATFORM}" MATCHES "nuttx")

View File

@ -100,8 +100,8 @@ target_link_libraries(px4 PRIVATE
-Wl,--gc-sections
-Wl,--start-group
drivers_boards_common_arch
${nuttx_libs}
drivers_boards_common_arch
${nuttx_libs}
-Wl,--end-group
m
@ -109,7 +109,6 @@ target_link_libraries(px4 PRIVATE
)
target_link_libraries(px4 PRIVATE ${module_libraries})
target_link_libraries(px4 PRIVATE modules__uORB)
if (config_romfs_root)
add_subdirectory(${PX4_SOURCE_DIR}/ROMFS ${PX4_BINARY_DIR}/ROMFS)

View File

@ -1,13 +1,3 @@
cmake_minimum_required(VERSION 3.2)
px4_add_git_submodule(TARGET git_nuttx PATH "nuttx")
px4_add_git_submodule(TARGET git_nuttx_apps PATH "apps")
if(NOT PX4_BOARD)
message(FATAL_ERROR "PX4_BOARD must be set (eg px4_fmu-v2)")
endif()
project(NuttX_${PX4_BOARD} LANGUAGES ASM C CXX)
if (CMAKE_HOST_APPLE OR CMAKE_HOST_WIN32)
# copy with rsync and create file dependencies
@ -24,46 +14,49 @@ else()
set(cp_opts "-aRfl")
endif()
file(GLOB_RECURSE copy_nuttx_files
LIST_DIRECTORIES false
${CMAKE_CURRENT_SOURCE_DIR}/nuttx/*)
file(GLOB_RECURSE copy_apps_files
LIST_DIRECTORIES false
${CMAKE_CURRENT_SOURCE_DIR}/apps/*)
set(NUTTX_CONFIG_DIR ${PX4_BOARD_DIR}/nuttx-config)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Make.defs.in ${NUTTX_DIR}/Make.defs)
# copy nuttx to build directory
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/nuttx)
###############################################################################
# NuttX: copy to build directory
###############################################################################
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${NUTTX_SRC_DIR}/nuttx)
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp
# setup custom command to copy changes later
file(GLOB_RECURSE copy_nuttx_files LIST_DIRECTORIES false ${NUTTX_SRC_DIR}/nuttx/*)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp
COMMAND ${cp_cmd} ${cp_opts} ${CP_SRC} ${CP_DST}
COMMAND cmake -E touch ${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp
DEPENDS ${copy_nuttx_files} git_nuttx
COMMENT "Copying NuttX/nuttx to ${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "Copying NuttX/nuttx to ${CP_DST}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
)
# copy apps to build directory
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/apps)
###############################################################################
# NuttX apps: copy to build directory
###############################################################################
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${NUTTX_SRC_DIR}/apps)
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
# setup custom command to copy changes later
file(GLOB_RECURSE copy_apps_files LIST_DIRECTORIES false ${NUTTX_SRC_DIR}/apps/*)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
COMMAND ${cp_cmd} ${cp_opts} ${CP_SRC} ${CP_DST}
COMMAND cmake -E touch ${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
DEPENDS ${copy_apps_files} git_nuttx_apps
COMMENT "Copying NuttX/apps to ${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "Copying NuttX/apps to ${CP_DST}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
)
set(APPS_DIR ${CMAKE_CURRENT_BINARY_DIR}/apps)
# If the board provides a Kconfig Use it or create an empty one
if(EXISTS ${NUTTX_CONFIG_DIR}/Kconfig)
add_custom_command(
OUTPUT ${NUTTX_DIR}/configs/dummy/Kconfig
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/Kconfig ${NUTTX_DIR}/configs/dummy/Kconfig
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_CONFIG_DIR}/Kconfig ${NUTTX_DIR}/configs/dummy/Kconfig
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/nuttx_copy.stamp
${CMAKE_CURRENT_BINARY_DIR}/apps_copy.stamp
@ -78,8 +71,9 @@ else()
)
endif()
# copy PX4 board config into nuttx
file(STRINGS ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig config_expanded REGEX "# Automatically generated file; DO NOT EDIT.")
###############################################################################
# NuttX configure
###############################################################################
if ("x${config_expanded}" STREQUAL "x")
# copy PX4 board Compressed config into nuttx and inflate it
@ -87,22 +81,20 @@ if ("x${config_expanded}" STREQUAL "x")
OUTPUT
${NUTTX_DIR}/.config
${NUTTX_DIR}/arch/arm/include/math.h
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig ${NUTTX_DIR}/.config
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_DEFCONFIG} ${NUTTX_DIR}/.config
COMMAND kconfig-tweak --set-str CONFIG_APPS_DIR "../apps"
COMMAND ${CMAKE_COMMAND} -E remove -f ${NUTTX_DIR}/include/nuttx/config.h
COMMAND ${CMAKE_COMMAND} -E remove_directory ${NUTTX_DIR}/configs/${PX4_BOARD}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NUTTX_CONFIG_DIR}/ ${CMAKE_CURRENT_BINARY_DIR}/nuttx-config
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/nuttx-config/src
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/math.h ${NUTTX_DIR}/arch/arm/include/ # copy arm math.h into NuttX source
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/nsh_romfsimg.h ${CMAKE_CURRENT_BINARY_DIR}/nuttx-config/include/
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NUTTX_CONFIG_DIR}/ ${PX4_BINARY_DIR}/NuttX/nuttx-config
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/NuttX/nuttx-config/src
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_SRC_DIR}/math.h ${NUTTX_DIR}/arch/arm/include/math.h # copy arm math.h into NuttX source
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_SRC_DIR}/nsh_romfsimg.h ${PX4_BINARY_DIR}/NuttX/nuttx-config/include/nsh_romfsimg.h
COMMAND make --no-print-directory --silent -C ${NUTTX_DIR} CONFIG_ARCH_BOARD_CUSTOM=y olddefconfig
DEPENDS
${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig
${NUTTX_CONFIG_DIR}/include/board.h
${NUTTX_CONFIG_DIR}/scripts/ld.script
${NUTTX_DIR}/configs/dummy/Kconfig
${CMAKE_CURRENT_SOURCE_DIR}/math.h
${CMAKE_CURRENT_SOURCE_DIR}/nsh_romfsimg.h
${NUTTX_SRC_DIR}/math.h
${NUTTX_SRC_DIR}/nsh_romfsimg.h
WORKING_DIRECTORY ${NUTTX_DIR}
COMMENT "Copying NuttX config ${NUTTX_CONFIG} and configuring"
)
@ -114,7 +106,6 @@ else()
${NUTTX_DIR}/arch/arm/include/math.h
COMMAND ${CMAKE_COMMAND} -E copy ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig ${NUTTX_DIR}/.config
COMMAND ${CMAKE_COMMAND} -E remove -f ${NUTTX_DIR}/include/nuttx/config.h
COMMAND ${CMAKE_COMMAND} -E remove_directory ${NUTTX_DIR}/configs/${PX4_BOARD}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NUTTX_CONFIG_DIR}/ ${CMAKE_CURRENT_BINARY_DIR}/nuttx-config
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/nuttx-config/src
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/math.h ${NUTTX_DIR}/arch/arm/include/ # copy arm math.h into NuttX source
@ -133,6 +124,12 @@ else()
)
endif()
###############################################################################
# NuttX build
###############################################################################
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Make.defs.in ${NUTTX_DIR}/Make.defs)
# verbose build settings (V=1 or VERBOSE=1)
option(PX4_NUTTX_VERBOSE "PX4 NuttX verbose build" off)
@ -277,11 +274,9 @@ add_custom_target(olddefconfig
USES_TERMINAL
)
# menuconfig helper
add_custom_target(menuconfig
COMMAND make --no-print-directory --silent -C ${NUTTX_DIR} CONFIG_ARCH_BOARD=${PX4_BOARD} menuconfig
COMMAND cp ${NUTTX_DIR}/.config ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig
DEPENDS ${NUTTX_DIR}/.config
WORKING_DIRECTORY ${NUTTX_DIR}
COMMENT "Running NuttX make menuconfig for ${NUTTX_CONFIG}"
@ -291,52 +286,38 @@ add_custom_target(menuconfig
# qconfig helper
add_custom_target(qconfig
COMMAND make --no-print-directory --silent -C ${NUTTX_DIR} CONFIG_ARCH_BOARD=${PX4_BOARD} qconfig
COMMAND cp .config ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig
DEPENDS ${NUTTX_DIR}/.config
WORKING_DIRECTORY ${NUTTX_DIR}
COMMENT "Running NuttX make qconfig for ${NUTTX_CONFIG}"
USES_TERMINAL
)
# savedefconfig helper needs apps Kconfig
add_custom_target(apps_kconfig
COMMAND
TOPDIR=${NUTTX_APPS_DIR} make ${nuttx_build_options} --no-print-directory -C platform board TOPDIR="${NUTTX_DIR}" APPDIR="${NUTTX_APPS_DIR}"
COMMAND
TOPDIR=${NUTTX_APPS_DIR} make ${nuttx_build_options} --no-print-directory Kconfig ${nuttx_build_output}
DEPENDS
${NUTTX_DIR}/configs/dummy/Kconfig
WORKING_DIRECTORY ${NUTTX_APPS_DIR}
COMMENT "Running Kconfig Build on Apps"
)
# savedefconfig helper
add_custom_target(savedefconfig
COMMAND
APPSDIR=${NUTTX_APPS_DIR} kconfig-conf --savedefconfig defconfig.tmp ${NUTTX_DIR}/Kconfig
COMMAND
sed -i -e "/CONFIG_APPS_DIR=/d" defconfig.tmp # remove CONFIG_APPS_DIR
COMMAND
grep "CONFIG_ARCH=" .config >> defconfig.tmp || true # preserve CONFIG_ARCH=
COMMAND
grep "^CONFIG_ARCH_CHIP_" .config >> defconfig.tmp || true # preserve CONFIG_ARCH_CHIP_
COMMAND
grep "^CONFIG_ARCH_CHIP=" .config >> defconfig.tmp || true # PX4 Build preserve CONFIG_ARCH_CHIP=
COMMAND
grep "^CONFIG_ARCH_FAMILY=" .config >> defconfig.tmp || true # PX4 Build preserve CONFIG_ARCH_FAMILY
COMMAND
grep "CONFIG_ARCH_BOARD=" .config >> defconfig.tmp || true # preserve CONFIG_ARCH_BOARD
COMMAND
grep "^CONFIG_ARCH_CUSTOM" .config >> defconfig.tmp || true # preserve CONFIG_ARCH_CUSTOM
COMMAND
cat defconfig.tmp | LC_ALL=C sort | uniq > defconfig.updated # sort and save back to original defconfig
COMMAND
${CMAKE_COMMAND} -E copy_if_different defconfig.updated ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig
COMMAND
${CMAKE_COMMAND} -E remove -f defconfig.tmp defconfig.updated # cleanup
DEPENDS
apps_kconfig
${NUTTX_DIR}/.config
COMMAND make --no-print-directory --silent -C ${NUTTX_DIR} CONFIG_ARCH_BOARD=${PX4_BOARD} savedefconfig
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_DIR}/defconfig ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig
DEPENDS ${NUTTX_DIR}/.config
COMMENT "Compressing .config and saving back to ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig"
WORKING_DIRECTORY ${NUTTX_DIR}
)
# menuconfig and save
add_custom_target(menuconfig_save
COMMAND
${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} -- savedefconfig # this is hacky, but forces menuconfig to run before savedefconfig
DEPENDS menuconfig
)
# oldconfig and save
add_custom_target(oldconfig_save
COMMAND
${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} -- savedefconfig # this is hacky, but forces oldconfig to run before savedefconfig
DEPENDS oldconfig
)
# qconfig and save
add_custom_target(qconfig_save
COMMAND
${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} -- savedefconfig # this is hacky, but forces qconfig to run before savedefconfig
DEPENDS qconfig
)

View File

@ -0,0 +1,114 @@
if(NOT PX4_BOARD)
message(FATAL_ERROR "PX4_BOARD must be set (eg px4_fmu-v2)")
endif()
if(NOT PX4_BINARY_DIR)
message(FATAL_ERROR "PX4_BINARY_DIR must be set")
endif()
if(NOT PX4_BOARD_DIR)
message(FATAL_ERROR "PX4_BOARD_DIR must be set")
endif()
set(NUTTX_CONFIG_DIR ${PX4_BOARD_DIR}/nuttx-config CACHE FILEPATH "PX4 NuttX config" FORCE)
set(NUTTX_SRC_DIR ${CMAKE_CURRENT_LIST_DIR}/../NuttX)
set(NUTTX_DIR ${PX4_BINARY_DIR}/NuttX/nuttx CACHE FILEPATH "NuttX directory" FORCE)
set(NUTTX_APPS_DIR ${PX4_BINARY_DIR}/NuttX/apps CACHE FILEPATH "NuttX apps directory" FORCE)
px4_add_git_submodule(TARGET git_nuttx PATH "${NUTTX_SRC_DIR}/nuttx")
px4_add_git_submodule(TARGET git_nuttx_apps PATH "${NUTTX_SRC_DIR}/apps")
if (CMAKE_HOST_APPLE OR CMAKE_HOST_WIN32)
# copy with rsync and create file dependencies
set(cp_cmd "rsync")
set(cp_opts)
list(APPEND cp_opts
-rp
--inplace
)
else()
# copy with hard links
# archive, recursive, force, link (hardlinks)
set(cp_cmd "cp")
set(cp_opts "-aRfl")
endif()
###############################################################################
# NuttX: copy to build directory
###############################################################################
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${NUTTX_SRC_DIR}/nuttx)
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
# copy during cmake configure
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${NUTTX_DIR})
execute_process(COMMAND ${cp_cmd} ${cp_opts} ${CP_SRC} ${CP_DST} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
###############################################################################
# NuttX apps: copy to build directory
###############################################################################
file(RELATIVE_PATH CP_SRC ${CMAKE_SOURCE_DIR} ${NUTTX_SRC_DIR}/apps)
file(RELATIVE_PATH CP_DST ${CMAKE_SOURCE_DIR} ${PX4_BINARY_DIR}/NuttX)
# copy during cmake configure
execute_process(COMMAND ${cp_cmd} ${cp_opts} ${CP_SRC} ${CP_DST} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
###############################################################################
# nuttx-config: copy to build directory
###############################################################################
set(NUTTX_DEFCONFIG ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig CACHE FILEPATH "path to defconfig" FORCE)
# If the board provides a Kconfig Use it or create an empty one
if(EXISTS ${NUTTX_CONFIG_DIR}/Kconfig)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_CONFIG_DIR}/Kconfig ${NUTTX_DIR}/configs/dummy/Kconfig)
else()
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${NUTTX_DIR}/configs/dummy/Kconfig)
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/NuttX/nuttx-config/src
COMMAND ${CMAKE_COMMAND} -E copy_directory ${NUTTX_CONFIG_DIR}/ ${PX4_BINARY_DIR}/NuttX/nuttx-config
)
# NuttX extra files
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_SRC_DIR}/math.h ${NUTTX_DIR}/arch/arm/include/math.h) # copy arm math.h into NuttX source
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_SRC_DIR}/nsh_romfsimg.h ${PX4_BINARY_DIR}/NuttX/nuttx-config/include/nsh_romfsimg.h)
# copy defconfig
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NUTTX_DEFCONFIG} ${NUTTX_DIR}/.config)
# copy PX4 board config into nuttx
file(STRINGS ${NUTTX_CONFIG_DIR}/${NUTTX_CONFIG}/defconfig config_expanded REGEX "# Automatically generated file; DO NOT EDIT.")
if ("x${config_expanded}" STREQUAL "x")
execute_process(COMMAND kconfig-tweak --set-str CONFIG_APPS_DIR "../apps" WORKING_DIRECTORY ${NUTTX_DIR})
execute_process(COMMAND make --no-print-directory --silent -C ${NUTTX_DIR} CONFIG_ARCH_BOARD_CUSTOM=y olddefconfig WORKING_DIRECTORY ${NUTTX_DIR})
endif()
###############################################################################
# NuttX cmake defconfig
###############################################################################
# parse nuttx config options for cmake
file(STRINGS ${NUTTX_DIR}/.config ConfigContents)
foreach(NameAndValue ${ConfigContents})
# Strip leading spaces
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
# Find variable name
string(REGEX MATCH "^CONFIG[^=]+" Name ${NameAndValue})
if (Name)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
# remove extra quotes
string(REPLACE "\"" "" Value ${Value})
# Set the variable
#message(STATUS "${Name} ${Value}")
set(${Name} ${Value} CACHE INTERNAL "NUTTX DEFCONFIG: ${Name}" FORCE)
endif()
endforeach()

View File

@ -125,25 +125,4 @@ function(px4_os_prebuild_targets)
target_link_libraries(prebuild_targets INTERFACE nuttx_xx nuttx_c nuttx_fs nuttx_mm nuttx_sched m gcc)
add_dependencies(prebuild_targets DEPENDS nuttx_context uorb_headers)
# parse nuttx config options for cmake
file(STRINGS ${PX4_BOARD_DIR}/nuttx-config/${NUTTX_CONFIG}/defconfig ConfigContents)
foreach(NameAndValue ${ConfigContents})
# Strip leading spaces
string(REGEX REPLACE "^[ ]+" "" NameAndValue ${NameAndValue})
# Find variable name
string(REGEX MATCH "^CONFIG[^=]+" Name ${NameAndValue})
if (Name)
# Find the value
string(REPLACE "${Name}=" "" Value ${NameAndValue})
# remove extra quotes
string(REPLACE "\"" "" Value ${Value})
# Set the variable
#message(STATUS "${Name} ${Value}")
set(${Name} ${Value} CACHE INTERNAL "NUTTX DEFCONFIG: ${Name}" FORCE)
endif()
endforeach()
endfunction()

View File

@ -34,7 +34,7 @@
# common board drivers (currently only for nuttx fmu boards)
if ((${PX4_PLATFORM} MATCHES "nuttx") AND NOT ${PX4_BOARD} MATCHES "io")
px4_add_library(drivers_boards_common
add_library(drivers_boards_common
board_crashdump.c
board_dma_alloc.c
board_gpio_init.c

View File

@ -1,8 +1,6 @@
#ifdef CONFIG_BOARD_CRASHDUMP
#include <px4_config.h>
#include <px4_log.h>
#include <px4_tasks.h>
#include <board_config.h>
#include <stdio.h>
#include <stdbool.h>
@ -67,8 +65,8 @@ int board_hardfault_init(int display_to_console, bool allow_prompt)
if (hadCrash == OK) {
PX4_ERR("[boot] There is a hard fault logged. Hold down the SPACE BAR," \
" while booting to review!\n");
syslog(LOG_ERR, "[boot] There is a hard fault logged. Hold down the SPACE BAR," \
" while booting to review!\n");
/* Yes. So add one to the boot count - this will be reset after a successful
* commit to SD
@ -104,9 +102,9 @@ int board_hardfault_init(int display_to_console, bool allow_prompt)
hardfault_write("boot", fileno(stdout), HARDFAULT_DISPLAY_FORMAT, false);
}
PX4_ERR("[boot] There were %d reboots with Hard fault that were not committed to disk%s\n",
reboots,
(bytesWaiting == 0 ? "" : " - Boot halted Due to Key Press\n"));
syslog(LOG_ERR, "[boot] There were %d reboots with Hard fault that were not committed to disk%s\n",
reboots,
(bytesWaiting == 0 ? "" : " - Boot halted Due to Key Press\n"));
/* For those of you with a debugger set a break point on up_assert and
@ -155,9 +153,9 @@ int board_hardfault_init(int display_to_console, bool allow_prompt)
break;
} // Inner Switch
PX4_INFO("\nEnter B - Continue booting\n" \
"Enter C - Clear the fault log\n" \
"Enter D - Dump fault log\n\n?>");
syslog(LOG_INFO, "\nEnter B - Continue booting\n" \
"Enter C - Clear the fault log\n" \
"Enter D - Dump fault log\n\n?>");
fflush(stdout);
read:

View File

@ -55,7 +55,7 @@ CDev::CDev(const char *devname) :
int ret = px4_sem_init(&_lock, 0, 1);
if (ret != 0) {
PX4_ERR("SEM INIT FAIL: ret %d", ret);
PX4_DEBUG("SEM INIT FAIL: ret %d", ret);
}
}

View File

@ -31,26 +31,30 @@
#
############################################################################
# this includes the generated topics directory
include_directories(${CMAKE_CURRENT_BINARY_DIR})
px4_add_module(
MODULE modules__uORB
MAIN uorb
STACK_MAIN 2100
SRCS
Publication.cpp
Subscription.cpp
uORB.cpp
uORBDeviceMaster.cpp
uORBDeviceNode.cpp
uORBMain.cpp
uORBManager.cpp
uORBUtils.cpp
DEPENDS
uorb_msgs
)
if(PX4_TESTING)
add_subdirectory(uORB_tests)
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})
px4_add_module(
MODULE modules__uORB
MAIN uorb
STACK_MAIN 2100
SRCS
Publication.cpp
Subscription.cpp
uORB.cpp
uORBDeviceMaster.cpp
uORBDeviceNode.cpp
uORBMain.cpp
uORBManager.cpp
uORBUtils.cpp
DEPENDS
cdev
uorb_msgs
)
if(PX4_TESTING)
add_subdirectory(uORB_tests)
endif()
endif()

View File

@ -39,12 +39,17 @@ if (NOT "${PX4_PLATFORM}" MATCHES "qurt" AND NOT "${PX4_BOARD}" MATCHES "io-v2")
)
endif()
px4_add_library(px4_platform
add_library(px4_platform
module.cpp
px4_getopt.c
px4_cli.cpp
shutdown.cpp
${SRCS}
)
add_dependencies(px4_platform prebuild_targets)
if (NOT "${PX4_PLATFORM}" MATCHES "qurt" AND NOT "${PX4_BOARD}" MATCHES "io-v2")
target_link_libraries(px4_platform PRIVATE modules__uORB) # px4_log awkward dependency with uORB, TODO: orb should part of the platform layer
endif()
add_subdirectory(work_queue)

View File

@ -36,6 +36,10 @@
* Implementation of the API declared in px4_module.h.
*/
#ifndef MODULE_NAME
#define MODULE_NAME "module"
#endif
#include <px4_module.h>
#include <px4_log.h>

View File

@ -33,6 +33,11 @@
#include <parameters/param.h>
#include <px4_cli.h>
#ifndef MODULE_NAME
#define MODULE_NAME "cli"
#endif
#include <px4_log.h>
#include <cstring>

View File

@ -36,6 +36,10 @@
#include <stdlib.h>
#include <string.h>
#ifndef MODULE_NAME
#define MODULE_NAME "log"
#endif
#include <px4_log.h>
#if defined(__PX4_POSIX)
#if !defined(__PX4_CYGWIN)

View File

@ -37,10 +37,17 @@
*/
#include <board_config.h>
#include <px4_log.h>
#include <px4_workqueue.h>
#include <px4_shutdown.h>
#include <px4_tasks.h>
#ifndef MODULE_NAME
#define MODULE_NAME "shutdown"
#endif
#include <px4_log.h>
#include <stdint.h>
#include <errno.h>
#include <pthread.h>