URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 650 to Rev 651
- ↔ Reverse comparison
Rev 650 → Rev 651
/trunk/uclinux/uClinux-2.0.x/arch/or1k/tools/bintoc.c
1,24 → 1,55
#include <stdio.h> |
|
int |
extern long ce_exec_config[]; |
|
main(int argc, char *argv[]) |
{ |
unsigned char buf[8]; |
int cnt; |
int i; |
|
printf ("/* romfs.h: ROMfs image converted to a C char array |
Machine generated DO NOT EDIT */ |
char |
_flashstart[] = {"); |
|
while (cnt = read(0,buf,sizeof(buf))) { |
|
printf("\n"); |
for (i=0; i<cnt; i++) { |
printf(" 0x%.2x,",buf[i]); |
int i, cnt, pos, len; |
unsigned char *lp; |
unsigned char buf[8192]; |
if (argc != 1) |
{ |
fprintf(stderr, "usage: %s <in-file >out-file\n", argv[0]); |
exit(1); |
} |
fprintf(stdout, "#\n"); |
fprintf(stdout, "# Miscellaneous data structures:\n"); |
fprintf(stdout, "# WARNING - this file is automatically generated!\n"); |
fprintf(stdout, "#\n"); |
fprintf(stdout, "\n"); |
fprintf(stdout, "\t.section .initrd\n"); |
pos = 0; |
while ((len = read(0, buf, sizeof(buf))) > 0) |
{ |
cnt = 0; |
lp = (unsigned char *)buf; |
len = (len + 3) & ~3; /* Round up to longwords */ |
for (i = 0; i < len; i += 4) |
{ |
if (cnt == 0) |
{ |
fprintf(stdout, "\t.long\t"); |
} |
fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]); |
lp += 4; |
if (++cnt == 4) |
{ |
cnt = 0; |
fprintf(stdout, "/* %x */\n", pos+i-12); |
fflush(stdout); |
} else |
{ |
fprintf(stdout, ","); |
} |
} |
if (cnt) |
{ |
fprintf(stdout, "0\n"); |
} |
pos += len; |
} |
printf("\n0};\n"); |
fflush(stdout); |
fclose(stdout); |
exit(0); |
} |
|