ROMFS handle bl_update generically

- include all available legacy bootloaders
This commit is contained in:
Daniel Agar 2021-03-10 09:40:49 -05:00 committed by Lorenz Meier
parent 3ad0da51c4
commit f8eaa6e46b
42 changed files with 84 additions and 213 deletions

View File

@ -258,6 +258,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOCONFIG 2"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOSTART 13000"' // generic vtol standard
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_BL_UPDATE 1"' // update bootloader
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "px4io forceupdate 14662 /etc/extras/px4_io-v2_default.bin" || true' // force px4io update
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "reboot" || true' // reboot to apply
@ -333,6 +334,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOCONFIG 2"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOSTART 4001"' // generic multicopter
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_BL_UPDATE 1"' // update bootloader
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "reboot" || true' // reboot to apply
}
@ -407,6 +409,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOCONFIG 2"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOSTART 13000"' // generic vtol standard
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_BL_UPDATE 1"' // update bootloader
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "px4io forceupdate 14662 /etc/extras/px4_io-v2_default.bin" || true' // force px4io update
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "reboot" || true' // reboot to apply
@ -482,6 +485,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOCONFIG 2"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOSTART 4001"' // generic quadcopter
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_BL_UPDATE 1"' // update bootloader
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "px4io forceupdate 14662 /etc/extras/px4_io-v2_default.bin" || true' // force px4io update
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "reboot" || true' // reboot to apply
@ -560,6 +564,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set IMU_GYRO_RATEMAX 250"' // limit cpu usage
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOSTART 4001"' // generic multicopter
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_BL_UPDATE 1"' // update bootloader
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "px4io forceupdate 14662 /etc/extras/px4_io-v2_default.bin" || true' // force px4io update
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "reboot" || true' // reboot to apply
@ -635,6 +640,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOCONFIG 2"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOSTART 4001"' // generic quadcopter
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_BL_UPDATE 1"' // update bootloader
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "reboot" || true' // reboot to apply
}
@ -713,6 +719,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set IMU_GYRO_RATEMAX 250"' // limit cpu usage
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set MAV_0_CONFIG 0"' // limit cpu usage
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOSTART 4001"' // generic multicopter
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_BL_UPDATE 1"' // update bootloader
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "reboot" || true' // reboot to apply
}
@ -787,6 +794,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOCONFIG 2"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOSTART 4001"' // generic vtol standardulticopter
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_BL_UPDATE 1"' // update bootloader
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "reboot" || true' // reboot to apply
}
@ -941,6 +949,7 @@ pipeline {
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set CBRK_BUZZER 782097"' // disable buzzer
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOCONFIG 2"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_AUTOSTART 4001"' // generic multicopter
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param set SYS_BL_UPDATE 1"' // update bootloader
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "reboot" || true' // reboot to apply
}

View File

