gba:guide:memory_management
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gba:guide:memory_management [2024/05/07 19:15] – created asie | gba:guide:memory_management [2024/05/08 03:52] (current) – asie | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Linking and memory management ====== | ====== Linking and memory management ====== | ||
- | ===== wf-gbatool link ===== | + | ===== Using wf-gbatool link ===== |
In Wonderful' | In Wonderful' | ||
Line 10: | Line 10: | ||
# ...becomes: | # ...becomes: | ||
$ wf-gbatool link rom|multiboot -o program.gba --output-elf program.elf -- [objects...] [flags...] | $ wf-gbatool link rom|multiboot -o program.gba --output-elf program.elf -- [objects...] [flags...] | ||
+ | | ||
+ | # By default, wfconfig.toml in the current working directory is used | ||
+ | # (see below). To use a different file: | ||
+ | $ wf-gbatool link rom|multiboot -c other_wfconfig.toml -o program.gba --output-elf program.elf -- [objects...] [flags...] | ||
- | ===== Cartridge | + | ===== Cartridge |
GBA cartridges contain some user-configurable metadata. To edit it, create a '' | GBA cartridges contain some user-configurable metadata. To edit it, create a '' | ||
Line 21: | Line 25: | ||
code = " | code = " | ||
maker = " | maker = " | ||
+ | </ | ||
+ | |||
+ | ===== Default memory placement ===== | ||
+ | |||
+ | The GBA contains two separate blocks of memory: 32 kilobytes of fast IWRAM and 256 kilobytes of slower EWRAM. In Wonderful' | ||
+ | |||
+ | <code TOML> | ||
+ | [memory] | ||
+ | data-region = " | ||
</ | </ | ||
Line 61: | Line 74: | ||
// EWRAM is also supported! | // EWRAM is also supported! | ||
#define gba_overlay_load_ewram(NAME) gba_overlay_load(ewram, | #define gba_overlay_load_ewram(NAME) gba_overlay_load(ewram, | ||
+ | </ | ||
+ | |||
+ | From there, the helper can be used as follows: | ||
+ | |||
+ | <code C> | ||
+ | __attribute__((noinline, | ||
+ | // ...code... | ||
+ | } | ||
+ | |||
+ | __attribute__((noinline, | ||
+ | // ...code... | ||
+ | } | ||
+ | |||
+ | // ...function... | ||
+ | gba_overlay_load_iwram(one); | ||
+ | func_a(); | ||
+ | |||
+ | gba_overlay_load_iwram(four); | ||
+ | func_b(); | ||
</ | </ |
gba/guide/memory_management.1715109308.txt.gz · Last modified: 2024/05/07 19:15 by asie