diff --git a/src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c b/src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c index 84eed74b53..1b945e188e 100644 --- a/src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c +++ b/src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c @@ -51,8 +51,12 @@ #include #include -#ifndef CONFIG_ARCH_BOARD_SIM -#include +#ifdef CONFIG_ARCH_BOARD_SIM +#define stm32_pwr_enablebkp(onoff) +#else +# if defined(CONFIG_ARCH_CHIP_STM32) || defined(CONFIG_ARCH_CHIP_STM32F7) +# include +# endif #endif #include @@ -64,12 +68,11 @@ void px4_systemreset(bool to_bootloader) { if (to_bootloader) { -#ifndef CONFIG_ARCH_BOARD_SIM - stm32_pwr_enablebkp(); -#endif + stm32_pwr_enablebkp(true); /* XXX wow, this is evil - write a magic number into backup register zero */ *(uint32_t *)0x40002850 = 0xb007b007; + stm32_pwr_enablebkp(false); } up_systemreset();