User Tools

Site Tools


rc:sw:fc:px4:build_from_source

 Building from source

Requirements

  • Usual compilation toolchain, arm-none-eabi
  • genromfs
  • python-empy python-pip
  • sudo pip install caktin_pkg

If you want to edit a board config, you also need kconfig-frontends (provided by PX4/NuttX, use the setenv tool =) )

 Build

Using CMake, manual

mkdir build/
cd build/
cmake .. -DCONFIG=nuttx_sparky2_default
make -j2 -l2
make upload

Using the Makefile, auto mode

You need a “recent” CMake (>= 3.3 ). On debian stable, you need to rebuild the package using the sources from testing. Uninstall sdcc before building the package, otherwise one of the tests fails :/

  • make yourboard_default Update the submodules and build the config for yourboard. The available configs are located in cmake/configs/ and your need to check the makefile in / to list the available build targets (which then make calls to the cmake configs)

The “binary” is then available in build_yourboard_default/src/firmware/_os_/

  • make yourboard_default upload Build and upload to the board using the PX4 bootloader

Flash

PX4 Bootloader

make -j2 -l2 sparky2_bl
dfu-util -a 0 -d 0483:df11 -c 1 -i 0 -a 0 -s 0x08000000 -D sparky2_bl.bin

Debug

#openocd -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg
openocd -f Debug/sparky2-board.cfg

# Start GDB
arm-none-eabi-gdb -x Debug/openocd.gdbinit ./build/src/firmware/nuttx/firmware_nuttx

#In GDB:
#tar ext :3333

And debug as usual…

/home/share/www/redox.ws/wiki/data/pages/rc/sw/fc/px4/build_from_source.txt · Last modified: 2019/12/25 15:40 (external edit)