IRAM Precache Support
Collaboration diagram for IRAM Precache Support:

Macros

#define IRAM_PRECACHE_ATTR
 
#define IRAM_PRECACHE_START(tag)
 
#define IRAM_PRECACHE_END(tag)
 
#define IRAM_PRECACHE_ATTR   __attribute__((optimize("no-reorder-blocks"))) __attribute__((noinline))
 Tools for pre-loading code into the flash cache. More...
 
#define IRAM_PRECACHE_START(tag)
 Place this macro before the first line of the critical code. More...
 
#define IRAM_PRECACHE_END(tag)   iram_precache_end_##tag:
 Place this macro after the last line of critical code. More...
 
#define IRAM_PRECACHE_ATTR
 
#define IRAM_PRECACHE_START(tag)
 
#define IRAM_PRECACHE_END(tag)
 

Functions

void iram_precache (void *addr, uint32_t bytes)
 Pre-load flash data into the flash instruction cache. More...
 

Detailed Description

Macro Definition Documentation

◆ IRAM_PRECACHE_ATTR [1/3]

#define IRAM_PRECACHE_ATTR

◆ IRAM_PRECACHE_ATTR [2/3]

#define IRAM_PRECACHE_ATTR   __attribute__((optimize("no-reorder-blocks"))) __attribute__((noinline))

Tools for pre-loading code into the flash cache.

  • It can be useful for code that accesses/uses SPI0 which is connected to the flash chip.
  • Non interrupt handler code that is infrequently called but might otherwise require being in valuable IRAM - such as bit-banging I/O code or some code run at bootup can avoid being permanently in IRAM.

Mark functions containing critical code using this attribute

◆ IRAM_PRECACHE_ATTR [3/3]

#define IRAM_PRECACHE_ATTR

◆ IRAM_PRECACHE_END [1/3]

#define IRAM_PRECACHE_END (   tag)

◆ IRAM_PRECACHE_END [2/3]

#define IRAM_PRECACHE_END (   tag)    iram_precache_end_##tag:

Place this macro after the last line of critical code.

Parameters
tagMust be the same tag used in IRAM_PRECACHE_START()

◆ IRAM_PRECACHE_END [3/3]

#define IRAM_PRECACHE_END (   tag)

◆ IRAM_PRECACHE_START [1/3]

#define IRAM_PRECACHE_START (   tag)

◆ IRAM_PRECACHE_START [2/3]

#define IRAM_PRECACHE_START (   tag)
Value:
iram_precache(NULL, (uint8_t*)&&iram_precache_end_##tag - (uint8_t*)&&iram_precache_start_##tag); \
iram_precache_start_##tag:
void iram_precache(void *addr, uint32_t bytes)
Pre-load flash data into the flash instruction cache.

Place this macro before the first line of the critical code.

Parameters
tagUsed to create the precached section name, must be globally unique
Note
Do not omit the tag, and be careful with naming to avoid conflicts

◆ IRAM_PRECACHE_START [3/3]

#define IRAM_PRECACHE_START (   tag)

Function Documentation

◆ iram_precache()

void iram_precache ( void *  addr,
uint32_t  bytes 
)

Pre-load flash data into the flash instruction cache.

Parameters
addrFirst location to cache, specify NULL to use current location.
bytesNumber of bytes to cache
Note
All pages containing the requested region will be read to pull them into cache RAM.