mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
fmu-v2: add bootloader binary and SYS_BL_UPDATE param for BL updates
This allows a simple-to-use bootloader update mechanism to switch from fmu-v2 to fmu-v3 target that has more flash.
This commit is contained in:
@@ -103,6 +103,15 @@ if (config_io_board)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (config_bl_file)
|
||||||
|
file(MAKE_DIRECTORY ${PX4_BINARY_DIR}/romfs_extras)
|
||||||
|
configure_file(${config_bl_file} ${PX4_BINARY_DIR}/romfs_extras COPYONLY)
|
||||||
|
|
||||||
|
list(APPEND extras_dependencies
|
||||||
|
${config_bl_file}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_custom_command(OUTPUT romfs_extras.stamp
|
add_custom_command(OUTPUT romfs_extras.stamp
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${romfs_gen_root_dir}/extras/
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${romfs_gen_root_dir}/extras/
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/romfs_extras/
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${PX4_BINARY_DIR}/romfs_extras/
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
px4fmuv3_bl.bin: Bootloader binary of the PX4 Bootloader
|
||||||
|
(https://github.com/PX4/Bootloader)
|
||||||
|
based on commit 184b813699a9cfd6f43a5a21556a06b4372baf5f
|
||||||
|
for the target px4fmuv3_bl
|
||||||
|
|
||||||
Executable
BIN
Binary file not shown.
@@ -211,6 +211,27 @@ else
|
|||||||
param reset
|
param reset
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bootloader upgrade
|
||||||
|
#
|
||||||
|
if ver hwcmp PX4FMU_V2
|
||||||
|
then
|
||||||
|
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..." >> $LOG_FILE
|
||||||
|
bl_update $BL_FILE
|
||||||
|
echo "BL update done" >> $LOG_FILE
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset BL_FILE
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start system state indicator.
|
# Start system state indicator.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ px4_nuttx_configure(HWCLASS m4 CONFIG nsh ROMFS y ROMFSROOT px4fmu_common IO px4
|
|||||||
|
|
||||||
#set(config_uavcan_num_ifaces 2)
|
#set(config_uavcan_num_ifaces 2)
|
||||||
|
|
||||||
|
set(config_bl_file ${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/extras/px4fmuv3_bl.bin)
|
||||||
|
|
||||||
set(config_module_list
|
set(config_module_list
|
||||||
#
|
#
|
||||||
# Board support modules
|
# Board support modules
|
||||||
@@ -62,7 +64,7 @@ set(config_module_list
|
|||||||
#
|
#
|
||||||
# System commands
|
# System commands
|
||||||
#
|
#
|
||||||
#systemcmds/bl_update
|
systemcmds/bl_update
|
||||||
#systemcmds/config
|
#systemcmds/config
|
||||||
#systemcmds/dumpfile
|
#systemcmds/dumpfile
|
||||||
#systemcmds/esc_calib
|
#systemcmds/esc_calib
|
||||||
|
|||||||
@@ -267,3 +267,25 @@ PARAM_DEFINE_INT32(SYS_HAS_MAG, 1);
|
|||||||
* @group System
|
* @group System
|
||||||
*/
|
*/
|
||||||
PARAM_DEFINE_INT32(SYS_HAS_BARO, 1);
|
PARAM_DEFINE_INT32(SYS_HAS_BARO, 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootloader update
|
||||||
|
*
|
||||||
|
* If enabled, update the bootloader on the next boot.
|
||||||
|
*
|
||||||
|
* WARNING: do not cut the power during an update process, otherwise you will
|
||||||
|
* have to recover using some alternative method (e.g. JTAG).
|
||||||
|
*
|
||||||
|
* Instructions:
|
||||||
|
* - Insert an SD card
|
||||||
|
* - Enable this parameter
|
||||||
|
* - Reboot the board (plug the power or send a reboot command)
|
||||||
|
* - Wait until the board comes back up (or at least 2 minutes)
|
||||||
|
* - If it does not come back, check the file bootlog.txt on the SD card
|
||||||
|
*
|
||||||
|
* @boolean
|
||||||
|
* @reboot_required true
|
||||||
|
*
|
||||||
|
* @group System
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_INT32(SYS_BL_UPDATE, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user