本帖最后由 Genius 于 2016-8-8 17:35 编辑
有关esp8266烧写的大部分资料都在这里了,找了好半天才找到,解答了我的大部分疑问,供有需要的参考
http://wiki.jackslab.org/ESP8266_Flash
1 概述4KB 为一个扇区 (Sector), The last 16 sectors is the paramter area! 1MB flash is start at 0xF0000 4MB flash is start at 0x3F0000
1.1 系统参数区 (System param)始终为 Flash 的最后 16KB - 4KB 为初始化射频参数 (esp_init_data_default.bin); The last sector 12; 4MB Flash 为:0x3FC000 - 0x3FCFFF
- 8KB 为初始化系统参数 (blank.bin); The last sector 13 and 14, 4KB + 4KB mirror; 4MB Flash 为:0x3FD000 - 0x3FEFFF
- 4KB is bootloader parameters area; The last sector 15; 4MB flash is at: 0x3FF000
皆由 SDK 提供。 从 SDK 1.5.4.1 开始,增加一个 sector 用于 RF Cal Sector,其为 The last secotor 11;4MB Flash 为: 0x3FB000 - 0x3FBFFF
For MJYUN:
- 8KB is MJYUN parameter area; The last sector 4 and 5, 4KB + 4KB mirror; 4MB flash is: 0x3F4000 - 0x3F5FFF
1.2 用户参数区 (User param)指 Espressif 提供的示例 (IOT_Demo / AT) 中设定的用户参数区 iBaihe 的参数: 0x3C * 4KB = 0x3C000 COS Platform 参数: (0x3C + 1) * 4KB = 0x3D000 (SAVE_0)(0x3C + 2) * 4KB = 0x3E000 (SAVE_1)(0x3C + 3) * 4KB = 0x3F000 (PARAM_FLAG)
2 Layout Without OTAAddress Size Name Description00000h 4k boot.bin Bootloader 3C000h 14k Param Start Sector3D000h 1x4k Param Saved 03E000h 1x4k Param Saved 13F000h 1x4k Param Flag40000h 240k app.v6.irom0text.bin SDK libraries7C000h 8k esp_init_data_default.bin Default configuration7E000h 8k blank.bin Filled with FFh. May be WiFi configuration
3 Layout With OTA3.1 512 和 1024KB
3.2 4096KB
4 SPI Flash Format
5 SPI Flash Mode- QIO , for flash that support quad r/w operation(e.g. W25Q)
- QOUT, for flash that support quad read operation(e.g. W25Q)
- DIO, for flash that support dual r/w operation(e.g. W25Q &W25X)
- DOUT, for flash that support dual read operation(e.g. W25Q &W25X)
经测试:
- Winbond 25Q32B 可工作于 DIO / DOUT / QIO /QOUT (Noduino Falcon)
- BergMicro 25Q32A 只可工作于 DIO / DOUT (NodeMCU V1.0 可能是 ESP-12E 接线的问题)
- MXIC 25L80 (小 K mini)只可工作于 DOUT
6 Flash Memory MapMap the flash[backcolor=rgb(10, 43, 29) !important][size=1em][color=white !important][size=1em]?
[size=1em]1
[size=1em]2
[size=1em]3
[size=1em]4
[size=1em]5
| [size=1em][size=1em]/*
[size=1em] * Memory map first 8Mbit of flash
[size=1em] * address space is: 0x4020 0000 - 0x402F FFFF
[size=1em] */
[size=1em]Cache_Read_Enable (0, 0, 0);
|
Unmap the flash[backcolor=rgb(10, 43, 29) !important][size=1em][color=white !important][size=1em]?
| [size=1em][size=1em]Cache_Read_Disable();
|
6.1 Cache_Read_Enablevoid Cache_Read_Enable(uint8 odd_even, uint8 mb_count, unt8 no_idea); Valid values for odd_even: 0 – clears bits 24 & 25 of control register 0x3FF0000C 1 – clears bit 24, sets bit 25other – clears bit 25, sets bit 24
Function of odd_even: 0 – allows access to even numbered mb 1 – allow access to odd numbered mbother – appears to do the same as 1, there must be a difference but I haven’t worked out what it it
Valid values for mb_count: 0-7 – set bits 16, 17 & 18 of control register 0x3FF0000C
Function of mb_count:
Which odd or even bank to map (according to odd_even option) e.g. mb_count = 0, odd_even = 0 -> map first 8Mbit of flash e.g. mb_count = 0, odd_even = 1 -> map second 8Mbit of flash e.g. mb_count = 1, odd_even = 0 -> map third 8Mbit of flash e.g. mb_count = 1, odd_even = 1 -> map fourth 8Mbit of flashValid values for no_idea: 0 – sets bit 3 of 0x3FF00024 1 – sets bit 26 of 0x3FF0000C and sets bits 3 & 4 of 0x3FF00024
Function of no_idea:
The clue is in the name, I can’t work out what this does from my experiments, but the SDK always sets this to 1.
7 Reference
|