I currently am able to include an arbitrary binary blob of data in my code using the PROGMEM keyword, and have code working that can access that data. However, manipulating the data is cumbersome at best. I’m relatively new to C and have little experience with the C preprocessor itself, but I do understand the theory behind what it does. I’m just not sure if it’s possible to accomplish what I’m hoping for.
I’m using HxD to generate/edit raw binary data, and then every time I want to change the data I have to use HxD’s handy “copy as C” function (which forms the data as a long string of “0x” characters, adds the commas, line-breaks it, etc), paste it into the Arduino editor, then remove the variable declaration and closing “};” that HxD includes when you use “copy as C”.
What I’d like to be able to do if possible is simply have the preprocessor include the actual raw binary file directly.
I’m not sure if it’s possible, but ideally I’d like to be able to do something like: static const byte blob PROGMEN =
The key of course is that “myBinary.bin” is actually the raw binary data, nut the string-based representation C requires. So the preprocessor would need to also convert the binary file into the appropriate C++ syntax for a static byte array.
The ideal workflow would be to just edit the .bin file directly with HxD or whatever, then rebuild/reload the sketch and have the new data present. The step of copying, pasting, removing the extra lines, etc. gets annoying after many iterations.
Is this possible?