bugfix(psram): configure MMU after PSRAM initialization

This commit is contained in:
chenjianqiang 2020-07-03 22:08:44 +08:00
parent ce7affe81c
commit 6a253e8809
3 changed files with 8 additions and 3 deletions

View file

@ -172,7 +172,6 @@ void IRAM_ATTR call_start_cpu0(void)
}
#if CONFIG_SPIRAM_BOOT_INIT
esp_spiram_init_cache();
if (esp_spiram_init() != ESP_OK) {
#if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
ESP_EARLY_LOGE(TAG, "Failed to init external RAM, needed for external .bss segment");
@ -187,6 +186,7 @@ void IRAM_ATTR call_start_cpu0(void)
abort();
#endif
}
esp_spiram_init_cache();
#endif
ESP_EARLY_LOGI(TAG, "Pro cpu up.");

View file

@ -127,7 +127,7 @@ esp_spiram_size_t esp_spiram_get_chip_size(void)
{
if (!spiram_inited) {
ESP_EARLY_LOGE(TAG, "SPI RAM not initialized");
return ESP_SPIRAM_SIZE_INVALID;
abort();
}
psram_size_t psram_size = psram_get_size();
switch (psram_size) {

View file

@ -300,6 +300,7 @@ esp_err_t esp_spiram_init(void)
return r;
}
spiram_inited=true;
#if (CONFIG_SPIRAM_SIZE != -1)
if (esp_spiram_get_size()!=CONFIG_SPIRAM_SIZE) {
ESP_EARLY_LOGE(TAG, "Expected %dKiB chip but found %dKiB chip. Bailing out..", CONFIG_SPIRAM_SIZE/1024, esp_spiram_get_size()/1024);
@ -315,7 +316,6 @@ esp_err_t esp_spiram_init(void)
(PSRAM_MODE==PSRAM_VADDR_MODE_EVENODD)?"even/odd (2-core)": \
(PSRAM_MODE==PSRAM_VADDR_MODE_LOWHIGH)?"low/high (2-core)": \
(PSRAM_MODE==PSRAM_VADDR_MODE_NORMAL)?"normal (1-core)":"ERROR");
spiram_inited=true;
return ESP_OK;
}
@ -386,6 +386,11 @@ esp_err_t esp_spiram_reserve_dma_pool(size_t size) {
size_t esp_spiram_get_size(void)
{
if (!spiram_inited) {
ESP_EARLY_LOGE(TAG, "SPI RAM not initialized");
abort();
}
psram_size_t size=psram_get_size();
if (size==PSRAM_SIZE_16MBITS) return 2*1024*1024;
if (size==PSRAM_SIZE_32MBITS) return 4*1024*1024;