Utility for including binary files.
More...
#include <limits.h>
Go to the source code of this file.
|
|
#define | INCBIN_ALIGNMENT_INDEX 3 |
|
#define | INCBIN_ALIGN_SHIFT_0 1 |
|
#define | INCBIN_ALIGN_SHIFT_1 2 |
|
#define | INCBIN_ALIGN_SHIFT_2 4 |
|
#define | INCBIN_ALIGN_SHIFT_3 8 |
|
#define | INCBIN_ALIGN_SHIFT_4 16 |
|
#define | INCBIN_ALIGN_SHIFT_5 32 |
|
#define | INCBIN_ALIGN_SHIFT_6 64 |
|
#define | INCBIN_ALIGNMENT INCBIN_CONCATENATE(INCBIN_CONCATENATE(INCBIN_ALIGN_SHIFT, _), INCBIN_ALIGNMENT_INDEX) |
| #define | INCBIN_STR(X) |
| #define | INCBIN_STRINGIZE(X) |
| #define | INCBIN_CAT(X, Y) |
| #define | INCBIN_CONCATENATE(X, Y) |
| #define | INCBIN_EVAL(X) |
| #define | INCBIN_INVOKE(N, ...) |
| #define | INCBIN_VA_ARG_COUNTER(_1, _2, _3, N, ...) |
| #define | INCBIN_VA_ARGC(...) |
|
#define | INCBIN_MACRO ".incbin" |
|
#define | INCBIN_ALIGN __attribute__((aligned(INCBIN_ALIGNMENT))) |
|
#define | INCBIN_ALIGN_HOST ".align " INCBIN_STRINGIZE(INCBIN_ALIGNMENT) "\n" |
|
#define | INCBIN_ALIGN_BYTE ".align 1\n" |
|
#define | INCBIN_EXTERNAL extern |
|
#define | INCBIN_CONST const |
| #define | INCBIN_OUTPUT_SECTION ".rodata" |
| | Optionally override the linker section into which size and data is emitted.
|
| #define | INCBIN_OUTPUT_DATA_SECTION INCBIN_OUTPUT_SECTION |
| | Optionally override the linker section into which data is emitted.
|
| #define | INCBIN_OUTPUT_SIZE_SECTION INCBIN_OUTPUT_SECTION |
| | Optionally override the linker section into which size is emitted.
|
|
#define | INCBIN_SECTION ".section " INCBIN_OUTPUT_SECTION "\n" |
| #define | INCBIN_GLOBAL(NAME) |
|
#define | INCBIN_INT ".int " |
|
#define | INCBIN_MANGLE "" |
| #define | INCBIN_TYPE(NAME) |
|
#define | INCBIN_BYTE ".byte " |
|
#define | INCBIN_STYLE_CAMEL 0 |
|
#define | INCBIN_STYLE_SNAKE 1 |
| #define | INCBIN_PREFIX g |
| | Specify the prefix to use for symbol names.
|
| #define | INCBIN_STYLE INCBIN_STYLE_CAMEL |
| | Specify the style used for symbol names.
|
|
#define | INCBIN_STYLE_0_DATA Data |
|
#define | INCBIN_STYLE_0_END End |
|
#define | INCBIN_STYLE_0_SIZE Size |
|
#define | INCBIN_STYLE_1_DATA _data |
|
#define | INCBIN_STYLE_1_END _end |
|
#define | INCBIN_STYLE_1_SIZE _size |
| #define | INCBIN_STYLE_IDENT(TYPE) |
| #define | INCBIN_STYLE_STRING(TYPE) |
| #define | INCBIN_GLOBAL_LABELS(NAME, TYPE) |
| #define | INCBIN_EXTERN(...) |
| #define | INCBIN_EXTERN_1(NAME, ...) |
| #define | INCBIN_EXTERN_2(TYPE, NAME) |
| #define | INCTXT_EXTERN(NAME) |
| #define | INCBIN(...) |
| #define | INCBIN_1(...) |
| #define | INCBIN_2(NAME, FILENAME) |
| #define | INCBIN_3(TYPE, NAME, FILENAME) |
| #define | INCBIN_COMMON(TYPE, NAME, FILENAME, TERMINATOR) |
| #define | INCTXT(NAME, FILENAME) |
Utility for including binary files.
from https://raw.githubusercontent.com/graphitemaster/incbin/main/incbin.h
Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. SPDX-License-Identifier: BSD-3-Clause-Clear
Originally released into the public domain (Unlicense).
- Author
- Dale Weiler
Facilities for including binary files into the current translation unit and making use from them externally in other translation units.
◆ INCBIN
Value:INCBIN_CONCATENATE(INCBIN_, INCBIN_VA_ARGC(__VA_ARGS__))(__VA_ARGS__)
◆ INCBIN_1
◆ INCBIN_2
| #define INCBIN_2 |
( |
| NAME, |
|
|
| FILENAME ) |
Value:INCBIN_3(unsigned char, NAME, FILENAME)
◆ INCBIN_3
| #define INCBIN_3 |
( |
| TYPE, |
|
|
| NAME, |
|
|
| FILENAME ) |
Value:INCBIN_COMMON(TYPE, NAME, FILENAME, )
◆ INCBIN_CAT
| #define INCBIN_CAT |
( |
| X, |
|
|
| Y ) |
◆ INCBIN_COMMON
| #define INCBIN_COMMON |
( |
| TYPE, |
|
|
| NAME, |
|
|
| FILENAME, |
|
|
| TERMINATOR ) |
Value: __asm__(INCBIN_SECTION INCBIN_GLOBAL_LABELS(NAME, DATA) \
INCBIN_ALIGN_HOST INCBIN_MANGLE INCBIN_STRINGIZE(
INCBIN_PREFIX) #NAME INCBIN_STYLE_STRING( \
DATA) ":\n" INCBIN_MACRO " \"" FILENAME "\"\n" TERMINATOR INCBIN_GLOBAL_LABELS(NAME, END) \
INCBIN_ALIGN_BYTE INCBIN_MANGLE INCBIN_STRINGIZE(
INCBIN_PREFIX) #NAME INCBIN_STYLE_STRING( \
END) ":\n" INCBIN_BYTE "1\n" INCBIN_GLOBAL_LABELS(NAME, SIZE) \
INCBIN_ALIGN_HOST INCBIN_MANGLE INCBIN_STRINGIZE(
INCBIN_PREFIX) #NAME INCBIN_STYLE_STRING( \
SIZE) ":\n" INCBIN_INT INCBIN_MANGLE \
INCBIN_STRINGIZE(
INCBIN_PREFIX) #NAME INCBIN_STYLE_STRING(END)
" - " INCBIN_MANGLE \
INCBIN_STRINGIZE(
INCBIN_PREFIX) #NAME INCBIN_STYLE_STRING(DATA)
"\n" INCBIN_ALIGN_HOST \
".text\n"); \
INCBIN_EXTERN(TYPE, NAME)
#define INCBIN_PREFIX
Specify the prefix to use for symbol names.
Definition incbin.h:209
◆ INCBIN_CONCATENATE
| #define INCBIN_CONCATENATE |
( |
| X, |
|
|
| Y ) |
◆ INCBIN_EVAL
◆ INCBIN_EXTERN
| #define INCBIN_EXTERN |
( |
| ... | ) |
|
Value:INCBIN_CONCATENATE(INCBIN_EXTERN_, INCBIN_VA_ARGC(__VA_ARGS__))(__VA_ARGS__)
◆ INCBIN_EXTERN_1
| #define INCBIN_EXTERN_1 |
( |
| NAME, |
|
|
| ... ) |
Value:INCBIN_EXTERN_2(unsigned char, NAME)
◆ INCBIN_EXTERN_2
| #define INCBIN_EXTERN_2 |
( |
| TYPE, |
|
|
| NAME ) |
Value: INCBIN_EXTERNAL
const INCBIN_ALIGN TYPE INCBIN_CONCATENATE(INCBIN_CONCATENATE(
INCBIN_PREFIX, NAME), \
INCBIN_STYLE_IDENT(DATA))[]; \
INCBIN_EXTERNAL
const INCBIN_ALIGN TYPE*
const INCBIN_CONCATENATE(INCBIN_CONCATENATE(
INCBIN_PREFIX, NAME), \
INCBIN_STYLE_IDENT(END)); \
INCBIN_EXTERNAL
const unsigned int INCBIN_CONCATENATE(INCBIN_CONCATENATE(
INCBIN_PREFIX, NAME), \
INCBIN_STYLE_IDENT(SIZE))
◆ INCBIN_GLOBAL
| #define INCBIN_GLOBAL |
( |
| NAME | ) |
|
◆ INCBIN_GLOBAL_LABELS
| #define INCBIN_GLOBAL_LABELS |
( |
| NAME, |
|
|
| TYPE ) |
Value: INCBIN_INVOKE(INCBIN_GLOBAL, INCBIN_CONCATENATE(NAME, INCBIN_INVOKE(INCBIN_STYLE_IDENT, TYPE))) \
INCBIN_INVOKE(INCBIN_TYPE, INCBIN_CONCATENATE(NAME, INCBIN_INVOKE(INCBIN_STYLE_IDENT, TYPE)))
◆ INCBIN_INVOKE
| #define INCBIN_INVOKE |
( |
| N, |
|
|
| ... ) |
Value:INCBIN_EVAL(N(__VA_ARGS__))
◆ INCBIN_OUTPUT_DATA_SECTION
Optionally override the linker section into which data is emitted.
- Warning
- If you use this facility, you might have to deal with platform-specific linker output section naming on your own.
◆ INCBIN_OUTPUT_SECTION
| #define INCBIN_OUTPUT_SECTION ".rodata" |
Optionally override the linker section into which size and data is emitted.
- Warning
- If you use this facility, you might have to deal with platform-specific linker output section naming on your own.
◆ INCBIN_OUTPUT_SIZE_SECTION
Optionally override the linker section into which size is emitted.
- Warning
- If you use this facility, you might have to deal with platform-specific linker output section naming on your own.
- Note
- This is useful for Harvard architectures where program memory cannot be directly read from the program without special instructions. With this you can chose to put the size variable in RAM rather than ROM.
◆ INCBIN_PREFIX
Specify the prefix to use for symbol names.
- Note
- By default this is "g".
#define INCBIN_PREFIX incbin
INCBIN(Foo, "foo.txt");
Utility for including binary files.
◆ INCBIN_STR
◆ INCBIN_STRINGIZE
| #define INCBIN_STRINGIZE |
( |
| X | ) |
|
◆ INCBIN_STYLE
| #define INCBIN_STYLE INCBIN_STYLE_CAMEL |
Specify the style used for symbol names.
Possible options are
- INCBIN_STYLE_CAMEL "CamelCase"
- INCBIN_STYLE_SNAKE "snake_case"
- Note
- By default this is INCBIN_STYLE_CAMEL
#define INCBIN_STYLE INCBIN_STYLE_SNAKE
INCBIN(foo, "foo.txt");
◆ INCBIN_STYLE_IDENT
| #define INCBIN_STYLE_IDENT |
( |
| TYPE | ) |
|
Value: INCBIN_CONCATENATE(INCBIN_STYLE_, INCBIN_CONCATENATE(INCBIN_EVAL(
INCBIN_STYLE), INCBIN_CONCATENATE(_, TYPE)))
#define INCBIN_STYLE
Specify the style used for symbol names.
Definition incbin.h:233
◆ INCBIN_STYLE_STRING
| #define INCBIN_STYLE_STRING |
( |
| TYPE | ) |
|
Value:INCBIN_STRINGIZE(INCBIN_STYLE_IDENT(TYPE))
◆ INCBIN_TYPE
| #define INCBIN_TYPE |
( |
| NAME | ) |
|
◆ INCBIN_VA_ARG_COUNTER
| #define INCBIN_VA_ARG_COUNTER |
( |
| _1, |
|
|
| _2, |
|
|
| _3, |
|
|
| N, |
|
|
| ... ) |
◆ INCBIN_VA_ARGC
| #define INCBIN_VA_ARGC |
( |
| ... | ) |
|
Value:INCBIN_VA_ARG_COUNTER(__VA_ARGS__, 3, 2, 1, 0)
◆ INCTXT
| #define INCTXT |
( |
| NAME, |
|
|
| FILENAME ) |
Value:INCBIN_COMMON(char, NAME, FILENAME, INCBIN_BYTE "0\n")
◆ INCTXT_EXTERN
| #define INCTXT_EXTERN |
( |
| NAME | ) |
|
Value:INCBIN_EXTERN_2(char, NAME)