fix(startup): Fix cached data is cleared by function of "clean bss"

APP should not cache data whick is passed by bootloader linked to bss section.
This commit is contained in:
Dong Heng
2018-08-09 19:47:52 +08:00
parent 03be34e550
commit f602793a33
5 changed files with 15 additions and 50 deletions
components
bootloader_support/src
esp8266/source
spi_flash/src

@ -494,6 +494,12 @@ static void set_cache_and_start_app(
#include "esp_flash_partitions.h"
#ifdef CONFIG_SOC_FULL_ICACHE
#define SOC_CACHE_SIZE 1 // 32KB
#else
#define SOC_CACHE_SIZE 0 // 16KB
#endif
#define ESP_CACHE1_ADDR_MAX 0x100000
#define ESP_CACHE2_ADDR_MAX 0x200000
@ -777,7 +783,7 @@ bool bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_
void bootloader_utility_load_image(const esp_image_metadata_t* image_data)
{
void (*user_start)(size_t start_addr, size_t map);
void (*user_start)(size_t start_addr);
extern void Cache_Read_Enable(uint8_t map, uint8_t p, uint8_t v);
#if defined(CONFIG_SECURE_BOOT_ENABLED) || defined(CONFIG_FLASH_ENCRYPTION_ENABLED)
@ -838,10 +844,10 @@ void bootloader_utility_load_image(const esp_image_metadata_t* image_data)
while (1);
}
Cache_Read_Enable(map, 0, 0);
Cache_Read_Enable(map, 0, SOC_CACHE_SIZE);
user_start = (void *)image_data->image.entry_addr;
user_start(image_data->start_addr, map);
user_start(image_data->start_addr);
#endif /* BOOTLOADER_UNPACK_APP */
}