Hello World!


This tutorial will make you familiar with main steps required to build your application

PX4, as any other firmware, has got its own rules:

  • Programs can be written in C++ or C
  • Programs are not standalone, but built into firmware
  • Communication between apps (listening to events, publishing your events) is done only via uORB mechanism

File setup

  • Open Eclipse IDE
  • In Eclipse's source viewer find src/modules
  • Create folder px4_simple_app
  • Create a new file named module.mk
  • Add this content:
MODULE_COMMAND = px4_simple_app
SRCS = px4_simple_app.c


  • Create a new C file named px4_simple_app.c in the px4_simple_app folder
  • Add this content:
* @file px4_simple_app.c
* Minimal application example for PX4 autopilot.
#include <nuttx/config.h>
#include <stdio.h>
#include <errno.h>
__EXPORT int px4_simple_app_main(int argc, char *argv[]);
int px4_simple_app_main(int argc, char *argv[])
printf("Hello Sky!\n");
return OK;

Register application

To enable the compilation of the application into the firmware, add it to the list of modules to build

MODULES += modules/px4_simple_app


  • Start → All Programs → PX4 Toolchain → PX4 Console
  • If app has already been registered (incremental build), enter:
make px4fmu-v2_default


  • Start → All Programs → PX4 Toolchain → PX4 Console
  • Type:
make px4fmu-v2_default upload
  • Reset the board. Before resetting, this output will be shown:
Generating /Users/user/src/Firmware/Images/px4fmu.px4
Loaded firmware for 5,0, waiting for the bootloader...

Once the board is reset, this output will be shown:

Found board 5,0 on /dev/tty.usbmodem1
done, rebooting.

Run application

  • Open NSH console. It should look like this:
  • Type px4_simple_app
  • Hit Enter:
nsh> px4_simple_app
Hello Sky!

The application is now correctly registered with the system and can be extended to actually perform useful tasks.

Translations of this page:

Quick Links

QR Code: URL of current page