Post links and attach files for documentation here, also chat about these docs freely

User avatar
By wififofum
#882 Thanks for the writeup.

So is the 0x40000 offset for irom hardcoded in the tools to match the linker script or does the tool discover the offset when it runs?

Edit: I guess neither since you have to manually flash the bins and specify the addresses? I was thinking it was automated for some reason ( because I haven't used it yet).

The size of the irom section may be limited as necessary, for example to save room for the OTA upgrade to use part of the flash?

Flash map
0x00000000 - ? = default iram/dram image
? - 0x0007bfff = free space for irom image or other use
0x0007c000 - 0x0007dfff = default config
0x0007e000 - 0x0007ffff = config

With ota updates:
0x00000000 - 0x00000fff = boot.bin
0x00001000 - 0x00010fff = app1 iram/dram ?
0x00011000 - 0x0003bfff = app1 irom
0x0003c000 - 0x0003dfff = app1 default config ?
0x0003e000 - 0x0003efff? = master_device_key.bin (shouldn't need more than 1 sector, used for iotbucket cloud)
0x0003f000 - 0x0003ffff = free space ?
0x00040000 - 0x00040fff = boot.bin copy ? (Probably not)
0x00041000 - 0x00050fff = app2 iram/dram ?
0x00051000 - 0x0007bfff = app2 irom
0x0007c000 - 0x0007dfff = app2 default config ?
0x0007e000 - 0x0007ffff = config

So you have to compile ota updates targeting both app1 and app2, the device picks the one not currently active and flashes it. Boot.bin presumably manages selecting between them.

So:
What's in the config sections?
Where's the boot.bin source?
What happens when you go to a 16M flash device?
User avatar
By Squonk
#889 OK, I think I found some important information regarding the Flash layout in the "document\Espressif IoT SDK 使用手册_v0.8.pdf" ("document\Espressif IoT SDK Manual_v0.8.pdf") from the leaked "esp_iot_sdk_v0.9.1" :ugeek:

I am not fluent In Chinese yet, but Google translated it for me ;)

The interesting part is Section 4.3, page 20:
4.3 Compile and Flash Method

In order to compile, please make sure to copy the "user", "include" subdirectories and the Makefile from the "esp_iot_sdk\examples" directory into the "esp_iot_sdk\app" directory.

For flashing, please refer to section "3.3 Download Tool". After each completed file downloaded and flashed from "bin", you need to close the serial port and then re-open the serial port connection before proceeding to flash the next file.

4.3.1 Without Support for the Cloud Upgrade

esp_iot_sdk_v0.7 and previous versions do not support the cloud upgrade.

Compile as follows:
1) Open the "xtensa" compiler, with a default compile path of "d:\esp_iot_sdk\app".
2) Enter the "make" command, press "Enter". The makefile execution will create the ".output" folder to store "lib" and "obj" files.
3) Execute the "gen_misc.bat" script, press "Enter" to generate the appropriate "bin" files.

The "bin" files are as follows:
1) blank.bin, provided by Espressif, burn to 0x7E000 address;
2) eagle.app.v6.flash.bin, as compiled, burn to 0x0000 address;
3) master_device_key.bin, from the Espressif server application, burn to 0x3E000 address;
4) eagle.app.v6.irom0text.bin, as compiled, burn to 0x40000 address;
5) esp_init_data_default.bin, provided by Espressif, burn to 0x7c000 address

Note that:
1) "blank.bin" needs to be flashed only when the sdk version is upgraded or when WiFi configuration parameters have to be erased;
2) "master_device_key.bin" has to be flashed once, or when the "master_device_key" needs to be changed;
3) Generally, only the two files "eagle.app.v6.flash.bin" and "eagle.app.v6.irom0text.bin" from the "bin" directory need to be flashed.

4.3.2 With Support for Cloud Upgrade

esp_iot_sdk_v0.8 and later software version support cloud upgrade. esp_iot_sdk_v0.8 is also compatible with the previous compilation and firmware flashing method, and after such upgrades without Cloud support, you can continue using the compiling and programming methods from section "4.3.1 Without Support for the Cloud Upgrade".

Regarding this specific Cloud upgrade feature, see the document "Cloud Upgrading Implementations".

Compile as follows:
1) Compile "user1.bin" by executing the command "make APP=1"
2) Execution of the "gen_misc_plus.bat user1" command will generate a file "user1.bin" into the directory "\esp_iot_sdk\bin\upgrade".
3) Execute "make clean" in order to clear information compiled previously;
4) Then compile "user2.bin" by executing the command "make APP=2"
5) Execution of the "gen_misc_plus.bat user2" command will generate a file "user2.bin" into the directory "\esp_iot_sdk\bin\upgrade".

The "bin" file are as follows:
1) "blank.bin", provided by Espressif, burn to 0x7E000 address;
2) "boot.bin", provided by Espressif, burn to 0x00000 address;
3) "user1.bin", as compiled, burn to 0x01000 address;
4) "master_device_key.bin", from the Espressif server application, burn to 0x3E000 address;

Note that:
Flash only in accordance with the above-mentioned first four steps, without flashing "user2.bin".

For subsequent software updates, the new version of "user1.bin" and "user2.bin" two "bin" files are uploaded to the server, the server sends a software update message to the user, and if the user chooses to update, the device will select to download "user1.bin" or "user2.bin" depending on its current state in order to complete the Cloud upgrade process.


To summarize, we have 2 different Flash memory configurations:

SDK <= v0.7:
Code: Select all0x00000-0x3DFFF (248KB) flash.bin
0x3E000-0x3FFFF (8KB)   master_device_key.bin
0x40000-0x7DFFF (248KB) irom0text.bin
0x7E000-0x7FFFF (8KB)   WiFi Configuration


SDK >= v0.8:
Code: Select all0x00000-0x00FFF (4KB)   boot.bin
0x01000-0x10FFF (64KB)  flash1.bin     \ user1.bin
0x11000-0x3DFFF (180KB) irom0text1.bin /
0x3E000-0x3FFFF (8KB)   master_device_key.bin
0x40000-0x40FFF (4KB)   ???
0x41000-0x50FFF (64KB)  flash2.bin     \ user2.bin
0x51000-0x7DFFF (180KB) irom0text2.bin /
0x7E000-0x7FFFF (8KB)   WiFi Configuration


If you wonder why I say that the "flashx.bin" files are limited to 64KB, please refer to the "gen_flashbin.py" script from leaked "esp_iot_sdk_v0.9.1", where this file is padded to 0x10000 with "0xFF" bytes :ugeek:

But why are "irom0text" sections separate from the "flash" sections in the beginning? My guess is that there are TWO separate cache regions, one for app, one for libs, but I have no clue why!
User avatar
By wififofum
#891
Squonk wrote:If you wonder why I say that the "flashx.bin" files are limited to 64KB, please refer to the "gen_flashbin.py" script from leaked "esp_iot_sdk_v0.9.1", where this file is padded to 0x10000 with "0xFF" bytes :ugeek:

But why are "irom0text" sections separate from the "flash" sections in the beginning? My guess is that there are TWO separate cache regions, one for app, one for libs, but I have no clue why!


Yes so you have to fit your iram + dram images into 64k, which places some constraints. But probably you can just reduce the size of irom section if necessary, although it is already 133k in AT firmware. The question is is there any benefit to not filling up iram?


flash sections as you called them are iram + dram (init)
irom executes from flash through dynamic caching details not yet known
iram executes from ram and is statically cached
Both app and libs can use iram and irom
User avatar
By AlOdin
#1537 found this preview for 106Micro
You do not have the required permissions to view the files attached to this post.