@ -31,11 +31,12 @@
#
############################################################################
message(STATUS "ROMFS: ${config_romfs_root}")
set(romfs_src_dir ${PX4_SOURCE_DIR}/ROMFS/${config_romfs_root})
set(romfs_gen_root_dir ${PX4_BINARY_DIR}/etc)
file(RELATIVE_PATH romfs_path_relative ${PX4_SOURCE_DIR} ${romfs_src_dir})
message(STATUS "ROMFS: ${romfs_path_relative}")
set_property(GLOBAL PROPERTY PX4_ROMFS_FILES)
set_property(GLOBAL PROPERTY PX4_ROMFS_CMAKE_FILES)
@ -149,9 +150,22 @@ if(config_io_board)
copy_px4io_bin
${fw_io_bin}
)
file(RELATIVE_PATH iofw_file_relative ${PX4_SOURCE_DIR} ${fw_io_bin})
message(STATUS "ROMFS: Adding ${iofw_file_relative} -> /etc/extras/${config_io_board}.bin")
endif()
if(config_build_bootloader)
# board bootloader (built or included)
if(TARGET copy_bootloader_bin)
if(board_bootloader_firmware)
file(RELATIVE_PATH bl_file_relative ${PX4_SOURCE_DIR} ${board_bootloader_firmware})
message(STATUS "ROMFS: Adding ${bl_file_relative} -> /etc/extras/bootloader.bin")
else()
file(RELATIVE_PATH bl_file_relative ${PX4_SOURCE_DIR} ${bootloader_bin})
message(STATUS "ROMFS: Adding ${bl_file_relative} -> /etc/extras/bootloader.bin")
endif()
list(APPEND extras_dependencies
copy_bootloader_bin
${bootloader_bin}
@ -162,7 +176,8 @@ endif()
# optional board architecture defaults
set(board_arch_rc_file "rc.board_arch_defaults")
if(EXISTS "${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/init/${CONFIG_ARCH_CHIP}/${board_arch_rc_file}")
message(STATUS "ROMFS: Adding ${board_arch_rc_file}")
file(RELATIVE_PATH rc_file_relative ${PX4_SOURCE_DIR} ${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/init/${CONFIG_ARCH_CHIP}/${board_arch_rc_file})
message(STATUS "ROMFS: Adding ${rc_file_relative} -> /etc/init.d/${board_arch_rc_file}")
add_custom_command(
OUTPUT
@ -193,7 +208,8 @@ list(APPEND OPTIONAL_BOARD_RC
foreach(board_rc_file ${OPTIONAL_BOARD_RC})
if(EXISTS "${PX4_BOARD_DIR}/init/${board_rc_file}")
message(STATUS "ROMFS: Adding ${board_rc_file}")
file(RELATIVE_PATH rc_file_relative ${PX4_SOURCE_DIR} ${PX4_BOARD_DIR}/init/${board_rc_file})
message(STATUS "ROMFS: Adding ${rc_file_relative} -> /etc/init.d/${board_rc_file}")
add_custom_command(
OUTPUT
@ -221,7 +237,7 @@ if(config_uavcan_peripheral_firmware)
foreach(uavcan_peripheral_config ${config_uavcan_peripheral_firmware})
# include the px4io binary in ROMFS
message(STATUS "ROMFS: Building and including UAVCAN peripheral ${uavcan_peripheral_config}")
message(STATUS "ROMFS: Adding UAVCAN peripheral ${uavcan_peripheral_config} -> /etc/uavcan/fw/")
ExternalProject_Add(build_${uavcan_peripheral_config}
SOURCE_DIR ${CMAKE_SOURCE_DIR}
DOWNLOAD_COMMAND ""

View File

@ -1,5 +0,0 @@
px4fmuv3_bl.bin: Bootloader binary of the PX4 Bootloader
(https://github.com/PX4/Bootloader)
based on commit 184b813699a9cfd6f43a5a21556a06b4372baf5f
for the target px4fmuv3_bl

View File

@ -549,6 +549,22 @@ else
. ${R}etc/init.d/rc.autostart.post
fi
#
# Bootloader upgrade
#
if param compare -s SYS_BL_UPDATE 1
then
if [ -f "/etc/extras/bootloader.bin" ]
then
param set SYS_BL_UPDATE 0
param save
echo "bootloader update..."
bl_update "/etc/extras/bootloader.bin"
echo "bootloader update done, rebooting"
reboot
fi
fi
if ! param compare SYS_PARAM_VER ${PARAM_DEFAULTS_VER}
then
echo "Switched to different parameter version. Resetting parameters."

Binary file not shown.

View File

@ -14,8 +14,8 @@ px4_add_board(
barometer/lps25h
distance_sensor/vl53l0x
gps
magnetometer/akm/ak8963
imu/invensense/mpu9250
magnetometer/akm/ak8963
optical_flow/pmw3901
pwm_out
MODULES
@ -45,7 +45,7 @@ px4_add_board(
#bl_update
dmesg
dumpfile
esc_calib
#esc_calib
hardfault_log
i2cdetect
led_control

View File

@ -11,12 +11,12 @@ px4_add_board(
ROMFSROOT px4fmu_common
CONSTRAINED_FLASH
DRIVERS
barometer/bmp388
distance_sensor/vl53l1x
gps
imu/bosch/bmi088/bmi088_i2c
optical_flow/pmw3901
pwm_out
imu/bosch/bmi088/bmi088_i2c
barometer/bmp388
MODULES
attitude_estimator_q
#camera_feedback
@ -24,7 +24,8 @@ px4_add_board(
dataman
ekf2
events
gyro_fft
flight_mode_manager
#gyro_fft
land_detector
landing_target_estimator
load_mon
@ -40,10 +41,10 @@ px4_add_board(
sensors
#temperature_compensation
SYSTEMCMDS
bl_update
#bl_update
dmesg
dumpfile
esc_calib
#esc_calib
hardfault_log
i2cdetect
led_control

View File

@ -49,15 +49,14 @@
#include <stm32_gpio.h>
#include "board_config.h"
#include <px4_arch/spi_hw_description.h>
#include <drivers/drv_sensor.h>
#include <nuttx/spi/spi.h>
constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = {
initSPIBus(SPI::Bus::SPI1, {
initSPIDevice(DRV_FLOW_DEVTYPE_PMW3901, SPI::CS{GPIO::PortB, GPIO::Pin4}),
initSPIDevice(SPIDEV_MMCSD(0), SPI::CS{GPIO::PortC, GPIO::Pin12}),
initSPIDevice(DRV_FLOW_DEVTYPE_PMW3901, SPI::CS{GPIO::PortB, GPIO::Pin4}),
initSPIDevice(DRV_DEVTYPE_UNUSED, SPI::CS{GPIO::PortB, GPIO::Pin5}),
}),
};

View File

@ -3,25 +3,6 @@
# board specific defaults
#------------------------------------------------------------------------------
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/cuav_nora_bootloader.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..."
bl_update $BL_FILE
echo "BL update done"
reboot
fi
fi
unset BL_FILE
param set-default BAT_V_DIV 18
param set-default BAT1_V_DIV 18
param set-default BAT2_V_DIV 18

View File

@ -3,25 +3,6 @@
# board specific defaults
#------------------------------------------------------------------------------
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/cuav_x7pro_bootloader.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..."
bl_update $BL_FILE
echo "BL update done"
reboot
fi
fi
unset BL_FILE
param set-default BAT_V_DIV 18
param set-default BAT1_V_DIV 18
param set-default BAT2_V_DIV 18

View File

@ -3,24 +3,6 @@
# board specific defaults
#------------------------------------------------------------------------------
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/cubepilot_cubeorange_bootloader.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..."
bl_update $BL_FILE
echo "BL update done"
reboot
fi
fi
unset BL_FILE
param set-default BAT_V_DIV 10.1
param set-default BAT1_V_DIV 10.1

View File

@ -3,25 +3,5 @@
# Holybro Durandal V1 specific board defaults
#------------------------------------------------------------------------------
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/holybro_durandal-v1_bootloader.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..."
bl_update $BL_FILE
echo "BL update done"
reboot
fi
fi
unset BL_FILE
# Enable IMU thermal control
param set-default SENS_EN_THERMAL 1

View File

@ -3,25 +3,6 @@
# board specific defaults
#------------------------------------------------------------------------------
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/mro_ctrl-zero-h7-oem_bootloader.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..."
bl_update $BL_FILE
echo "BL update done"
reboot
fi
fi
unset BL_FILE
param set-default BAT_V_DIV 10.1
param set-default BAT1_V_DIV 10.1

View File

@ -3,25 +3,6 @@
# board specific defaults
#------------------------------------------------------------------------------
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/mro_ctrl-zero-h7_bootloader.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..."
bl_update $BL_FILE
echo "BL update done"
reboot
fi
fi
unset BL_FILE
param set-default BAT_V_DIV 10.1
param set-default BAT1_V_DIV 10.1

View File

@ -3,25 +3,6 @@
# board specific defaults
#------------------------------------------------------------------------------
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/mro_pixracerpro_bootloader.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..."
bl_update $BL_FILE
echo "BL update done"
reboot
fi
fi
unset BL_FILE
param set-default BAT_V_DIV 10.1
param set-default BAT1_V_DIV 10.1

Binary file not shown.

View File

@ -82,7 +82,7 @@ px4_add_board(
vmount
vtol_att_control
SYSTEMCMDS
bl_update
#bl_update
#dmesg
dumpfile
esc_calib

View File

@ -82,7 +82,7 @@ px4_add_board(
vmount
vtol_att_control
SYSTEMCMDS
bl_update
#bl_update
#dmesg
dumpfile
esc_calib

Binary file not shown.

View File

@ -8,7 +8,6 @@ px4_add_board(
ARCHITECTURE cortex-m4
CONSTRAINED_MEMORY
ROMFSROOT px4fmu_common
BOOTLOADER ${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/extras/px4fmuv3_bl.bin
IO px4_io-v2_default
#TESTING
#UAVCAN_INTERFACES 2

View File

@ -1,23 +0,0 @@
#!/bin/sh
#
# board specific defaults
#------------------------------------------------------------------------------
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/px4fmuv3_bl.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..."
bl_update $BL_FILE
echo "BL update done"
reboot
fi
fi
unset BL_FILE

Binary file not shown.

View File

@ -1,23 +0,0 @@
#!/bin/sh
#
# board specific defaults
#------------------------------------------------------------------------------
#
# Bootloader upgrade
#
set BL_FILE /etc/extras/px4fmuv3_bl.bin
if [ -f $BL_FILE ]
then
if param compare SYS_BL_UPDATE 1
then
param set SYS_BL_UPDATE 0
param save
echo "BL update..."
bl_update $BL_FILE
echo "BL update done"
reboot
fi
fi
unset BL_FILE

Binary file not shown.

View File

@ -37,13 +37,13 @@ px4_add_board(
imu/invensense/icm20602
imu/invensense/icm42688p
irlock
lights/blinkm
#lights/blinkm
lights/rgbled
lights/rgbled_ncp5623c
magnetometer # all available magnetometer drivers
optical_flow # all available optical flow drivers
#osd
pca9685
#pca9685
pca9685_pwm_out
power_monitor/ina226
#protocol_splitter

Binary file not shown.

Binary file not shown.

View File

@ -48,7 +48,6 @@
# [ ROMFSROOT <string> ]
# [ BUILD_BOOTLOADER ]
# [ IO <string> ]
# [ BOOTLOADER <string> ]
# [ UAVCAN_INTERFACES <string> ]
# [ UAVCAN_PERIPHERALS <list> ]
# [ DRIVERS <list> ]
@ -74,7 +73,6 @@
# ROMFSROOT : relative path to the ROMFS root directory
# BUILD_BOOTLOADER : flag to enable building and including the bootloader config
# IO : name of IO board to be built and included in the ROMFS (requires a valid ROMFSROOT)
# BOOTLOADER : bootloader file to include for flashing via bl_update (currently NuttX only)
# UAVCAN_INTERFACES : number of interfaces for UAVCAN
# UAVCAN_PERIPHERALS : list of UAVCAN peripheral firmware to build and embed
# DRIVERS : list of drivers to build for this board (relative to src/drivers)
@ -148,7 +146,6 @@ function(px4_add_board)
ARCHITECTURE
ROMFSROOT
IO
BOOTLOADER
UAVCAN_INTERFACES
UAVCAN_TIMER_OVERRIDE
LINKER_PREFIX
@ -210,9 +207,6 @@ function(px4_add_board)
set(romfs_extra_files)
set(config_romfs_extra_dependencies)
if(BOOTLOADER)
list(APPEND romfs_extra_files ${BOOTLOADER})
endif()
foreach(metadata ${EMBEDDED_METADATA})
if(${metadata} STREQUAL "parameters")
list(APPEND romfs_extra_files ${PX4_BINARY_DIR}/params.json.xz)

View File

@ -64,10 +64,10 @@ if(config_build_bootloader)
ExternalProject_Get_Property(bootloader_firmware BINARY_DIR)
set(bootloader_exe "${BINARY_DIR}/${bootloader_config}.elf")
set(bootloader_bin "${PX4_BINARY_DIR}/romfs_extras/${bootloader_config}.bin" CACHE FILEPATH "bootloader binary path")
set(board_bootloader_firmware "${BINARY_DIR}/${bootloader_config}.elf" CACHE FILEPATH "bootloader original binary path")
set(bootloader_bin "${PX4_BINARY_DIR}/romfs_extras/bootloader.bin" CACHE FILEPATH "bootloader binary path")
file(RELATIVE_PATH bootloader_exe_relative ${CMAKE_CURRENT_BINARY_DIR} ${bootloader_exe})
file(RELATIVE_PATH bootloader_exe_relative ${CMAKE_CURRENT_BINARY_DIR} ${board_bootloader_firmware})
file(RELATIVE_PATH bootloader_bin_relative ${CMAKE_CURRENT_BINARY_DIR} ${bootloader_bin})
add_custom_command(OUTPUT ${bootloader_bin}
@ -77,4 +77,25 @@ if(config_build_bootloader)
COMMENT "Copying ${bootloader_config} to ROMFS extras"
)
add_custom_target(copy_bootloader_bin DEPENDS ${bootloader_bin})
elseif(EXISTS "${PX4_BOARD_DIR}/bootloader/")
if(EXISTS ${PX4_BOARD_DIR}/bootloader/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.bin)
set(board_bootloader_firmware ${PX4_BOARD_DIR}/bootloader/${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.bin CACHE FILEPATH "bootloader original binary path")
set(bootloader_bin "${PX4_BINARY_DIR}/romfs_extras/bootloader.bin" CACHE FILEPATH "bootloader binary path")
add_custom_command(OUTPUT ${bootloader_bin}
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/romfs_extras
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${board_bootloader_firmware} ${PX4_BINARY_DIR}/romfs_extras/bootloader.bin
DEPENDS ${board_bootloader_firmware}
COMMENT "Copying ${board_bootloader_firmware} to ROMFS extras"
)
add_custom_target(copy_bootloader_bin DEPENDS ${bootloader_bin})
else()
file(GLOB bootloader_bin_files ${PX4_BOARD_DIR}/bootloader/*.bin)
foreach(bin_file ${bootloader_bin_files})
message(FATAL_ERROR "incorrect bootloader filename ${bin_file} should be ${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.bin")
endforeach()
endif()
endif()