sim-card
/
sam7-util
Archived
9
0
Fork 0
Utility for SAM-BA flashing of AT91SAM7
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
sam7-util/loader/bin2c.c

30 lines
451 B

#include <stdio.h>
int main( int argc, char *argv[] )
{
char *data_name = "data";
int c;
int i=0;
if( argc == 2 ) {
data_name = argv[1];
}
printf( "uint8_t %s[] = {\n", data_name );
while( (c = getchar()) >= 0 ) {
if( i== 0 ) {
printf( "\t" );
} else if( i%8 == 0 ) {
printf( ",\n\t" );
} else {
printf( ", " );
}
i++;
printf( "0x%02x", c );
}
printf( "\n};\n" );
return 0;
}