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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [ppc/] [boot/] [compressed/] [piggyback.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.data\n");
21
        fprintf(stdout, "\t.globl input_data\n");
22
        fprintf(stdout, "input_data:\n");
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
        fprintf(stdout, "\t.globl input_len\n");
54
        fprintf(stdout, "input_len:\t.long\t0x%x\n", pos);
55
        fflush(stdout);
56
        fclose(stdout);
57
        exit(0);
58
}
59
 

powered by: WebSVN 2.1.0

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