OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [or32/] [tools/] [bintoc.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1624 jcastillo
#include <stdio.h>
2
 
3
extern long ce_exec_config[];
4
 
5
main(int argc, char *argv[])
6
{
7
        int i, cnt, pos, len;
8
        unsigned char *lp;
9
        unsigned char buf[8192];
10
        if (argc != 1)
11
        {
12
                fprintf(stderr, "usage: %s <in-file >out-file\n", argv[0]);
13
                exit(1);
14
        }
15
        fprintf(stdout, "#\n");
16
        fprintf(stdout, "# Miscellaneous data structures:\n");
17
        fprintf(stdout, "# WARNING - this file is automatically generated!\n");
18
        fprintf(stdout, "#\n");
19
        fprintf(stdout, "\n");
20
        fprintf(stdout, "\t.section .initrd, \"a\"\n");
21
        pos = 0;
22
        while ((len = read(0, buf, sizeof(buf))) > 0)
23
        {
24
                cnt = 0;
25
                lp = (unsigned char *)buf;
26
                len = (len + 3) & ~3;  /* Round up to longwords */
27
                for (i = 0;  i < len;  i += 4)
28
                {
29
                        if (cnt == 0)
30
                        {
31
                                fprintf(stdout, "\t.long\t");
32
                        }
33
                        fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]);
34
                        lp += 4;
35
                        if (++cnt == 4)
36
                        {
37
                                cnt = 0;
38
                                fprintf(stdout, "/* %x */\n", pos+i-12);
39
                                fflush(stdout);
40
                        } else
41
                        {
42
                                fprintf(stdout, ",");
43
                        }
44
                }
45
                if (cnt)
46
                {
47
                        fprintf(stdout, "0\n");
48
                }
49
                pos += len;
50
        }
51
        fflush(stdout);
52
        fclose(stdout);
53
        exit(0);
54
}
55
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.