AP_Periph: added magic FLASH_BOOTLOADER=42/43 values
when FLASH_BOOTLOADER=42 we will enter into a lockup loop, which will trigger a watchdog. This is useful for testing watchdog support
This commit is contained in:
parent
5e81fadf13
commit
d586a2d853
@ -902,7 +902,23 @@ static void process1HzTasks(uint64_t timestamp_usec)
|
||||
|
||||
#if !defined(HAL_NO_FLASH_SUPPORT) && !defined(HAL_NO_ROMFS_SUPPORT)
|
||||
if (periph.g.flash_bootloader.get()) {
|
||||
const uint8_t flash_bl = periph.g.flash_bootloader.get();
|
||||
periph.g.flash_bootloader.set_and_save_ifchanged(0);
|
||||
if (flash_bl == 42) {
|
||||
// magic developer value to test watchdog support with main loop lockup
|
||||
while (true) {
|
||||
can_printf("entering lockup\n");
|
||||
hal.scheduler->delay(100);
|
||||
}
|
||||
}
|
||||
if (flash_bl == 43) {
|
||||
// magic developer value to test watchdog support with hard fault
|
||||
can_printf("entering fault\n");
|
||||
void *foo = (void*)0xE000ED38;
|
||||
typedef void (*fptr)();
|
||||
fptr gptr = (fptr) (void *) foo;
|
||||
gptr();
|
||||
}
|
||||
hal.scheduler->delay(1000);
|
||||
AP_HAL::Util::FlashBootloader res = hal.util->flash_bootloader();
|
||||
switch (res) {
|
||||
@ -1044,6 +1060,8 @@ void AP_Periph_FW::can_start()
|
||||
PreferredNodeID = g.can_node;
|
||||
}
|
||||
|
||||
periph.g.flash_bootloader.set_and_save_ifchanged(0);
|
||||
|
||||
can_iface.init(1000000, AP_HAL::CANIface::NormalMode);
|
||||
|
||||
canardInit(&canard, (uint8_t *)canard_memory_pool, sizeof(canard_memory_pool),
|
||||
|
Loading…
Reference in New Issue
Block a user