Work on px4io firmware building.

This commit is contained in:
James Goppert
2015-09-12 05:26:31 -04:00
parent be45c2e0a9
commit 676a3d230c
15 changed files with 276 additions and 128 deletions

View File

@@ -103,7 +103,7 @@ function(px4_parse_function_args)
endif()
foreach(arg ${IN_REQUIRED})
if (NOT OUT_${arg})
message(FATAL_ERROR "${IN_NAME} requires argument ${arg}, ARGN: ${IN_ARGN}")
message(FATAL_ERROR "${IN_NAME} requires argument ${arg}\nARGN: ${IN_ARGN}")
endif()
endforeach()
foreach(arg ${IN_OPTIONS} ${IN_ONE_VALUE} ${IN_MULTI_VALUE})
@@ -593,25 +593,25 @@ function(px4_add_common_flags)
)
set(added_include_dirs
src
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src
src/modules
src/include
src/lib
src/platforms
${CMAKE_SOURCE_DIR}/src/modules
${CMAKE_SOURCE_DIR}/src/include
${CMAKE_SOURCE_DIR}/src/lib
${CMAKE_SOURCE_DIR}/src/platforms
# TODO Build/versioning was in Makefile,
# do we need this, how does it work with cmake
src/drivers/boards/${BOARD}
${CMAKE_SOURCE_DIR}/src/drivers/boards/${BOARD}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/src/modules/px4_messages
${CMAKE_BINARY_DIR}/src/modules
mavlink/include/mavlink
${CMAKE_SOURCE_DIR}/mavlink/include/mavlink
)
if (NOT ${OS} STREQUAL "qurt")
list(APPEND added_include_dirs
src/lib/eigen
${CMAKE_SOURCE_DIR}/src/lib/eigen
)
endif()

View File

