Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By pvvx
#26748
kolban wrote: I am using esptool to upload the images and

esptool.py BAG in erased block. Erased area > write area :)
------
Flash header = 512k (4Mbits);
On startup (in call_user_start()) write flashchip->chip_size = 512*1024;
SDK will be limited in the 'sandbox' 512K.
All SDK write configs addres = flashchip->chip_size - 0x4000
flashchip->chip_size - 0x4000: esp_init_data_default.bin (https://github.com/pvvx/MinEspSDKLib/bl ... ys_const.h )
flashchip->chip_size - 0x3000: wifi_sdk_config 0 (struct s_wifi_store https://github.com/pvvx/MinEspSDKLib/bl ... /libmain.h)
flashchip->chip_size - 0x2000: wifi_sdk_config 1 (struct s_wifi_store https://github.com/pvvx/MinEspSDKLib/bl ... /libmain.h)
flashchip->chip_size - 0x1000: wifi_sdk_config_header + CRC blocks wifi_sdk_config 0 and 1 (struct ets_store_wifi_hdr).

User config uses only in AT SDK.

"Flash cache " limit 1024k from start addr flash (0x40200000).

full 16Mbytes spi_flash_rd/wr(xxxx)
{
flashchip->chip_size = 0x01000000;
spi_flash_xxx(xxxx);
flashchip->chip_size = 512*1024;
}
Last edited by pvvx on Fri Aug 21, 2015 6:55 pm, edited 5 times in total.
User avatar
By kolban
#26755 I want to say thank you to all who assisted. I have the answer now. Once understood, it makes sense but the getting there isn't obvious so now I'm going to take the time to write it up in detail. However, so as not leave a cliff hanger ... here are the summary notes.

My ESP12 has 512K of flash. This appears at address space 0x4020 0000 for 512K. This is specifically 0x4020 0000 to 0x4028 0000. Now ... if we look inside the Espressif supplied linker controller file called eagle.app.v6.ld ... we find that the **default** load address for irom0.txt code is 0x4024 0000 ...

Now pause here ... 0x4024 0000 <> 0x4020 0000 ... in fact is is 256K into the flash size. If I now try and load a 306K section of code into a 512K address space **starting** at 256K into that address space ... it won't fit. Unfortunately, it doesn't fit "quietly" and it is only at runtime that things can get odd. What seems to happen is that when the flash writes 509K, 510K, 511K ... its next wire is at 0K ... i.e. it loops around. This "might" have been ok ... except that it trod allover the top of the flash storage where ESP8266 SDK settings are kept!!!

Now ... I know that is a lot of detail ... I'm going to try and write it up cleanly, slowly and with diagrams so that hopefully others in the future might benefit.

Again ... thank YOU for assistance.

Neil
Last edited by kolban on Fri Aug 21, 2015 10:43 pm, edited 2 times in total.