I have got a firmware (.raw) file which has to be written in serial flash. One way is to create a header file out of it i.e. a string array with the file content and then in code read this buffer and write it in serial flash.
In linux do we have any tool/command to create a header file with proper formatting. I am finding it toough to do it manually. The size of raw file is around 5mb.
Advertisements. A header file is a file with extension . h which contains C function declarations and macro definitions to be shared between several source files. There are two types of header files: the files that the programmer writes and the files that comes with your compiler.
Header files ( . h ) are designed to provide the information that will be needed in multiple files. Things like class declarations, function prototypes, and enumerations typically go in header files. In a word, "definitions".
Yes, this will work. Note, however, that if you include a lot of headers in this file and don't need all of them in each of your source files, it will likely increase your compilation time.
In linux you can use xxd command for this functionality.
Usage: xxd -i fname > abc.h
This will create a new header file with proper formatting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With