FAQ, the functions that are not decorated with the "ICACHE_FLASH_ATTR" macro are loaded into RAM at boot time, and that the functions decorated with " ICACHE_FLASH_ATTR" are loaded into RAM when required.
But can someone from Espressif explain in more details what is going on for the cache system? Here are the technical questions I cannot answer based on the current documentation or discussions in the BBS:
- how is a "required" function detected? Is it a kind of page fault mechanism similar to more complex MMUs?
- is this cache mechanism implemented in hardware or in software or a mix of both? If software, is it perform by ROM-based code?
- are interrupts available while a function is loaded this way into RAM?
- is it only the required function loaded into RAM, or is it a full memory "page" containing the function that is loaded into RAM?
- if the system is using pages, how many pages can be loaded into RAM at any given time, and what size are these pages?
- what addresses in memory are used for the cache?
- in case there are more functions / pages loaded into RAM than physically available, what priority mechanism is used to choose the pages to replace, is it round-robbin, oldest, newest, least used?
- if the cache system is using pages, what happen if a function with "ICACHE_FLASH_ATTR" decoration crosses a page boundary? Does it automatically trigger loading the next page into RAM?
I know these questions are very detailed, but answers to these would help all developers understand the "magic" (until now) cache mechanism and use the ESP8266 in a much more efficient way!Statistics: Posted by Squonk — Thu Jun 18, 2015 3:48 am
]]>