Esempio n. 1
0
/* Note: the trampoline *must* be explicitly put into the .text segment, since
 * by the time it is invoked the irom has not yet been mapped. This naturally
 * also goes for anything the trampoline itself calls.
 */
void TEXT_SECTION_ATTR user_start_trampoline (void)
{
   __real__xtos_set_exception_handler (
     EXCCAUSE_LOAD_STORE_ERROR, load_non_32_wide_handler);

#ifdef LUA_USE_MODULES_RTCTIME
  // Note: Keep this as close to call_user_start() as possible, since it
  // is where the cpu clock actually gets bumped to 80MHz.
  rtctime_early_startup ();
#endif
  call_user_start ();
}
void TEXT_SECTION_ATTR user_start_trampoline (void)
{
    __real__xtos_set_exception_handler(EXCCAUSE_LOAD_STORE_ERROR, load_non_32_wide_handler);

    SPIFlashInfo sfi;
    SPIRead (0, &sfi, sizeof (sfi)); // Cache read not enabled yet, safe to use
    if (sfi.size < 2) // Compensate for out-of-order 4mbit vs 2mbit values
        sfi.size ^= 1;
    uint32_t flash_end_addr = (256 * 1024) << sfi.size;
    uint32_t init_data_hdr = 0xffffffff;
    SPIRead (flash_end_addr - 4 * SPI_FLASH_SEC_SIZE, &init_data_hdr, sizeof (init_data_hdr));
    no_init_data = (init_data_hdr == 0xffffffff);

    call_user_start();
}