diff --git a/cores/esp8266/core_esp8266_main.cpp b/cores/esp8266/core_esp8266_main.cpp index a143b1cd5e..86885318ff 100644 --- a/cores/esp8266/core_esp8266_main.cpp +++ b/cores/esp8266/core_esp8266_main.cpp @@ -400,13 +400,9 @@ extern "C" void __disableWiFiAtBootTime (void) #if FLASH_MAP_SUPPORT #include "flash_hal.h" -extern "C" bool flashinit (void); -#if (NONOSDK >= (0x30000)) -uint32_t __flashindex __attribute__((section(".noinit"))); -#else +extern "C" const char *flashinit (void); uint32_t __flashindex; #endif -#endif #if (NONOSDK >= (0x30000)) #undef ETS_PRINTF @@ -432,8 +428,8 @@ extern "C" void ICACHE_FLASH_ATTR user_pre_init(void) do { #if FLASH_MAP_SUPPORT - if (!flashinit()) { - flash_map_str = PSTR("flashinit: flash size missing from FLASH_MAP table\n"); + flash_map_str = flashinit(); + if (flash_map_str) { continue; } #endif @@ -631,6 +627,11 @@ extern "C" void user_init(void) { uart_div_modify(0, UART_CLK_FREQ / (115200)); +#if FLASH_MAP_SUPPORT && (NONOSDK < (0x30000)) + const char *err_msg = flashinit(); + if (err_msg) __panic_func(err_msg, 0, NULL); +#endif + init(); // in core_esp8266_wiring.c, inits hw regs and sdk timer initVariant(); @@ -653,11 +654,6 @@ extern "C" void user_init(void) { #if defined(MMU_IRAM_HEAP) umm_init_iram(); -#endif -#if FLASH_MAP_SUPPORT && (NONOSDK < 0x30000) - if (!flashinit()) { - panic(); - } #endif preinit(); // Prior to C++ Dynamic Init (not related to above init() ). Meant to be user redefinable. __disableWiFiAtBootTime(); // default weak function disables WiFi diff --git a/cores/esp8266/core_esp8266_postmortem.cpp b/cores/esp8266/core_esp8266_postmortem.cpp index ce2817aaf6..bd69748815 100644 --- a/cores/esp8266/core_esp8266_postmortem.cpp +++ b/cores/esp8266/core_esp8266_postmortem.cpp @@ -140,6 +140,9 @@ void __wrap_system_restart_local() { } ets_putc('\n'); } + else if (s_panic_file) { + ets_printf_P(PSTR("\nPanic %S\n"), s_panic_file); + } else if (s_unhandled_exception) { ets_printf_P(PSTR("\nUnhandled C++ exception: %S\n"), s_unhandled_exception); } diff --git a/cores/esp8266/flash_hal.h b/cores/esp8266/flash_hal.h index 51500d8b11..682e1dcfb1 100644 --- a/cores/esp8266/flash_hal.h +++ b/cores/esp8266/flash_hal.h @@ -33,21 +33,26 @@ extern "C" { #include extern uint32_t spi_flash_get_id (void); // -extern bool flashinit(void); +extern const char *flashinit(void); extern uint32_t __flashindex; extern const flash_map_s __flashdesc[]; +#ifndef QUOTE +#define QUOTE(a) __STRINGIFY(a) +#endif + #define FLASH_MAP_SETUP_CONFIG(conf) FLASH_MAP_SETUP_CONFIG_ATTR(,conf) #define FLASH_MAP_SETUP_CONFIG_ATTR(attr, conf...) \ const flash_map_s __flashdesc[] PROGMEM = conf; \ - bool flashinit (void) attr; \ - bool flashinit (void) \ + const char *flashinit (void) attr; \ + const char *flashinit (void) \ { \ uint32_t flash_chip_size_kb = 1 << (((spi_flash_get_id() >> 16) & 0xff) - 10); \ for (__flashindex = 0; __flashindex < sizeof(__flashdesc) / sizeof(__flashdesc[0]); __flashindex++) \ if (__flashdesc[__flashindex].flash_size_kb == flash_chip_size_kb) \ - return true; \ - return false; /* configuration not found */ \ + return NULL; \ + static const char fail_msg[] PROGMEM = __FILE__ ":" QUOTE(__LINE__) " flashinit: configuration not found"; \ + return fail_msg; /* configuration not found */ \ } #define EEPROM_start (__flashdesc[__flashindex].eeprom_start) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy