llvm-mos-sdk
Macros
config.h File Reference
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for config.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PCE_ROM_BANK_AT(id, offset)
 Define the memory offset for a given physical bank. More...
 
#define PCE_ROM_FIXED_BANK_SIZE(size)
 Define the size of the fixed bank (at the top of memory). More...
 
#define PCE_SGX_RAM(size)
 Define the amount of C RAM for SGX targets. More...
 

Detailed Description

Functionality related to output ELF configuration.

Macro Definition Documentation

◆ PCE_ROM_BANK_AT

#define PCE_ROM_BANK_AT (   id,
  offset 
)
Value:
__PCE_ROM_BANK_USE(id, offset) \
__PCE_ROM_BANK_CALLBACK_USE(id)

Define the memory offset for a given physical bank.

A virtual bank is a group of one or more physical banks, automatically allocated by the linker.

The recommended way to define virtual banks is to create a header file (for example, "bank.h") with PCE_ROM_BANK_AT entries, and a source file ("bank.c") which defines PCE_CONFIG_IMPLEMENTATION, then includes <pce.h>, then includes "bank.h".

A bank N defined in this manner provides:

  • the pce_rom_bankN_map() function, mapping the requested virtual bank,
  • the pce_rom_bankN_call(void (*method)(void)) function defines a safe trampoline to a function in another bank,
  • the __rom_bankN section.
Parameters
idThe ID of the physical bank (0-127).
offsetThe memory offset, in 8KB units (2-6).

◆ PCE_ROM_FIXED_BANK_SIZE

#define PCE_ROM_FIXED_BANK_SIZE (   size)

Define the size of the fixed bank (at the top of memory).

Parameters
sizeThe size, in 8KB units (1-6).

◆ PCE_SGX_RAM

#define PCE_SGX_RAM (   size)

Define the amount of C RAM for SGX targets.

The SGX provides up to 32 kilobytes of RAM in four banks (0xF8-0xFB), but only one is mapped by default (at offset 0x2000), to preserve compatibility with the standard PCE. Use this define in a source file to map more RAM to C by default.

Note that using this will reserve more banks for C RAM and the soft stack; for example, PCE_SGX_RAM(2) will use bank offsets 1 and 2.

Parameters
sizeThe size, in 8KB units (2-4).