@@ -165,6 +165,18 @@ set(config_extra_builtin_cmds
sercon
)
set(config_io_board
px4io-v2
)
set(config_extra_libs
${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a
)
set(config_io_extra_libs
${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM3l_math.a
)
add_custom_target(sercon)
set_target_properties(sercon PROPERTIES
MAIN "sercon" STACK "2048")

View File

@@ -3,7 +3,6 @@ include(nuttx/px4_impl_nuttx)
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake)
set(config_module_list
#
# Board support modules
#
@@ -127,6 +126,18 @@ set(config_extra_builtin_cmds
sercon
)
set(config_io_board
px4io-v2
)
set(config_extra_libs
${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a
)
set(config_io_extra_libs
${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM3l_math.a
)
add_custom_target(sercon)
set_target_properties(sercon PROPERTIES
MAIN "sercon" STACK "2048")

View File

@@ -5,16 +5,16 @@ message(WARNING "this is a work in progress and doesn't build yet")
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake)
set(config_module_list
platforms/nuttx
platforms/nuttx/px4_layer
#platforms/nuttx
#platforms/nuttx/px4_layer
platforms/common
drivers/led
#drivers/led
drivers/device
modules/systemlib
modules/uORB
examples/px4_simple_app
lib/mathlib/math/filter
lib/conversion
#modules/systemlib
#modules/uORB
#examples/px4_simple_app
#lib/mathlib/math/filter
#lib/conversion
)
set(config_firmware_options
@@ -22,15 +22,4 @@ set(config_firmware_options
)
set(config_extra_builtin_cmds
serdis
sercon
)
add_custom_target(sercon)
set_target_properties(sercon PROPERTIES
MAIN "sercon" STACK "2048")
add_custom_target(serdis)
set_target_properties(serdis PROPERTIES
MAIN "serdis" STACK "2048")

View File

@@ -61,6 +61,7 @@ include(common/px4_base)
#
# Input:
# EXE : the executable to generate the firmware from
# BOARD : the board
#
# Options:
# PARAM_XML : toggles generation of param_xml
@@ -74,9 +75,9 @@ include(common/px4_base)
function(px4_nuttx_add_firmware)
px4_parse_function_args(
NAME px4_nuttx_add_firmware
ONE_VALUE OUT EXE
ONE_VALUE BOARD OUT EXE
OPTIONS PARAM_XML
REQUIRED EXE
REQUIRED OUT EXE BOARD
ARGN ${ARGN})
set(process_params ${CMAKE_SOURCE_DIR}/Tools/px_process_params.py)
@@ -111,7 +112,7 @@ function(px4_nuttx_add_firmware)
DEPENDS ${EXE}
)
endif()
add_custom_target(build_firmware ALL DEPENDS ${OUT})
add_custom_target(build_firmware_${BOARD} ALL DEPENDS ${OUT})
endfunction()
#=============================================================================
@@ -246,14 +247,14 @@ function(px4_nuttx_add_export)
DEPENDS ${DEPENDS} __nuttx_copy_${CONFIG})
# extract
add_custom_command(OUTPUT nuttx_export_${BOARD}.stamp
add_custom_command(OUTPUT nuttx_export_${CONFIG}.stamp
COMMAND ${RM} -rf ${nuttx_src}/nuttx-export
COMMAND ${UNZIP} ${BOARD}.export -d ${nuttx_src}
COMMAND ${TOUCH} nuttx_export_${BOARD}.stamp
DEPENDS ${DEPENDS} ${BOARD}.export)
COMMAND ${UNZIP} ${CONFIG}.export -d ${nuttx_src}
COMMAND ${TOUCH} nuttx_export_${CONFIG}.stamp
DEPENDS ${DEPENDS} ${CONFIG}.export)
add_custom_target(${OUT}
DEPENDS nuttx_export_${BOARD}.stamp)
DEPENDS nuttx_export_${CONFIG}.stamp)
endfunction()
@@ -406,17 +407,24 @@ function(px4_os_add_flags)
set(added_exe_linker_flags) # none currently
if ("${BOARD}" STREQUAL "px4fmu-v2")
set(arm_build_flags
set(cpu_flags)
if (${BOARD} STREQUAL "px4fmu-v2")
set(cpu_flags
-mcpu=cortex-m4
-mthumb
-march=armv7e-m
-mfpu=fpv4-sp-d16
-mfloat-abi=hard
)
list(APPEND c_flags ${arm_build_flags})
list(APPEND cxx_flags ${arm_build_flags})
elseif (${BOARD} STREQUAL "px4io-v2")
set(cpu_flags
-mcpu=cortex-m3
-mthumb
-march=armv7-m
)
endif()
list(APPEND c_flags ${cpu_flags})
list(APPEND cxx_flags ${cpu_flags})
# output
foreach(var ${inout_vars})
@@ -455,11 +463,11 @@ function(px4_os_prebuild_targets)
ONE_VALUE OUT BOARD THREADS
REQUIRED OUT BOARD
ARGN ${ARGN})
px4_nuttx_add_export(OUT nuttx_export
px4_nuttx_add_export(OUT nuttx_export_${BOARD}
CONFIG ${BOARD}
THREADS ${THREADS}
DEPENDS git_nuttx)
add_custom_target(${OUT} DEPENDS nuttx_export)
add_custom_target(${OUT} DEPENDS nuttx_export_${BOARD})
endfunction()
# vim: set noet fenc=utf-8 ff=unix nowrap:

View File

@@ -46,7 +46,7 @@ foreach(tool objcopy nm ld)
endforeach()
# os tools
foreach(tool echo patch grep rm mkdir nm genromfs awk cp touch make unzip)
foreach(tool echo patch grep rm mkdir nm genromfs cp touch make unzip)
string(TOUPPER ${tool} TOOL)
find_program(${TOOL} ${tool})
if(NOT ${TOOL})

View File

@@ -46,7 +46,7 @@ foreach(tool objcopy nm ld gdb)
endforeach()
# os tools
foreach(tool echo patch grep rm mkdir nm genromfs awk cp touch make unzip)
foreach(tool echo patch grep rm mkdir nm genromfs cp touch make unzip)
string(TOUPPER ${tool} TOOL)
find_program(${TOOL} ${tool})
if(NOT ${TOOL})

View File

@@ -8,7 +8,7 @@ foreach(tool nm ld)
endforeach()
# os tools
foreach(tool echo patch grep rm mkdir nm genromfs awk cp touch make unzip)
foreach(tool echo patch grep rm mkdir nm genromfs cp touch make unzip)
string(TOUPPER ${tool} TOOL)
find_program(${TOOL} ${tool})
if(NOT ${TOOL})