mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-13 05:47:11 +00:00
cache/mmu: implememnt cache and mmu hal APIs in bootloader
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
#include "soc/io_mux_reg.h"
|
||||
#include "soc/system_reg.h"
|
||||
#include "esp32c3/rom/efuse.h"
|
||||
#include "esp32c3/rom/cache.h"
|
||||
#include "esp32c3/rom/ets_sys.h"
|
||||
#include "bootloader_common.h"
|
||||
#include "bootloader_init.h"
|
||||
@@ -37,6 +36,8 @@
|
||||
#include "bootloader_flash_priv.h"
|
||||
#include "bootloader_soc.h"
|
||||
#include "esp_efuse.h"
|
||||
#include "hal/mmu_hal.h"
|
||||
#include "hal/cache_hal.h"
|
||||
|
||||
static const char *TAG = "boot.esp32c3";
|
||||
|
||||
@@ -72,16 +73,6 @@ void IRAM_ATTR bootloader_configure_spi_pins(int drv)
|
||||
}
|
||||
}
|
||||
|
||||
static void bootloader_reset_mmu(void)
|
||||
{
|
||||
Cache_Suspend_ICache();
|
||||
Cache_Invalidate_ICache_All();
|
||||
Cache_MMU_Init();
|
||||
|
||||
REG_CLR_BIT(EXTMEM_ICACHE_CTRL1_REG, EXTMEM_ICACHE_SHUT_IBUS);
|
||||
REG_CLR_BIT(EXTMEM_ICACHE_CTRL1_REG, EXTMEM_ICACHE_SHUT_DBUS);
|
||||
}
|
||||
|
||||
static void update_flash_config(const esp_image_header_t *bootloader_hdr)
|
||||
{
|
||||
uint32_t size;
|
||||
@@ -104,10 +95,10 @@ static void update_flash_config(const esp_image_header_t *bootloader_hdr)
|
||||
default:
|
||||
size = 2;
|
||||
}
|
||||
uint32_t autoload = Cache_Suspend_ICache();
|
||||
cache_hal_disable(CACHE_TYPE_ALL);
|
||||
// Set flash chip size
|
||||
esp_rom_spiflash_config_param(rom_spiflash_legacy_data->chip.device_id, size * 0x100000, 0x10000, 0x1000, 0x100, 0xffff); // TODO: set mode
|
||||
Cache_Resume_ICache(autoload);
|
||||
cache_hal_enable(CACHE_TYPE_ALL);
|
||||
}
|
||||
|
||||
static void print_flash_info(const esp_image_header_t *bootloader_hdr)
|
||||
@@ -316,8 +307,10 @@ esp_err_t bootloader_init(void)
|
||||
esp_efuse_init_virtual_mode_in_ram();
|
||||
#endif
|
||||
#endif
|
||||
// reset MMU
|
||||
bootloader_reset_mmu();
|
||||
//init cache hal
|
||||
cache_hal_init();
|
||||
//reset mmu
|
||||
mmu_hal_init();
|
||||
// config clock
|
||||
bootloader_clock_configure();
|
||||
// initialize console, from now on, we can use esp_log
|
||||
|
Reference in New Issue
Block a user