{"id":1627,"date":"2015-10-12T15:38:51","date_gmt":"2015-10-12T22:38:51","guid":{"rendered":"http:\/\/www.hhhh.org\/joeboy\/blog\/?p=1627"},"modified":"2015-10-12T17:40:32","modified_gmt":"2015-10-13T00:40:32","slug":"espressifs-icache_flash_attr","status":"publish","type":"post","link":"https:\/\/www.hhhh.org\/joeboy\/blog\/?p=1627","title":{"rendered":"Espressif&#8217;s &#8220;ICACHE_FLASH_ATTR&#8221; and larger flash sizes"},"content":{"rendered":"<p>Just noticed this description on the espressif website describing the<br \/>\n<a href=\"http:\/\/bbs.espressif.com\/viewtopic.php?f=10&#038;t=166\" title=\"Location of the ICACHE_FLASH_ATTR\">location of the ICACHE_FLASH_ATTR functions in memory<\/a>.<\/p>\n<p>It looks like methods <strong>WITHOUT<\/strong> the ICACHE_FLASH_ATTR marker get cached to memory in 32KB of ram in iram1_0_seg at power up. Methods with &#8220;ICACHE_FLASH_ATTR&#8221; are located in irom0_0_seg. <\/p>\n<p>Thats the opposite of the behavior I was expecting. However looking in the eagle.app.v6.ld linking script (version esp_iot_sdk_v1.4.0\/ld\/eagle.app.v6.ld) we see:<\/p>\n<p>MEMORY<br \/>\n{<br \/>\n  dport0_0_seg :                        org = 0x3FF00000, len = 0x10<br \/>\n  dram0_0_seg :                         org = 0x3FFE8000, len = 0x14000<br \/>\n  iram1_0_seg :                         org = 0x40100000, len = 0x8000<br \/>\n  irom0_0_seg :                         org = 0x40240000, len = <strong>0x3C000<\/strong><br \/>\n}<\/p>\n<p>which is a layout change from the older memory layout found in esp_iot_sdk_v0.9.5\/ld\/eagle.app.v6.l<\/p>\n<p>MEMORY<br \/>\n{<br \/>\n  dport0_0_seg :                        org = 0x3FF00000, len = 0x10<br \/>\n  dram0_0_seg :                         org = 0x3FFE8000, len = 0x14000<br \/>\n  iram1_0_seg :                         org = 0x40100000, len = 0x8000<br \/>\n  irom0_0_seg :                         org = 0x40240000, len = <strong>0x32000<\/strong><br \/>\n}<\/p>\n<p>I&#8217;m using a few different esp8266 modules, but developing code on a HUZZA board. Checking its flash<br \/>\nI get:<\/p>\n<p>\/opt\/esptools\/esptool-new\/esptool.py &#8211;port \/dev\/tty.usbserial-A600dRM4 flash_id<br \/>\nConnecting&#8230;<br \/>\nManufacturer: c8<br \/>\nDevice: 4016<\/p>\n<p>Which from what I am seeing online should translate to a Winbond W25Q32 flash chip.<\/p>\n<p>More specifically this <a href=\"http:\/\/code.coreboot.org\/svn\/flashrom\/trunk\/flashchips.h\" title=\"Flashrom IDs\">list of flash-ROM IDs<\/a> says that 0x4016 could map to a few devices but both the Windbond device, or the Gicgadevices (based on Maucacture code), are 32Mb devices, so there should be 4MB of flash available which is not reflected in the limits above. <\/p>\n<p>Checking the newer linker scripts, the espressif SDK provides .\/esp-open-sdk\/sdk\/ld\/eagle.app.v6.new.2048.ld with a bigger definition. <\/p>\n<p>MEMORY<br \/>\n{<br \/>\n  dport0_0_seg :                        org = 0x3FF00000, len = 0x10<br \/>\n  dram0_0_seg :                         org = 0x3FFE8000, len = 0x14000<br \/>\n  iram1_0_seg :                         org = 0x40100000, len = 0x8000<br \/>\n  irom0_0_seg :                         org = 0x40201010, len = 0xE0000<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just noticed this description on the espressif website describing the location of the ICACHE_FLASH_ATTR functions in memory. It looks like methods WITHOUT the ICACHE_FLASH_ATTR marker get cached to memory in 32KB of ram in iram1_0_seg at power up. Methods with &#8220;ICACHE_FLASH_ATTR&#8221; are located in irom0_0_seg. Thats the opposite of the behavior I was expecting. However [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[],"class_list":["post-1627","post","type-post","status-publish","format-standard","hentry","category-esp8266"],"_links":{"self":[{"href":"https:\/\/www.hhhh.org\/joeboy\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hhhh.org\/joeboy\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hhhh.org\/joeboy\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hhhh.org\/joeboy\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hhhh.org\/joeboy\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1627"}],"version-history":[{"count":7,"href":"https:\/\/www.hhhh.org\/joeboy\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1627\/revisions"}],"predecessor-version":[{"id":1634,"href":"https:\/\/www.hhhh.org\/joeboy\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1627\/revisions\/1634"}],"wp:attachment":[{"href":"https:\/\/www.hhhh.org\/joeboy\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hhhh.org\/joeboy\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hhhh.org\/joeboy\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}