1 |
786 |
skrzyp |
#ifndef _SIB_H_
|
2 |
|
|
#define _SIB_H_
|
3 |
|
|
//==========================================================================
|
4 |
|
|
//
|
5 |
|
|
// sib.h
|
6 |
|
|
//
|
7 |
|
|
// RedBoot - structure of ARM flash file format
|
8 |
|
|
//
|
9 |
|
|
//==========================================================================
|
10 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
18 |
|
|
// version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
21 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License
|
26 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use
|
30 |
|
|
// macros or inline functions from this file, or you compile this file
|
31 |
|
|
// and link it with other works to produce a work based on this file,
|
32 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
33 |
|
|
// the GNU General Public License. However the source code for this file
|
34 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
35 |
|
|
// General Public License v2.
|
36 |
|
|
//
|
37 |
|
|
// This exception does not invalidate any other reasons why a work based
|
38 |
|
|
// on this file might be covered by the GNU General Public License.
|
39 |
|
|
// -------------------------------------------
|
40 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
41 |
|
|
//==========================================================================
|
42 |
|
|
//#####DESCRIPTIONBEGIN####
|
43 |
|
|
//
|
44 |
|
|
// Author(s): Philippe Robin
|
45 |
|
|
// Contributors: Philippe Robin, jskov
|
46 |
|
|
// Date: 2001-10-31
|
47 |
|
|
// Purpose:
|
48 |
|
|
// Description:
|
49 |
|
|
//
|
50 |
|
|
// This code is part of RedBoot (tm).
|
51 |
|
|
//
|
52 |
|
|
//####DESCRIPTIONEND####
|
53 |
|
|
//
|
54 |
|
|
//==========================================================================
|
55 |
|
|
|
56 |
|
|
#include <cyg/hal/hal_io.h>
|
57 |
|
|
|
58 |
|
|
/* type information :-
|
59 |
|
|
* 0xffff ffff - deleted (usual flash erased value)
|
60 |
|
|
* 0x0000 xxxx - Reserved for ARM usage:
|
61 |
|
|
* Bit 0 - ARM Executable Image
|
62 |
|
|
* Bit 1 - System Information Block
|
63 |
|
|
* Bit 2 - File System Block
|
64 |
|
|
* 0xyyyy 0000 - Available for customers (y != 0)
|
65 |
|
|
*/
|
66 |
|
|
#define TYPE_DELETED 0xFFFFFFFF
|
67 |
|
|
#define TYPE_ARM_MASK 0x0000FFFF
|
68 |
|
|
#define TYPE_CUSTOM_MASK 0xFFFF0000
|
69 |
|
|
#define TYPE_ARM_EXEC 0x00000001
|
70 |
|
|
#define TYPE_ARM_SIB 0x00000002
|
71 |
|
|
#define TYPE_ARM_SYSBLOCK 0x00000004
|
72 |
|
|
|
73 |
|
|
/* This is the type we use for RedBoot blocks */
|
74 |
|
|
#define TYPE_REDHAT_REDBOOT 0x52420000
|
75 |
|
|
|
76 |
|
|
/* The ARM monitor may be using a different memory mapping than RedBoot */
|
77 |
|
|
#ifndef _ADDR_REDBOOT_TO_ARM
|
78 |
|
|
# define _ADDR_REDBOOT_TO_ARM(x)
|
79 |
|
|
#endif
|
80 |
|
|
|
81 |
|
|
/* Filetypes */
|
82 |
|
|
|
83 |
|
|
#define UNKNOWN_FILE 0x00000000
|
84 |
|
|
#define MOT_S_RECORD 0x00000001
|
85 |
|
|
#define INTEL_HEX 0x00000002
|
86 |
|
|
#define ELF 0x00000004
|
87 |
|
|
#define DWARF 0x00000008
|
88 |
|
|
#define ARM_AOF 0x00000010
|
89 |
|
|
#define ARM_AIF 0x00000020
|
90 |
|
|
#define PLAIN_BINARY 0x00000040
|
91 |
|
|
#define ARM_AIF_BIN 0x00000080
|
92 |
|
|
#define MCS_TYPE 0x00000100
|
93 |
|
|
|
94 |
|
|
#define CONVERT_TYPE (MOT_S_RECORD | INTEL_HEX | MCS_TYPE | ELF)
|
95 |
|
|
|
96 |
|
|
#define SIB_OWNER_STRING_SIZE 32
|
97 |
|
|
#define MAX_SIB_SIZE 512
|
98 |
|
|
#define MAX_SIB_INDEX 64
|
99 |
|
|
|
100 |
|
|
#define SIB_HEADER_SIGNATURE 0xA00FFF9F /* This is an invalid instruction - MULGE pc,pc,pc */
|
101 |
|
|
#define FLASH_FOOTER_SIGNATURE 0xA0FFFF9F /* This is an invalid instruction - SMULALGES pc,pc,pc */
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
typedef struct SIBType {
|
105 |
|
|
cyg_uint32 signature;
|
106 |
|
|
cyg_uint32 size;
|
107 |
|
|
char owner[SIB_OWNER_STRING_SIZE];
|
108 |
|
|
cyg_uint32 index;
|
109 |
|
|
cyg_uint32 revision;
|
110 |
|
|
cyg_uint32 checksum;
|
111 |
|
|
} tSIB;
|
112 |
|
|
|
113 |
|
|
typedef struct SIBInfoType {
|
114 |
|
|
cyg_uint32 SIB_number; /* Unique number of SIB Block */
|
115 |
|
|
cyg_uint32 SIB_Extension; /* Base of SIB Flash Block */
|
116 |
|
|
char Label[16]; /* String space for ownership string */
|
117 |
|
|
cyg_uint32 checksum; /* SIB Image checksum */
|
118 |
|
|
} tSIBInfo;
|
119 |
|
|
|
120 |
|
|
typedef struct FooterType {
|
121 |
|
|
void *infoBase; /* Address of first word of ImageFooter */
|
122 |
|
|
char *blockBase; /* Start of area reserved by this footer */
|
123 |
|
|
cyg_uint32 signature; /* 'Magic' number proves it's a footer */
|
124 |
|
|
cyg_uint32 type; /* Area type: ARM Image, SIB, customer */
|
125 |
|
|
cyg_uint32 checksum; /* Just this structure */
|
126 |
|
|
} tFooter ;
|
127 |
|
|
|
128 |
|
|
typedef struct ImageInfoType {
|
129 |
|
|
cyg_uint32 bootFlags; /* Boot flags, compression etc. */
|
130 |
|
|
cyg_uint32 imageNumber; /* Unique number, selects for boot etc. */
|
131 |
|
|
char *loadAddress; /* Address program should be loaded to */
|
132 |
|
|
cyg_uint32 length; /* Actual size of image */
|
133 |
|
|
char *address; /* Image is executed from here */
|
134 |
|
|
char name[16]; /* Null terminated */
|
135 |
|
|
char *headerBase; /* Flash Address of any stripped header */
|
136 |
|
|
cyg_uint32 header_length; /* Length of header in memory */
|
137 |
|
|
cyg_uint32 headerType; /* AIF, RLF, s-record etc. */
|
138 |
|
|
cyg_uint32 checksum; /* Image checksum (inc. this struct) */
|
139 |
|
|
} tImageInfo;
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
#endif // _SIB_H_
|