Skip to content

Commit 4e15ca4

Browse files
committed
Merge branch 'bugfix/fix_bss_clear' into 'master'
Fix cached data is cleared by function of "clean bss" See merge request sdk/ESP8266_RTOS_SDK!378
2 parents b3adc8c + f602793 commit 4e15ca4

File tree

5 files changed

+15
-50
lines changed

5 files changed

+15
-50
lines changed

components/bootloader_support/src/bootloader_utility.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,12 @@ static void set_cache_and_start_app(
494494

495495
#include "esp_flash_partitions.h"
496496

497+
#ifdef CONFIG_SOC_FULL_ICACHE
498+
#define SOC_CACHE_SIZE 1 // 32KB
499+
#else
500+
#define SOC_CACHE_SIZE 0 // 16KB
501+
#endif
502+
497503
#define ESP_CACHE1_ADDR_MAX 0x100000
498504
#define ESP_CACHE2_ADDR_MAX 0x200000
499505

@@ -777,7 +783,7 @@ bool bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_
777783

778784
void bootloader_utility_load_image(const esp_image_metadata_t* image_data)
779785
{
780-
void (*user_start)(size_t start_addr, size_t map);
786+
void (*user_start)(size_t start_addr);
781787
extern void Cache_Read_Enable(uint8_t map, uint8_t p, uint8_t v);
782788

783789
#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)
838844
while (1);
839845
}
840846

841-
Cache_Read_Enable(map, 0, 0);
847+
Cache_Read_Enable(map, 0, SOC_CACHE_SIZE);
842848

843849
user_start = (void *)image_data->image.entry_addr;
844-
user_start(image_data->start_addr, map);
850+
user_start(image_data->start_addr);
845851
#endif /* BOOTLOADER_UNPACK_APP */
846852
}
847853

components/esp8266/source/chip_boot.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static const char *TAG = "chip_boot";
3434
* @brief initialize the chip including flash I/O and chip cache according to
3535
* boot parameters which are stored at the flash
3636
*/
37-
void chip_boot(size_t start_addr, size_t map)
37+
void chip_boot(size_t start_addr)
3838
{
3939
int ret;
4040
uint32_t freqdiv, flash_size;
@@ -91,9 +91,6 @@ void chip_boot(size_t start_addr, size_t map)
9191
}
9292
SET_PERI_REG_BITS(PERIPHS_SPI_FLASH_CTRL, 0xfff, freqbits, 0);
9393

94-
ESP_EARLY_LOGD(TAG, "SPI flash cache map is %d\n", map);
95-
cache_init(map);
96-
9794
if (fhdr.spi_mode == ESP_IMAGE_SPI_MODE_QIO) {
9895
ESP_EARLY_LOGD(TAG, "SPI flash enable QIO mode\n");
9996
user_spi_flash_dio_to_qio_pre_init();

components/esp8266/source/esp_cache.c

Lines changed: 0 additions & 39 deletions
This file was deleted.

components/esp8266/source/startup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#define FLASH_MAP_ADDR 0x40200000
3232

33-
extern void chip_boot(size_t start_addr, size_t map);
33+
extern void chip_boot(size_t start_addr);
3434
extern int rtc_init(void);
3535
extern int mac_init(void);
3636
extern int base_gpio_init(void);
@@ -68,7 +68,7 @@ static void user_init_entry(void *param)
6868
wifi_task_delete(NULL);
6969
}
7070

71-
void call_user_start(size_t start_addr, size_t map)
71+
void call_user_start(size_t start_addr)
7272
{
7373
int i;
7474
int *p;
@@ -98,7 +98,7 @@ void call_user_start(size_t start_addr, size_t map)
9898
"wsr a0, vecbase\n"
9999
: : :"memory");
100100

101-
chip_boot(start_addr, map);
101+
chip_boot(start_addr);
102102

103103
/* clear bss data */
104104
for (p = &_bss_start; p < &_bss_end; p++)

components/spi_flash/src/spi_flash.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,12 @@ static void IRAM_ATTR Cache_Read_Disable_2(void)
229229
CLEAR_PERI_REG_MASK(PERIPHS_SPI_FLASH_CTRL,SPI_ENABLE_AHB);
230230
}
231231

232-
static void IRAM_ATTR Cache_Read_Enable_2()
232+
void IRAM_ATTR Cache_Read_Enable_2()
233233
{
234234
SET_PERI_REG_MASK(PERIPHS_SPI_FLASH_CTRL,SPI_ENABLE_AHB);
235235
SET_PERI_REG_MASK(CACHE_FLASH_CTRL_REG,CACHE_READ_EN_BIT);
236236
}
237+
void Cache_Read_Enable_New(void) __attribute__((alias("Cache_Read_Enable_2")));
237238

238239
static uint32_t IRAM_ATTR spi_flash_get_id(void)
239240
{

0 commit comments

Comments
 (0)