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

Subversion Repositories or1k_soc_on_altera_embedded_dev_kit

[/] [or1k_soc_on_altera_embedded_dev_kit/] [trunk/] [linux-2.6/] [linux-2.6.24/] [arch/] [or32/] [support/] [tools/] [bintoc.c] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 xianfeng
#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
 
16
 
17
        fprintf(stdout, "#\n");
18
        fprintf(stdout, "# Miscellaneous data structures:\n");
19
        fprintf(stdout, "# WARNING - this file is automatically generated!\n");
20
        fprintf(stdout, "#\n");
21
        fprintf(stdout, "\n");
22
        fprintf(stdout, "\t.section %s, \"a\"\n", argv[1]);
23
        pos = 0;
24
        while ((len = read(0, buf, sizeof(buf))) > 0)
25
        {
26
                cnt = 0;
27
                lp = (unsigned char *)buf;
28
                len = (len + 3) & ~3;  /* Round up to longwords */
29
                for (i = 0;  i < len;  i += 4)
30
                {
31
                        if (cnt == 0)
32
                        {
33
                                fprintf(stdout, "\t.long\t");
34
                        }
35
                        fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]);
36
                        lp += 4;
37
                        if (++cnt == 4)
38
                        {
39
                                cnt = 0;
40
                                fprintf(stdout, "/* %x */\n", pos+i-12);
41
                                fflush(stdout);
42
                        } else
43
                        {
44
                                fprintf(stdout, ",");
45
                        }
46
                }
47
                if (cnt)
48
                {
49
                        fprintf(stdout, "0\n");
50
                }
51
                pos += len;
52
        }
53
        fflush(stdout);
54
        fclose(stdout);
55
        exit(0);
56
}
57
 

powered by: WebSVN 2.1.0

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