diff options
-rw-r--r-- | ports/stm32/boards/stm32f4xx_hal_conf_base.h | 1 | ||||
-rw-r--r-- | ports/stm32/boards/stm32f7xx_hal_conf_base.h | 1 | ||||
-rw-r--r-- | ports/stm32/boards/stm32h7xx_hal_conf_base.h | 1 | ||||
-rw-r--r-- | ports/stm32/mboot/main.c | 9 | ||||
-rw-r--r-- | ports/stm32/mboot/mboot.h | 1 |
5 files changed, 12 insertions, 1 deletions
diff --git a/ports/stm32/boards/stm32f4xx_hal_conf_base.h b/ports/stm32/boards/stm32f4xx_hal_conf_base.h index 91f064835..057a9e81e 100644 --- a/ports/stm32/boards/stm32f4xx_hal_conf_base.h +++ b/ports/stm32/boards/stm32f4xx_hal_conf_base.h @@ -54,6 +54,7 @@ #include "stm32f4xx_hal_usart.h" #include "stm32f4xx_hal_wwdg.h" #include "stm32f4xx_ll_adc.h" +#include "stm32f4xx_ll_pwr.h" #include "stm32f4xx_ll_rtc.h" // Enable various HAL modules diff --git a/ports/stm32/boards/stm32f7xx_hal_conf_base.h b/ports/stm32/boards/stm32f7xx_hal_conf_base.h index 1a3fca3ac..6e7dff304 100644 --- a/ports/stm32/boards/stm32f7xx_hal_conf_base.h +++ b/ports/stm32/boards/stm32f7xx_hal_conf_base.h @@ -54,6 +54,7 @@ #include "stm32f7xx_hal_usart.h" #include "stm32f7xx_hal_wwdg.h" #include "stm32f7xx_ll_adc.h" +#include "stm32f7xx_ll_pwr.h" #include "stm32f7xx_ll_rtc.h" // Enable various HAL modules diff --git a/ports/stm32/boards/stm32h7xx_hal_conf_base.h b/ports/stm32/boards/stm32h7xx_hal_conf_base.h index 231f1ac7f..a451cfde7 100644 --- a/ports/stm32/boards/stm32h7xx_hal_conf_base.h +++ b/ports/stm32/boards/stm32h7xx_hal_conf_base.h @@ -54,6 +54,7 @@ #include "stm32h7xx_hal_usart.h" #include "stm32h7xx_hal_wwdg.h" #include "stm32h7xx_ll_adc.h" +#include "stm32h7xx_ll_pwr.h" #include "stm32h7xx_ll_rtc.h" // Enable various HAL modules diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index 0846d97cf..1395949f2 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -1443,7 +1443,14 @@ enter_bootloader: // Application passed through elements, validate then process them const uint8_t *elem_end = elem_search(ELEM_DATA_START, ELEM_TYPE_END); if (elem_end != NULL && elem_end[-1] == 0) { - fsload_process(); + int ret = fsload_process(); + // If there is a valid ELEM_TYPE_STATUS element then store the status in the given location. + const uint8_t *elem_status = elem_search(ELEM_DATA_START, ELEM_TYPE_STATUS); + if (elem_status != NULL && elem_status[-1] == 4) { + uint32_t *status_ptr = (uint32_t *)get_le32(&elem_status[0]); + LL_PWR_EnableBkUpAccess(); // In case status_ptr points to backup registers + *status_ptr = ret; + } } // Always reset because the application is expecting to resume led_state_all(0); diff --git a/ports/stm32/mboot/mboot.h b/ports/stm32/mboot/mboot.h index e4ed3cecc..853a86968 100644 --- a/ports/stm32/mboot/mboot.h +++ b/ports/stm32/mboot/mboot.h @@ -43,6 +43,7 @@ enum { ELEM_TYPE_END = 1, ELEM_TYPE_MOUNT, ELEM_TYPE_FSLOAD, + ELEM_TYPE_STATUS, }; enum { |