1 |
1026 |
ivang |
#
|
2 |
|
|
# README.EVB7045F,v 1.2 2001/08/16 21:07:41 joel Exp
|
3 |
|
|
#
|
4 |
|
|
# Author: Radzislaw Galler (rgaller@et.put.poznan.pl)
|
5 |
|
|
#
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
Getting started with EVB7045F and gensh2
|
9 |
|
|
========================================
|
10 |
|
|
This is a capture of success path to put a RTEMS sample
|
11 |
|
|
'hello.exe' on the evaluation board EVB7045F.
|
12 |
|
|
|
13 |
|
|
What you need
|
14 |
|
|
---------------
|
15 |
|
|
* Computer with two operating systems: Linux and Wndows 2000 (tm) -
|
16 |
|
|
that was in my case (see section 'Variations')
|
17 |
|
|
|
18 |
|
|
* Flash Development Toolkit (FDT) - available on HMSE homepage
|
19 |
|
|
(http://www.hmse.com/products/fdt/support.htm)
|
20 |
|
|
|
21 |
|
|
* 'gdbstubs' - available on SourceForge
|
22 |
|
|
(http://sourceforge.net/projects/gdbstubs/)
|
23 |
|
|
|
24 |
|
|
* working GNU C compiler for Hitach SH processors; do-it-yourself
|
25 |
|
|
(on Linux) or download ready stuff for Windows'9x/NT/2k from
|
26 |
|
|
(http://www.hitachi-eu.com/hel/ecg/) or from Hitach Databook 2001
|
27 |
|
|
CD-ROM (if no luck try to search on the net for gnu99r1p1.zip)
|
28 |
|
|
|
29 |
|
|
* GDB compiled for target sh-rtems - do-it-yourself or download
|
30 |
|
|
from ftp://ftp.oarcorp.com:21/pub/rtems/snapshots/c_tools/
|
31 |
|
|
|
32 |
|
|
* RTEMS (ofcourse) you probably already have if you are reading this
|
33 |
|
|
document
|
34 |
|
|
|
35 |
|
|
Instalation of 'gdbstubs'
|
36 |
|
|
--------------------------
|
37 |
|
|
Once you downladed and unzipped gdbstubs you have to compile
|
38 |
|
|
it. First modify the Makefile to use the compiler installed on your
|
39 |
|
|
machine. Then issue the command:
|
40 |
|
|
|
41 |
|
|
$ make
|
42 |
|
|
|
43 |
|
|
This should produce the default target sh2-7045edk.out. This is the
|
44 |
|
|
S-record file which should be added to FDT project (renaming it to
|
45 |
|
|
*.mot extension helps a bit).
|
46 |
|
|
If you are lucky you will be able to put the file into the FLASH
|
47 |
|
|
following the instuctions in FDT and EVB manuals.
|
48 |
|
|
|
49 |
|
|
Well I wasn't lucky so I had to bypass the Universal Programming
|
50 |
|
|
Board (see EVB7045F User Manual) and manually put the processor into
|
51 |
|
|
BOOT mode. This can be done by shortening the capacitor C8 (or C108
|
52 |
|
|
on schematics) which puts the UPB into permanent reset state, and by
|
53 |
|
|
removing jumper JP4 (or JP104 on schematics) and connecting its
|
54 |
|
|
middle pin to the ground. After pressing CRES button the processor
|
55 |
|
|
is in BOOT mode. In FDT select "direct connection":
|
56 |
|
|
|
57 |
|
|
Menu Project->Properties->Device->Select Interface
|
58 |
|
|
|
59 |
|
|
After that there should be no problem in putting the program into the
|
60 |
|
|
FLASH.
|
61 |
|
|
|
62 |
|
|
Loading 'hello.exe' on board
|
63 |
|
|
------------------------------
|
64 |
|
|
I assume you are able to compile RTEMS with 'gensh2' BSP and
|
65 |
|
|
necessary tools. If not please refer to 'started.pdf' document which
|
66 |
|
|
describes the procedure (http://www.oarcorp.com/).
|
67 |
|
|
|
68 |
|
|
At the time of writing this document 'gdbstubs' default
|
69 |
|
|
communication port was SCI1. So it was the default port for
|
70 |
|
|
/dev/console in RTEMS. To avoid problems I had check these settings
|
71 |
|
|
both in 'gdbstubs' and $RTEMS_ROOT/c/src/lib/libbsp/sh/gensh2/include/bsp.h
|
72 |
|
|
|
73 |
|
|
After changing the line
|
74 |
|
|
|
75 |
|
|
#define BSP_CONSOLE_DEVNAME "/dev/sci1"
|
76 |
|
|
|
77 |
|
|
to
|
78 |
|
|
|
79 |
|
|
#define BSP_CONSOLE_DEVNAME "/dev/sci0"
|
80 |
|
|
|
81 |
|
|
in 'bsp.h' and rebuilding RTEMS there should no problem in running
|
82 |
|
|
'hello.exe' and other samples.
|
83 |
|
|
|
84 |
|
|
For downloading connect a serial cable to computer and EVB. You will
|
85 |
|
|
also need a second cable and second serial port to see the effects
|
86 |
|
|
of your work.
|
87 |
|
|
|
88 |
|
|
Assuming you are working in Linux and Xwindows fire up two terminal
|
89 |
|
|
windows. In the first one run sh-rtems-gdb, in the second run a
|
90 |
|
|
serial port terminal (for example 'minicom'). Set up the serial
|
91 |
|
|
terminal to a port connected to SCI0 and leave the window in a
|
92 |
|
|
visible place on the desktop. The debugger should be invoked best
|
93 |
|
|
from the directory where 'hello.exe' is placed. Assuming that here
|
94 |
|
|
is a GDB session:
|
95 |
|
|
|
96 |
|
|
--------start------
|
97 |
|
|
$ sh-rtems-gdb hello.exe
|
98 |
|
|
GNU gdb 5.0
|
99 |
|
|
Copyright 2000 Free Software Foundation, Inc.
|
100 |
|
|
GDB is free software, covered by the GNU General Public License, and you are
|
101 |
|
|
welcome to change it and/or distribute copies of it under certain conditions.
|
102 |
|
|
Type "show copying" to see the conditions.
|
103 |
|
|
There is absolutely no warranty for GDB. Type "show warranty" for details.
|
104 |
|
|
This GDB was configured as "--host=i686-pc-linux-gnu --target=sh-rtems"...
|
105 |
|
|
(gdb) set remotebaud 115200
|
106 |
|
|
(gdb) target remote /dev/ttyS0
|
107 |
|
|
Remote debugging using /dev/ttyS0
|
108 |
|
|
0x0 in ?? ()
|
109 |
|
|
(gdb) load
|
110 |
|
|
Loading section .text, size 0x12d70 lma 0x444000
|
111 |
|
|
Loading section .data, size 0xb80 lma 0x456df0
|
112 |
|
|
Loading section .stack, size 0x10 lma 0xfffffec0
|
113 |
|
|
Start address 0x444000 , load size 80128
|
114 |
|
|
Transfer rate: 58274 bits/sec, 153 bytes/write.
|
115 |
|
|
(gdb) continue
|
116 |
|
|
Continuing.
|
117 |
|
|
|
118 |
|
|
Program received signal 0, Signal 0.
|
119 |
|
|
0x44ec36 in exit (code=0) at exit.c:70
|
120 |
|
|
70 exit.c: No such file or directory.
|
121 |
|
|
(gdb)
|
122 |
|
|
--------end-------
|
123 |
|
|
|
124 |
|
|
And here is a capture from the serial terminal window:
|
125 |
|
|
|
126 |
|
|
*** HELLO WORLD TEST ***
|
127 |
|
|
Hello World
|
128 |
|
|
*** END OF HELLO WORLD TEST ***
|
129 |
|
|
|
130 |
|
|
Beautiful, isn't it? That's all!
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
Variations
|
135 |
|
|
------------
|
136 |
|
|
I'm sure that not every one can afford having two operating systems
|
137 |
|
|
on one computer. I believe there will be a day that nobody will need
|
138 |
|
|
an MS stuff anymore... ;)
|
139 |
|
|
|
140 |
|
|
It is possible to repeat the success on MS Windows only. To do the
|
141 |
|
|
same on Linux only you need a tool to downlad 'gdbstubs' on the
|
142 |
|
|
board. This should be no problem to find it on the net but right now
|
143 |
|
|
I don't know about it.
|
144 |
|
|
|
145 |
|
|
For your convenience there are several graphical interfaces for GDB
|
146 |
|
|
available on the net. I just name two of them:
|
147 |
|
|
|
148 |
|
|
DDD - stands for Data Display Debugger
|
149 |
|
|
(http://www.gnu.org/software/ddd/)
|
150 |
|
|
|
151 |
|
|
Insight - a Tcl/Tk interface available both for MS Windows and
|
152 |
|
|
Xwindows (http://sources.redhat.com/insight/)
|