llvm-mos-sdk
mapper_macros.h
Go to the documentation of this file.
1 #ifndef _MAPPER_MACROS_H
2 #define _MAPPER_MACROS_H
3 
4 #include <mapper.h>
5 
6 #define MAPPER_CART_ROM_KB(kb) \
7  asm(".globl __cart_rom_size\n__cart_rom_size = " #kb)
8 
9 #define _STRINGIFY(x) #x
10 #define STRINGIFY(x) _STRINGIFY(x)
11 
12 #ifdef MAPPER_BANKED_ROM
13 // section attribute doesn't seem to recognize C "concatenated" "strings"
14 #define _CODE_BANK(index) __attribute__((section(".rom" index ".code")))
15 #define CODE_BANK(index) _CODE_BANK(STRINGIFY(index))
16 #define _RODATA_BANK(index) __attribute__((section(".rom" index ".rodata")))
17 #define RODATA_BANK(index) _RODATA_BANK(STRINGIFY(index))
18 #else
19 #define CODE_BANK(index)
20 #define RODATA_BANK(index)
21 #endif
22 
23 #endif
24