weixin_39966602
weixin_39966602
2021-01-10 10:00

NuttX cmake generate Make.defs from PX4

Each nuttx-config's Make.defs is nearly identical except for architecture specific compiler flags which PX4 cmake already has. We can generate this file for each nuttx-config, inheriting the cpu flags from PX4. Additional NuttX flags can be added to nuttx-configs/Make.defs.in.

TODO: test on windows

该提问来源于开源项目:PX4/PX4-Autopilot

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39793553 weixin_39793553 3月前

    Late to the party. Broke it like I wrote here.

    Just for reference the first error is:

    
    [21/902] Building CXX object src/modules/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/src/driver/uc_can.cpp.obj
    FAILED: src/modules/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/src/driver/uc_can.cpp.obj
    /cygdrive/c/PX4/toolchain/gcc-arm-none-eabi-5_4-2016q3-20160926-win32/bin/arm-none-eabi-g++.exe   -DBUILD_URI=localhost -DCONFIG_ARCH_BOARD_PX4FMU_V4 -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 -DUAVCAN_MEM_POOL_BLOCK_SIZE=48 -DUAVCAN_NO_ASSERTIONS -DUAVCAN                        _PLATFORM=stm32 -DUAVCAN_STM32_NUM_IFACES=1 -DUAVCAN_STM32_NUTTX=1 -DUAVCAN_STM32_TIMER_NUMBER=5 -D__DF_NUTTX -D__PX4_NUTTX -D__STDC_FORMAT_MACROS -I. -Isrc -Isrc/modules -I../../src -I../../src/drivers/boards/px4fmu-v4 -I../../src/include -I../..                        /src/lib -I../../src/lib/DriverFramework/framework/include -I../../src/lib/matrix -I../../src/modules -I../../src/platforms -INuttX/nuttx/arch/arm/src/armv7-m -INuttX/nuttx/arch/arm/src/chip -INuttX/nuttx/arch/arm/src/common -INuttX/nuttx/include                         -INuttX/nuttx/include/cxx -I../../platforms/nuttx/NuttX/apps/include -Iexternal/Install/include -I../../src/modules/uavcan/libuavcan/./libuavcan/include -I../../src/modules/uavcan/libuavcan/./libuavcan/include/dsdlc_generated -I../../src/modules/u                        avcan/libuavcan/libuavcan/include/dsdlc_generated -I../../src/modules/uavcan/libuavcan/libuavcan/include -fno-common -ffunction-sections -fdata-sections -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fno-common -ffunct                        ion-sections -fdata-sections -g -fno-exceptions -fno-rtti -std=gnu++11 -fno-threadsafe-statics -DCONFIG_WCHAR_BUILTIN -D__CUSTOM_FILE_IO__ -fcheck-new -Wall -Warray-bounds -Wdisabled-optimization -Werror -Wextra -Wfatal-errors -Wfloat-equal -Wform                        at-security -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-field-initializers -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-unused-parameter -Wunused-but-set-variable -Wformat=1 -Wdouble-promotion -Wn                        o-missing-field-initializers -Wno-overloaded-virtual -Wreorder -fvisibility=hidden -include visibility.h -fno-strict-aliasing -fomit-frame-pointer -funsafe-math-optimizations -ffunction-sections -fdata-sections -fno-strength-reduce -fno-builtin-pr                        intf -Wall -Wextra -Wundef -std=c++03 -Wno-variadic-macros -Wno-long-long -Os -DNDEBUG -MD -MT src/modules/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/src/driver/uc_can.cpp.obj -MF src/modules/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/                        src/driver/uc_can.cpp.obj.d -o src/modules/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/src/driver/uc_can.cpp.obj -c ../../src/modules/uavcan/libuavcan/libuavcan/src/driver/uc_can.cpp
    cc1plus.exe: error: NuttX/nuttx/arch/arm/src/chip: not a directory [-Werror]
    compilation terminated due to -Wfatal-errors.
    cc1plus.exe: all warnings being treated as errors
    

    And all the following look exactly the same.

    I'll have a look.

    点赞 评论 复制链接分享
  • weixin_39605296 weixin_39605296 3月前

    or could you give this branch a quick try on your cygwin setup? Any nuttx build will do.

    I don't have a current setup. ?

    点赞 评论 复制链接分享
  • weixin_39966602 weixin_39966602 3月前

    If we ever want to do real native toolchain windows builds this is likely going to have implications for the NuttX side, however we'll be in a much better position to handle the issues sanely from PX4 cmake.

    点赞 评论 复制链接分享
  • weixin_39966602 weixin_39966602 3月前

    or could you give this branch a quick try on your cygwin setup? Any nuttx build will do.

    点赞 评论 复制链接分享

为你推荐