How to build Firmware for px4fmu-v2_default using Qt Creator in Linux?

Hi guys,
How do we build Firmware for px4fmu-v2_default using Qt Creator in Linux? I followed the instruction at Ran
cd ~/src/Firmware
mkdir …/Firmware-build
cd …/Firmware-build
cmake …/Firmware -G “CodeBlocks - Unix Makefiles”
Then made a build. But it build for target posix only. There is no target px4fmu-v2_default in the Makefile.

1 Like

If you just do a “make px4fmu-v2_default” in the main Firmware folder, it will make a build directory there.

Bart, you are talking about building from command line. But I really want to build in Qt Creator since I am modifying the code in IDE and want to see the build result from there right away.

In that case, just open the CMakeLists.txt in QtCreator

From the manual:

Then load the CMakeLists.txt in the root firmware folder via File ->
Open File or Project -> Select the CMakeLists.txt file.

That’s what I did. But Qt Creator makes posix build by default. I want to build for px4fmu-v2_default. How can I change target/platform in Qt Creator?

Go to the projects tab and in the cmake settings, change CONFIG to nuttx_px4fmu-v2_default

I don’t have CONFIG. See following screen shot.

BTW, how to run cmake for nuttx_px4fmu-v2_default? I am not familiar with cmake. Is following command just used to build for posix? What options need to give to cmake for nuttx build?

cmake …/Firmware -G “CodeBlocks - Unix Makefiles”

maybe you can try a new version of Qt creator,and you will find CONFIG.

First run a make px4fmu-v2_default in your Firmware Folder. That would generate the folder build_px4fmu-v2_default.

Change the Build directory in QT directly to Firmware/build_px4fmu-v2_default
You also have to change the PATH under Build Environment like it is shown in the tutorial video.

1 Like

I have the same problem as you and i was wondering whether you have solve the problem.

1 Like

With the instructions in this page I can only build the posix target. I tried the other suggestions mentioned above but they didn’t work (I tried Qt Creator 3.5.1 and 4.4.1).

I’m sure this is not the right way to do it, but this is what I did to make it work:
-made the following change to Firmware/Makefile
PX4_CMAKE_GENERATOR := “Unix\ Makefiles” --> PX4_CMAKE_GENERATOR := “CodeBlocks\ -\ Unix\ Makefiles”
-built the target from the command line: make px4fmu-v2_default
-opened Firmware/CMakeLists.txt with Qt Creator 3.5.1
-when asked for the build location, changed it to Firmware/build/px4fmu-v2_default
-clicked Next and then Finish

It would be nice if someone could update the documentation with the appropriate instructions for the current Qt Creator version and without this hack I did changing Makefile

1 Like

Hello! I found solution for Pixhawk 2.1. Maybe it can work for you: