Skip to content

Instantly share code, notes, and snippets.

@kisssko
Created November 25, 2020 20:01
Show Gist options
  • Save kisssko/72cb7a0ae2bdf2370035689c6631fbf7 to your computer and use it in GitHub Desktop.
Save kisssko/72cb7a0ae2bdf2370035689c6631fbf7 to your computer and use it in GitHub Desktop.
Include binary file macros
// (T)ype, (V)ariable, (S)ection, (F)ile.
#define INCBIN(T,V,S,F) \
asm \
( \
".globl " #V "\n" \
".section \"" S "\",\"a\"\n" \
".balign 4\n" #V ":\n" \
".incbin \"" F "\"\n" \
); extern T V[]
// (T)ype, (V)ariable, (S)ection, (F)ile, (O)ffset.
#define INCBIN2(T,V,S,F,O) \
asm \
( \
".globl " #V "\n" \
".section \"" S "\",\"a\"\n" \
".balign 4\n" #V ":\n" \
".incbin \"" F "\"," #O "\n" \
); extern T V[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment