From ddb033aa124fc442afd3676e0474604371669a1a Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Mon, 12 Dec 2016 15:39:11 -1000 Subject: [PATCH] Temp fix - Needs to move to micro hal --- src/platforms/nuttx/px4_layer/px4_nuttx_tasks.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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();