如何将固件文件存储到头文件(.h)中

时间:2022-10-11 02:05:05

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.

我有一个固件(.raw)文件,必须用串行闪存写。一种方法是从中创建一个头文件,即带有文件内容的字符串数组,然后在代码中读取此缓冲区并将其写入串行闪存。

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.

在linux中,我们有任何工具/命令来创建具有正确格式的头文件。我发现它很难手动完成。原始文件的大小约为5mb。

1 个解决方案

#1


4  

In linux you can use xxd command for this functionality.

在linux中,您可以使用xxd命令来实现此功能。

Usage: xxd -i fname > abc.h

用法:xxd -i fname> abc.h

This will create a new header file with proper formatting.

这将创建一个具有正确格式的新头文件。

#1


4  

In linux you can use xxd command for this functionality.

在linux中,您可以使用xxd命令来实现此功能。

Usage: xxd -i fname > abc.h

用法:xxd -i fname> abc.h

This will create a new header file with proper formatting.

这将创建一个具有正确格式的新头文件。