Basic PX4 building-steps for STM32 with QT

Hi there, I try to make basic steps for developing of PX4.
At first I done steps, described there
https://dev.px4.io/en/setup/dev_env_linux_ubuntu.html
I launched ubuntu_sim_nuttx.sh and got src/Firmware directory, that is OK
Then next step is
https://dev.px4.io/en/setup/building_px4.html
That says to clone Firmware repository from git.
First question - What difference between Firmware cloned using -git, and Firmware, generated from *.sh script??

So I confused for building target for STM32f4… I read some manuals, that has links to https://pixhawk.org/modules/stm32f4discovery But this page is not available now

Second question - What my next basic steps for generating some example code (*.bin) for stm32f4discovery?
I found some solutions for ArduPilot, but I hope to use clearly PX4

One time I worked with Nuttx directly. But I confused what I need to do for building code for stm32 using PX4

Thanks

First question - What difference between Firmware cloned using -git, and Firmware, generated from *.sh script??

If you already have the Firmware repository cloned using the script, then you don’t need to do git clone again and can just use the existing folder.

If you want to add a new module to PX4 you could check out this: Writing your First Application · PX4 Developer Guide

So I confused for building target for STM32f4… I read some manuals, that has links to https://pixhawk.org/modules/stm32f4discovery But this page is not available now

I suggest you use a Pixhawk or Pixracer or something like that because it will be much easier and most things should work out of the box. If you use the discovery board you need to add support for that board on a much lower level and define the pins and timer that you want to use, etc. Additionally, you will probably the sensors that you need for a drone.

Thanks, i build the pixracer code using command line. (that uses stm32f4 as core) but i have another unsolved thing. Building Nuttx target with QT
I found the same question in :

But this still unsolved for me.
So, how built Nuttx target using QT? I see that QT built
-posix oriented target by default.

Sorry, it seems I solved question for building nuttx target in QT
adding path to Build directory like - “Firmware/build_px4fmu-v4_default”
Now it clearly builts as needed target (Nuttx)
So… generated *.bin is large, but now I try modify project for stm-discovery board and launch test code.

Hi,
i first built px4_fmu-v3 then i did,
cmake …/Firmware -G “CodeBlocks - Unix Makefiles”
Then load the CMakeLists.txt in the root firmware folder via File > Open File or Project (Select the CMakeLists.txt file).

I followed this and imported my project in Qt. I build it. It was successful. When I click on the “play” button as mentioned,
i face the below error:

Starting /home/niran/Firmware/bin/px4…
INFO [px4] assuming working directory is rootfs, no symlinks needed.
ERROR [px4] Error opening startup file, does not exist: etc/init.d/rcS
/home/niran/Firmware/bin/px4 exited with code 255

any pointers how to fix this?
Thank you

Hm… It seems that building folder is invalid, and compiler cannot find rcS, according to your target. I had something similar, but with “clear” Nuttx. Not with PX4. I never tried to compile PX4 with CodeBlocks. But it a good idea.
In QT you need to set valid building folder for target. That will check valid rcS. Dont use cmake …/Firmware… command in terminal. You can do this (cmake) through QT directly. If you still need help, I try it.

1 Like

To start SITL you require more than just running the px4 executable. You need to setup some symlinks, command line arguments, etc…
Usually this is done using make px4_sitl gazebo and this then starts various scripts.

Alternatively, you can start px4 and the simulator separately like described here:
https://dev.px4.io/en/simulation/jmavsim.html#start-jmavsim-and-px4-separately

1 Like

Hello Julian, can you help me in devolpe of telemetry with stm32 Lora anda Pixhawk 2.4.8?