fix(esp8266): Fix crash when enable debug log level

This commit is contained in:
Dong Heng
2018-07-13 14:12:07 +08:00
parent ebf2f6cc74
commit 58fbf862fb
3 changed files with 16 additions and 9 deletions

View File

@ -86,7 +86,7 @@ void chip_boot(size_t start_addr, size_t map)
ret = spi_flash_read(start_addr, &fhdr, sizeof(flash_hdr_t));
if (ret) {
ESP_LOGE(TAG, "SPI flash read result %d\n", ret);
ESP_EARLY_LOGE(TAG, "SPI flash read result %d\n", ret);
}
if (3 > fhdr.spi_speed)
@ -100,7 +100,7 @@ void chip_boot(size_t start_addr, size_t map)
flash_size = flash_map_table[fhdr.spi_size_map];
} else {
flash_size = 0;
ESP_LOGE(TAG, "SPI size error is %d\n", fhdr.spi_size_map);
ESP_EARLY_LOGE(TAG, "SPI size error is %d\n", fhdr.spi_size_map);
}
sect_size = 4 * 1024;
@ -117,7 +117,7 @@ void chip_boot(size_t start_addr, size_t map)
ret = esp_get_boot_param(flash_size, sect_size, &bhdr, sizeof(boot_hdr_t));
if (ret) {
ESP_LOGE(TAG, "Get boot parameters %d\n", ret);
ESP_EARLY_LOGE(TAG, "Get boot parameters %d\n", ret);
}
cache_init(map, 0, 0);

View File

@ -87,19 +87,25 @@ void call_user_start(size_t start_addr, size_t map)
*dest++ = *src++;
}
/*
* When finish copying IRAM program, the exception vect must be initialized.
* And then user can load/store data which is not aligned by 4-byte.
*/
__asm__ __volatile__(
"movi a2, 0x40100000\n"
"wsr a2, vecbase\n");
chip_boot(start_addr, map);
/* clear bss data */
for (p = &_bss_start; p < &_bss_end; p++)
*p = 0;
chip_boot(start_addr, map);
__asm__ __volatile__(
"rsil a2, 2\n"
"movi a1, _chip_interrupt_tmp\n"
"movi a2, 0xffffff00\n"
"and a1, a1, a2\n"
"movi a2, 0x40100000\n"
"wsr a2, vecbase\n");
"and a1, a1, a2\n");
wifi_os_init();