I was wondering if there is a way to load an external binary as a variable in C via include or a header file or something similar.
For example, in the project I'm currently working on, I work with an embedded system that has a graphic display that will make text and small graphics (boxes, lines, etc.) using data and ASCII commands. But it will also display monochrome bitmap images. Therefore, I have a series of static displays that I use for the user interface, and several bitmaps for splash screens.
Now the reason I mention that this is an embedded system is because there is no file system to load data from, only from RAM and program memory, so any "preliminary" data or tables that I want to use should be loaded to compile time either through the source file or through the object file using the linker. Unfortunately, the IDE does not provide any means to load a binary file in any form into program memory for use as a data cache in this way in any easily recognizable way.
So I'm not doing what I already need to get around (use the hex editor to read the binary as encoded ASCII hex code and copy and paste the raw data into the header file as a variable), is there a way to βlinkβ to the file or "include" a file that can be loaded as a const variable at compile time?
The system I'm working with is MPLAB X for Microchip processors, and the GNC compiler. Basically, I want to know if there is a way to do this with some C command or function, before I try to find a way specifically using my specific compiler / linker software.
source share