NAME

bin2c - binary to C converter


SYNOPSIS

bin2c file [array-name]


ARGUMENTS

file
input file name

array-name
name of array to declare (default is bootrom_words)


DESCRIPTION

bin2c reads a binary file, and writes to stdout a C statement declaring an array of U32 whose contents are those of the file. for example if foo.o is a file

bin2c foo.o

will produce output of the form:

 static U32 bootrom_words[] = {
 0x<word1>, 0x<word2>, 0x<word3>, 0x<word5>,
 0x<word6>, ...
 
 };

The output is independent of the endianness of the machine running bin2c, but for the result to be useful the binary file must have been produced for a target with the same endianness as the compiler for the C produced.

Note that if the input file does not contain a whole number of words it will be zero-padded.