CHGame 0.3.0
Libraries for the CHGame handheld
Loading...
Searching...
No Matches
RAM functions

RAMFUNC(name): put a hot function in SRAM, about three times faster than flash. More...

Macros

#define CHGAME_RAMFUNC(name)   __attribute__((section(".gnu.linkonce.r.chg." #name), noinline))
 The library's own SRAM functions (section "chg.<name>").
 
#define CHGAME_APP_RAMFUNC(name)   __attribute__((section(".gnu.linkonce.r.app." #name), noinline))
 A sketch's SRAM functions (section "app.<name>"); RAMFUNC() is this.
 
#define RAMFUNC(name)   CHGAME_APP_RAMFUNC(name)
 Run this function from SRAM.
 

Detailed Description

RAMFUNC(name): put a hot function in SRAM, about three times faster than flash.

Flash has 3 wait states and no cache: from flash a per-pixel loop costs ~3 us a pixel on this part; from SRAM about a third of that. Every RAMFUNC costs its size in RAM, so keep it for the inner loops.

RAMFUNC(blitRow) static void blitRow(uint8_t *dst, ...) { ... }
#define RAMFUNC(name)
Run this function from SRAM.
Definition RamFunc.h:45

Macro Definition Documentation

◆ CHGAME_RAMFUNC

#define CHGAME_RAMFUNC (   name)    __attribute__((section(".gnu.linkonce.r.chg." #name), noinline))

The library's own SRAM functions (section "chg.<name>").

Parameters
nameA name unique among the library's RAM functions.

◆ CHGAME_APP_RAMFUNC

#define CHGAME_APP_RAMFUNC (   name)    __attribute__((section(".gnu.linkonce.r.app." #name), noinline))

A sketch's SRAM functions (section "app.<name>"); RAMFUNC() is this.

Parameters
nameA name unique within the sketch.

◆ RAMFUNC

#define RAMFUNC (   name)    CHGAME_APP_RAMFUNC(name)

Run this function from SRAM.

Put it before the function's declaration.

Parameters
nameA name unique within the sketch (any identifier; the function's own name is the usual choice).