bootloader: Ensure bootloader never returns to caller

* Fixes some "noreturn" functions in bootloader utils which did return (causing fatal CPU
  exceptions).
* Marks bootloader entry as "noreturn", preventing "user code done" from stalling boot
  Partial fix for https://github.com/espressif/esp-idf/issues/1814 TW20016
  (Comprehensive fix for this issue will be enabling WDT during bootloader, coming shortly.)
This commit is contained in:
Angus Gratton
2018-07-19 15:27:35 +10:00
committed by Angus Gratton
parent a7d00f44ab
commit f0d74b1c64
4 changed files with 32 additions and 7 deletions
@@ -34,18 +34,18 @@ static int selected_boot_partition(const bootloader_state_t *bs);
* The hardware is mostly uninitialized, flash cache is down and the app CPU is in reset.
* We do have a stack, so we can do the initialization in C.
*/
void call_start_cpu0()
void __attribute__((noreturn)) call_start_cpu0()
{
// 1. Hardware initialization
if (bootloader_init() != ESP_OK) {
return;
bootloader_reset();
}
// 2. Select the number of boot partition
bootloader_state_t bs = { 0 };
int boot_index = select_partition_number(&bs);
if (boot_index == INVALID_INDEX) {
return;
bootloader_reset();
}
// 3. Load the app image for booting