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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [redboot/] [current/] [doc/] [redboot_rebuilding.sgml] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
2
 
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
28
29
 
30
31
Rebuilding RedBoot
32
33
Introduction
34
rebuilding RedBoot
35
RedBootrebuilding
36
RedBoot is built as an application on top of eCos. The makefile rules
37
for building RedBoot are part of the eCos CDL package, so it's
38
possible to build eCos from the Configuration
39
Tool, as well as from the command line using
40
ecosconfig.
41
 
42
Building RedBoot requires only a few steps: selecting the
43
platform and the RedBoot template, importing a platform specific
44
configuration file, and finally starting the build.
45
 
46
The platform specific configuration file makes sure the settings
47
are correct for building RedBoot on the given platform. Each platform
48
should provide at least two of these configuration files:
49
redboot_RAM.ecm for a RAM mode RedBoot
50
configuration and redboot_ROM.ecm or
51
redboot_ROMRAM.ecm for a ROM or ROMRAM mode
52
RedBoot configuration. There may be additional
53
configuration files according to the requirements of the particular
54
platform.
55
 
56
The RedBoot build process results in a number of files in the
57
install bin directory. The ELF
58
file redboot.elf is the pricipal
59
result. Depending on the platform CDL, there will also be generated
60
versions of RedBoot in other file formats, such as
61
redboot.bin (binary format, good when doing an
62
update of a primary RedBoot image, see 
63
linkend="update-primary-image">), redboot.srec
64
(Motorola S-record format, good when downloading a RAM mode image for
65
execution), and redboot.img (stripped ELF format,
66
good when downloading a RAM mode image for execution, smaller than the
67
.srec file). Some platforms may provide additional file formats and
68
also relocate some of these files to a
69
particular address making them more suitable for downloading using a
70
different boot monitor or flash programming tools.
71
 
72
The platform specific information in 
73
linkend="Installation-and-Testing"> should be consulted, as there may
74
be other special instructions required to build RedBoot for particular
75
platforms.
76
 
77
78
Rebuilding RedBoot using <application>ecosconfig</application>
79
 
80
To rebuild RedBoot using the
81
ecosconfig tool, create a temporary
82
directory for building RedBoot, name it according to the desired
83
configuration of RedBoot, here RAM:
84
85
$ mkdir /tmp/redboot_RAM
86
$ cd /tmp/redboot_RAM
87
88
89
 
90
Create the build tree according to the chosen platform, here
91
using the Hitachi Solution Engine 7751 board as
92
an example:
93
It is assumed that the environment variable
94
ECOS_REPOSITORY points to the eCos/RedBoot source tree.
95
96
$ ecosconfig new se7751 redboot
97
U CYGPKG_HAL_SH_7750, new inferred value 0
98
U CYGPKG_HAL_SH_7751, new inferred value 1
99
U CYGHWR_HAL_SH_IRQ_USE_IRQLVL, new inferred value 1
100
U CYGSEM_HAL_USE_ROM_MONITOR, new inferred value 0
101
U CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM, new inferred value 0
102
U CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS, new inferred value 1
103
U CYGFUN_LIBC_STRING_BSD_FUNCS, new inferred value 0
104
U CYGPKG_NS_DNS_BUILD, new inferred value 0
105
106
Replace the platform name ("se7751") with the appropriate name for the
107
chosen platform.
108
109
 
110
Then import the appropriate platform RedBoot configuration file,
111
here for RAM configuration:
112
113
$ ecosconfig import ${ECOS_REPOSITORY}/hal/sh/se7751/VERSION/misc/redboot_RAM.ecm
114
$ ecosconfig tree
115
116
Replace architecture ("sh"), platform ("se7751") and version
117
("VERSION") with those appropriate for the
118
chosen platform and the version number of its HAL package. Also
119
replace the configuration name ("redboot_RAM.ecm") with that of the
120
appropriate configuration file.
121
122
 
123
RedBoot can now be built:
124
125
$ make
126
127
128
 
129
The resulting RedBoot files will be in the associated
130
install directory, in this example, 
131
class="directory">./install/bin.
132
 
133
In  each platform's
134
details are described in the form of shell variables. Using those,
135
the steps to build RedBoot are:
136
137
export REDBOOT_CFG=redboot_ROM
138
export VERSION=VERSION
139
mkdir /tmp/${REDBOOT_CFG}
140
cd /tmp/${REDBOOT_CFG}
141
ecosconfig new ${TARGET} redboot
142
ecosconfig import ${ECOS_REPOSITORY}/hal/${ARCH_DIR}/${PLATFORM_DIR}/${VERSION}/misc/${REDBOOT_CFG}.ecm
143
ecosconfig tree
144
make
145
146
To build for another configuration, simply change the
147
REDBOOT_CFG definition accordingly. Also
148
make sure the VERSION variable matches the
149
version of the platform package.
150
151
152
 
