Skip to content

Commit 58160e9

Browse files
committed
bootloader: bl_boot: Fix faulty boot logic
Fixes faulty boot logic that would do a return after changing vector addresses and a clear call stack which has undefined opeation. Also adds an error message when forwarding externally required APIs fails so it is visible to the user Signed-off-by: Jamie McCrae <[email protected]>
1 parent 0479f08 commit 58160e9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

subsys/bootloader/bl_boot/bl_boot.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ void bl_boot(const struct fw_info *fw_info)
121121

122122
printk("Booting (0x%x).\r\n", fw_info->address);
123123

124+
if (!fw_info_ext_api_provide(fw_info, true)) {
125+
printk("Failed to provide ext APIs to image, boot aborted.\r\n");
126+
return;
127+
}
128+
124129
uninit_used_peripherals();
125130

126131
/* Allow any pending interrupts to be recognized */
@@ -158,10 +163,6 @@ void bl_boot(const struct fw_info *fw_info)
158163
VTOR = fw_info->address;
159164
uint32_t *vector_table = (uint32_t *)fw_info->address;
160165

161-
if (!fw_info_ext_api_provide(fw_info, true)) {
162-
return;
163-
}
164-
165166
#if defined(CONFIG_BUILTIN_STACK_GUARD) && \
166167
defined(CONFIG_CPU_CORTEX_M_HAS_SPLIM)
167168
/* Reset limit registers to avoid inflicting stack overflow on image

0 commit comments

Comments
 (0)