Skip to content

Commit 9b21391

Browse files
committed
stm32/mboot: Fix unused function warning with timeout enabled.
Conditionally compile try_enter_application() only when it's actually used. With both MBOOT_ENABLE_DFU_TIMEOUT and MBOOT_LEAVE_BOOTLOADER_VIA_RESET at their default values (1), the function was defined but never called, causing -Werror=unused-function. Signed-off-by: Andrew Leech <[email protected]>
1 parent 4b18156 commit 9b21391

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ports/stm32/mboot/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,7 @@ static int pyb_usbdd_shutdown(void) {
14811481
/******************************************************************************/
14821482
// main
14831483

1484+
#if !MBOOT_ENABLE_DFU_TIMEOUT || !MBOOT_LEAVE_BOOTLOADER_VIA_RESET
14841485
MP_NORETURN static __attribute__((naked)) void branch_to_application(uint32_t r0, uint32_t bl_addr) {
14851486
__asm volatile (
14861487
"ldr r2, [r1, #0]\n" // get address of stack pointer
@@ -1511,6 +1512,7 @@ static void try_enter_application(int reset_mode) {
15111512
// Jump to the application.
15121513
branch_to_application(reset_mode, APPLICATION_ADDR);
15131514
}
1515+
#endif
15141516

15151517
static void leave_bootloader(void) {
15161518
#if !MBOOT_LEAVE_BOOTLOADER_VIA_RESET

0 commit comments

Comments
 (0)