153
 
154
155
Rebuilding RedBoot from the <application>Configuration Tool</application>
156
 
157
To rebuild RedBoot from the Configuration
158
Tool, open the template window (Build->Templates) and
159
select the appropriate Hardware target and in Packages select
160
"redboot". Then press OK. Depending on the platform, a number of
161
conflicts may need to be resolved before the build can be started;
162
select "Continue".
163
 
164
Import the desired RedBoot configuration file from the platform HAL
165
(File->Import...).  Depending on the platform, a number of
166
conflicts may need to be resolved before the build can be started;
167
select "Continue". For example, if the platform selected is Hitachi
168
SE7751 board and the RAM configuration RedBoot should be built, import
169
the file
170
hal/sh/se7751/VERSION/misc/redboot_RAM.ecm.
171
 
172
Save the configuration somewhere suitable with enough disk space
173
for building RedBoot (File->Save...). Choose the name according to
174
the RedBoot configuration, for example
175
redboot_RAM.ecc.
176
 
177
Then start the build (Build->Library) and wait for it to
178
complete. The resulting RedBoot files will be in the associated
179
install directory, for the example this would be 
180
class="directory">redboot_RAM_install/bin.
181
 
182
As noted above, each platform's details are described in 
183
linkend="Installation-and-Testing">. Use the information provided in
184
the shell variables to find the configuration file - the path to it is
185
${ECOS_REPOSITORY}/hal/${ARCH_DIR}/${PLATFORM_DIR}/${VERSION}/misc/${REDBOOT_CFG}.ecm,
186
where ECOS_REPOSITORY points to the
187
eCos/RedBoot sources, VERSION is the
188
version of the package (usually "current") and
189
REDBOOT_CFG is the desired configuration,
190
e.g. redboot_RAM.
191
192
193
 
194
195
Updating RedBoot
196
197
Introduction
198
updating
199
RedBoot
200
RedBootupdatingRedBoot
201
normally resides in an EPROM or, more common these days, a flash
202
on the board. In the former case, updating RedBoot necessitates
203
physically removing the part and
204
reprogramming a new RedBoot image into it using prommer hardware. In
205
the latter case, it is often possible to update RedBoot in situ using
206
Redboot's flash management commands.
207
 
208
The process of updating RedBoot in situ is documented in this
209
section. For this process, it is assumed that the target is connected
210
to a host system and that there is a serial connection giving access
211
to the RedBoot CLI. For platforms with a ROMRAM mode RedBoot, skip to
212
.
213
 
214
The addresses and sizes included in the below are examples
215
only, and will differ from those you will see. This is normal and
216
should not cause concern.
217
 
218
219
Load and start a RedBoot RAM instance
220
There are a number of choices here. The basic case is where a RAM
221
mode image has been stored in the FIS (flash Image System). To load and
222
execute this image, use the commands: 
223
RedBoot> fis load RedBoot[RAM]
224
RedBoot> go
225
If this image is not available, or does not work,
226
then an alternate RAM mode image must be loaded:
227
228
RedBoot> load redboot_RAM.img
229
Entry point: 0x060213c0, address range: 0x06020000-0x060369c8
230
RedBoot> go
231
232
 
233
This command loads the RedBoot image using the TFTP
234
protocol via a network connection. Other methods of loading are
235
available, refer to the 
236
linkend="download-command">load command for more
237
details. 
238
 
239
If you expect to be doing this more than once, it is a
240
good idea to program the RAM mode image into the flash. You do this
241
using the fis create command after having
242
downloaded the RAM mode image, but before you start it.
243
Some platforms support locking (write protecting) certain regions of
244
the flash, while others do not. If your platform does not support
245
locking, simply ignore the fis unlock and
246
fis lock steps (the commands will not be
247
recognized by RedBoot).
248
249
250
RedBoot> fis unlock RedBoot[RAM]
251
  ... Unlock from 0x00000000-0x00020000: ..
252
RedBoot> fis create RedBoot[RAM]
253
An image named 'RedBoot[RAM]' exists - continue (y/n)? y
254
* CAUTION * about to program 'RedBoot[RAM]'
255
            at 0x00020000..0x000369c7 from 0x06020000 - continue (y/n)?y
256
... Erase from 0x00020000-0x00040000: ..
257
... Program from 0x06020000-0x060369c8 at 0x00020000: ..
258
... Erase from 0x00070000-0x00080000: .
259
... Program from 0x0606f000-0x0607f000 at 0x00070000: .
260
RedBoot> fis lock RedBoot[RAM]
261
  ... Lock from 0x00000000-0x00020000: ..
