HAL_PX4: support flashing bootloader with MAVLink command

This commit is contained in:
Andrew Tridgell 2018-06-29 08:31:41 +10:00
parent 4299eb9ba8
commit b4d527a9f8
2 changed files with 17 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#include <systemlib/board_serial.h>
#include <drivers/drv_gpio.h>
#include <AP_Math/AP_Math.h>
#include <AP_BoardConfig/AP_BoardConfig.h>
extern const AP_HAL::HAL& hal;
@ -261,4 +262,18 @@ void PX4Util::free_type(void *ptr, size_t size, AP_HAL::Util::Memory_Type mem_ty
#endif
}
extern "C" {
int bl_update_main(int argc, char *argv[]);
};
bool PX4Util::flash_bootloader()
{
if (AP_BoardConfig::px4_start_driver(bl_update_main, "bl_update", "/etc/bootloader/fmu_bl.bin")) {
hal.console->printf("updated bootloader\n");
return true;
}
return false;
}
#endif // CONFIG_HAL_BOARD == HAL_BOARD_PX4

View File

@ -60,6 +60,8 @@ public:
void *malloc_type(size_t size, AP_HAL::Util::Memory_Type mem_type) override;
void free_type(void *ptr, size_t size, AP_HAL::Util::Memory_Type mem_type) override;
bool flash_bootloader() override;
private:
int _safety_handle;
PX4::NSHShellStream _shell_stream;