This is an old revision of the document!
# 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
## Recent stable/master/sparky2
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
## Old
* `make help`
Useful to know the available targets
* `make BOARDS=yourtarget menuconfig`
Requires kconfig-mconf, but useful to config NuttX
* `make BOARDS=yourtarget archives`
Build the NuttX OS archive for _yourtarget_
* `make BOARDS=yourtarget yourtarget_default`
Build PX4 for _yourtarget_
* `make BOARDS=yourtarget yourtarget_default upload`
Build PX4 and upload using PX4 Bootloader (USB)
### Combo
make BOARDS=yourtarget archives yourtarget_default upload
If you make any change in the NuttX/, you need to delete everything and start over…
rm -R Archives/ Build/ make BOARDS=yourtarget archives yourtarget_default upload
## Flash
### DFU
* https://pixhawk.org/dev/bootloader_update#updating_the_onboard_bootloader
### PX4 Bootloader
* https://pixhawk.org/dev/nuttx/building_and_flashing_console
## Debug
openocd -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg
In GDB:
tar ext :3333
And debug as usual…
## Links
* http://www.megapirateng.com/2014/02/f4by-entering-32bit-world/