- Thu Feb 18, 2016 11:49 am
#41385
I posted some information about what goes where in reply to a post on another forum:
http://bbs.espressif.com/viewtopic.php?t=1108To summarize, there are three main areas of the Flash in most applications (but there may be additional areas for special purposes like using Flash for additional data storage, e.g. SPIFFS). The block that is stored at address 0x0000 in Flash will always be at that address. It contains initialization data for RAM and the code that resides in RAM.
The second major block, typically stored at address 0x40000 in Flash, contains code that will be copied to cache RAM for execution as needed and, optionally, 32-bit aligned constant data used by the app. It can be placed at any convenient address, which address is controlled by the linker script. Except for very special circumstances, it will never be positioned at a Flash address lower than 0x10000. The Flash address for this block is set by the value given for the origin of irom0_0_seg in the linker script. The origin address is calculated by adding 0x40200000 to the desired Flash address. That's why you'll find the following line in the MEMORY section of a typical linker script for a 512KB Flash chip:
Code: Select all irom0_0_seg : org = 0x40240000, len = 0x3C000
The length value specified in the line above is (Flash size - 16K - start address) or, in the case of a 512KB flash chip 0x80000 - 16384 - 0x40000. The 16K value represents the size of the System Parameter Area, described below.
The third major block is called the System Parameter Area. It is always located 16K bytes from the end of the Flash chip. If you have a 512KB flash chip it will be at address 0x7c000. Unless you know exactly what you are doing you should always write the esp_init_data_default.bin provided by Espressif to the System Parameter Area.