262
263
264
265
266
 
267
268
Update the primary RedBoot flash image An
269
instance of RedBoot should now be running on the target from RAM. This
270
can be verified by looking for the mode identifier in the banner. It
271
should be either [RAM] or [ROMRAM].
272
 
273
If this is the first time RedBoot is running on the board or if
274
the flash contents has been damaged, initialize the FIS directory:
275
RedBoot> fis init -f
276
About to initialize [format] FLASH image system - continue (y/n)? y
277
*** Initialize FLASH Image System
278
... Erase from 0x00020000-0x00070000: .....
279
... Erase from 0x00080000-0x00080000:
280
... Erase from 0x00070000-0x00080000: .
281
... Program from 0x0606f000-0x0607f000 at 0x00070000: .
282
283
284
 
285
It is important to understand that the presence of a correctly
286
initialized FIS directory allows RedBoot to automatically determine
287
the flash parameters. Additionally, executing the steps below as
288
stated without loading other data or using other flash commands (than
289
possibly fis list) allows RedBoot to automatically
290
determine the image location and size parameters. This greatly reduces
291
the risk of potential critical mistakes due to typographical errors. It is
292
still always possible to explicitly specify parameters, and indeed
293
override these, but it is not advised.
294
 
295
If the new RedBoot image has grown beyond the slot in
296
flash reserved for it, it is necessary to change the RedBoot
297
configuration option CYGBLD_REDBOOT_MIN_IMAGE_SIZE so the FIS is
298
created with adequate space reserved for RedBoot images. In this case,
299
it is necessary to re-initialize the FIS directory as described above,
300
using a RAM mode RedBoot compiled with the updated
301
configuration.
302
 
303
Using the load command, download the
304
new flash based image from the host, relocating the image to RAM::
305
RedBoot> load -r -b %{FREEMEMLO} redboot_ROM.bin
306
Raw file loaded 0x06046800-0x06062fe8, assumed entry at 0x06046800
307
308
 
309
This command loads the RedBoot image using the TFTP
310
protocol via a network connection. Other methods of loading are
311
available, refer to the  command for
312
more details. 
313
 
314
Note that the binary version of the image is being
315
downloaded. This is to ensure that the memory after the image is
316
loaded should match the contents of the file on the host. Loading SREC
317
or ELF versions of the image does not guarantee this since these
318
formats may contain holes, leaving bytes in these holes in an unknown
319
state after the load, and thus causing a likely cksum difference. It
320
is possible to use these, but then the step verifying the cksum below
321
may fail.
322
323
 
324
Once the image is loaded into RAM, it should be checksummed,
325
thus verifying that the image on the target is indeed the image
326
intended to be loaded, and that no corruption of the image has
327
happened. This is done using the 
328
command:
329
RedBoot> cksum
330
Computing cksum for area 0x06046800-0x06062fe8
331
POSIX cksum = 2535322412 116712 (0x971df32c 0x0001c7e8)
332
333
Compare the numbers with those for the binary version of the image on
334
the host. If they do not match, try downloading the image again.
335
 
336
 
337
Assuming the cksum matches, the next step is programming the
338
image into flash using the FIS commands.
339
 
340
Some platforms support locking (write protecting) certain
341
regions of the flash, while others do not. If your platform does not
342
support locking, simply ignore the fis unlock and
343
fis lock steps (the commands will not be recognized
344
by RedBoot).
345
 
346
RedBoot> fis unlock RedBoot
347
  ... Unlock from 0x00000000-0x00020000: ..
348
RedBoot> fis create RedBoot
349
An image named 'RedBoot' exists - continue (y/n)? y
350
* CAUTION * about to program 'RedBoot'
351
            at 0x00000000..0x0001c7e7 from 0x06046800 - continue (y/n)? y
352
... Erase from 0x00000000-0x00020000: ..
353
... Program from 0x06046800-0x06062fe8 at 0x00000000: ..
354
... Erase from 0x00070000-0x00080000: .
355
... Program from 0x0606f000-0x0607f000 at 0x00070000: .
356
RedBoot> fis lock RedBoot
357
  ... Lock from 0x00000000-0x00020000: ..
358
359
 
360
361
362
Reboot; run the new RedBoot image
363
Once the image has been successfully written into the flash, simply
364
reset the target and the new version of RedBoot should be running. 
365
When installing RedBoot for the first time, or after updating to
366
a newer RedBoot with different configuration keys, it is necessary to
367
update the configuration directory in the flash using the
368
fconfig command. See 
369
linkend="Persistent-State-Flash">.
370
371
 
372

powered by: WebSVN 2.1.0

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