[SOLVED]How does SDK1.4 determine flash size?
[SOLVED]How does SDK1.4 determine flash size?
Postby tve » Sat Nov 07, 2015 1:55 pm
I am trying to build firmware that will work with any flash size from 512KB to 4MB and one of the key items is how does the SDK determine the flash size for the purpose of placing the "system param" flash area?
I know that the flash size is stored in two places: in the header of the bootloader (at flash address 0) and in the header of the boot-mode 2 user1.bin/user2.bin files (this is put there by gen_appbin.py). From my tests it seems that the header of the bootloader is what the SDK uses, at least that's what system_get_flash_size_map returns. Is the flash size in the header of the user1.bin/user2.bin used for anything?
I know that the flash size is stored in two places: in the header of the bootloader (at flash address 0) and in the header of the boot-mode 2 user1.bin/user2.bin files (this is put there by gen_appbin.py). From my tests it seems that the header of the bootloader is what the SDK uses, at least that's what system_get_flash_size_map returns. Is the flash size in the header of the user1.bin/user2.bin used for anything?
Re: How does SDK1.4 determine flash size?
Postby ESP_Faye » Tue Nov 10, 2015 7:20 pm
Hi,
Start from Flash 0x00000
The "spi_size" is corresponding to the enum below:
Thanks for your interest in ESP8266 !
Start from Flash 0x00000
Code: Select all
struct flash_hdr {
char magic;
char blocks;
char spi_mode;
char spi_speed: 4; // low
char spi_size: 4;
unsigned int entry_addr;
};
The "spi_size" is corresponding to the enum below:
Code: Select all
enum flash_size_map {
FLASH_SIZE_4M_MAP_256_256 = 0,
FLASH_SIZE_2M,
FLASH_SIZE_8M_MAP_512_512,
FLASH_SIZE_16M_MAP_512_512,
FLASH_SIZE_32M_MAP_512_512,
FLASH_SIZE_16M_MAP_1024_1024,
FLASH_SIZE_32M_MAP_1024_1024
};
Thanks for your interest in ESP8266 !
Re: How does SDK1.4 determine flash size?
Postby tito » Tue Nov 10, 2015 10:47 pm
tve wrote:Mhh, that wasn't my question, I know that.
My question is where does the SDK get the flash map from ? Is it from the header in the boot sector?
I believe by reading SPI FLASH ID - spi_flash_get_id().
Who is online
Users browsing this forum: No registered users and 26 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.