How to just flash the firmware without rebuilding?

I build the firmware for a pixhawk inside a docker container and copied it out of the docker to the host pc.
On the host pc I don’t want to install any requirements for building but instead just want to flash the firmware provided by the docker container. Can I use the PX4-Autopilot/Tools/px_uploader.py script for that ?

I found a way:

  1. build the firmware inside the docker container as always.
    make <firmware_name>
    example:
    make px4_fmu-v5_rtps
  2. copy the resulting buildfiles to the host pc.
    docker cp <container_name>:/path/to/buildfiles/folder /path/to/buildfiles/folder/on/host
    example:
    docker cp companion_px4:/home/docker/git_repos/PX4-Autopilot/build/px4_fmu-v5_rtps /home/me/git_repos/PX4-Autopilot/build/px4_fmu-v5_rtps
  3. use upload.sh from PX4 Tools:
    navigate to the PX4-Autopilots/Tools folder
    ./run.sh ../build/<firmware_name>/<firmware_name>.px4
    example:
    cd ~/git_repos/PX4-Autopilot/Tools
    ./run.sh ../build/px4_fmu-v5_rtps/px4_fmu-v5_rtps.px4

It’s good you found a solution to your issue.

However, are you aware that you can have just one folder with the source code in your host PC and share it to the Docker environment? see documentation with details.
This way you’ll avoid step #2 (copy from Docker to PC) since the built firmware will be already in your host PC folder…

Regards.

1 Like