How to build for a new flight controller hardware target?

I am trying to start compiling for a new hardware target by copying px4fmu-v2_default, but get compile errors right off the bat.

My setup is Ubuntu 16.04. The px4fmu-v2_default target builds successfully. I am currently on v1.8.1.

I then:

  • Copy cmake/configs nuttx_px4fmu-v2_default.cmake to the new target: nuttx_px4fmu-custom_default.cmake
  • Copy nuttx-configs/px4fmu-v2/ to nuttx-configs/px4fmu-custom/
  • Copy src/drivers/board/px4fmu-v2/ to src/drivers/boards/px4fmu-custom/
  • Add and commit to git

Now when I run “make px4fmu-custom”:
– PX4 VERSION: v1.8.1-3-g0f242d6
– CONFIG: nuttx_px4fmu-custom_default
– Build Type: MinSizeRel
– The ASM compiler identification is GNU
– Found assembler: /home/parallels/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc
– Found PythonInterp: /usr/bin/python (found version “2.7.12”)
– Found PY_jinja2: /usr/local/lib/python2.7/dist-packages/jinja2
– C compiler: arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
– C++ compiler: arm-none-eabi-g++ (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
– PX4 ECL: Very lightweight Estimation & Control Library v0.9.0-553-g1a11068
– Building and including px4io-v2
– NuttX: px4fmu-custom nsh cortex-m4
– ROMFS: px4fmu_common
– Configuring done
– Generating done
– Build files have been written to: /home/parallels/Documents/Firmware/build/nuttx_px4fmu-custom_default
ninja: Entering directory /home/parallels/Documents/Firmware/build/nuttx_px4fmu-custom_default' [9/639] Building px4io-v2 ninja: Entering directory /home/parallels/Documents/Firmware/build/nuttx_px4io-v2_default’
ninja: no work to do.
[18/639] Generating nuttx/include/nuttx/version.h, nuttx/include/nuttx/config.h
FAILED: cd /home/parallels/Documents/Firmware/build/nuttx_px4fmu-custom_default/NuttX/nuttx && make --quiet --no-print-directory context >nuttx_build.log
make[1]: *** [include/arch/board] Error 1
[18/639] Generating parameters.xml
ninja: build stopped: subcommand failed.
Makefile:154: recipe for target ‘px4fmu-custom_default’ failed
make: *** [px4fmu-custom_default] Error 1

I found this documentation but it doesn’t seem to indicate any additional steps:

Has anyone done something similar lately, or know what I might be doing wrong? I haven’t changed any source code yet, just want a new target to start from.


1 Like

Figured it out, just needed:

  • add .prototype in /platforms/nuttx/Images/
  • change CONFIG_ARCH_BOARD in defconfig
1 Like

Hi Joe, anecdotally (i.e. I have never done a port) you might want to start by copying the fmuv5 structure because that is more indicative of the way things will be moving forward.