Re:Embedding files in C programs with koio
by makapuf on Wednesday May 30, 2018 @04:53PM
(#17191678)
I personnally end up using my own simple python scripts.
Alternatives being :
- use objcopy but this needs to specify the binary
of the output, which some build settings can make complex at the compile stage
- use ld and -o binary. this works but this will put
all data in .data section which puts it in ram, without
being able to change it.
- use incbin on inline assembly. this will work too but
it's slightly more complex and relies on inline assembly
so a bit less portable.
- use xxd utility : this only works on linux, does not export const unsigned char[] (fixable with a simple sed) and we lack the ability to export just a header or control prefix / extensions.
Alternatives being : - use objcopy but this needs to specify the binary of the output, which some build settings can make complex at the compile stage - use ld and -o binary. this works but this will put all data in .data section which puts it in ram, without being able to change it. - use incbin on inline assembly. this will work too but it's slightly more complex and relies on inline assembly so a bit less portable. - use xxd utility : this only works on linux, does not export const unsigned char[] (fixable with a simple sed) and we lack the ability to export just a header or control prefix / extensions.