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

* https://pixhawk.org/dev/bootloader_update#updating_the_onboard_bootloader

## 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…

## Links

* http://www.megapirateng.com/2014/02/f4by-entering-32bit-world/

/home/share/www/redox.ws/wiki/data/pages/rc/sw/fc/px4/build_from_source.txt · Last modified: 2023/11/24 21:55 by 127.0.0.1