1 | # |
---|
2 | # $Id$ |
---|
3 | # |
---|
4 | |
---|
5 | This is a README file for the MVME167 port of RTEMS 4.5.0. |
---|
6 | |
---|
7 | Please send any comments, improvements, or bug reports to: |
---|
8 | |
---|
9 | Charles-Antoine Gauthier |
---|
10 | charles.gauthier@nrc.ca |
---|
11 | |
---|
12 | or |
---|
13 | |
---|
14 | Darlene Stewart |
---|
15 | Darlene.Stewart@nrc.ca |
---|
16 | |
---|
17 | Software Engineering Group |
---|
18 | Institute for Information Technology |
---|
19 | National Research Council of Canada |
---|
20 | Ottawa, ON, K1A 0R6 |
---|
21 | Canada |
---|
22 | |
---|
23 | |
---|
24 | Disclaimer |
---|
25 | ---------- |
---|
26 | |
---|
27 | The National Research Council of Canada is distributing this RTEMS |
---|
28 | board support package for the Motorola MVME167 as free software; you |
---|
29 | can redistribute it and/or modify it under terms of the GNU General |
---|
30 | Public License as published by the Free Software Foundation; either |
---|
31 | version 2, or (at your option) any later version. This software is |
---|
32 | distributed in the hope that it will be useful, but WITHOUT ANY |
---|
33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
34 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
---|
35 | for more details. You should have received a copy of the GNU General |
---|
36 | Public License along with RTEMS; see file COPYING. If not, write to |
---|
37 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
38 | |
---|
39 | Under no circumstances will the National Research Council of Canada |
---|
40 | nor Her Majesty the Queen in right of Canada assume any liablility |
---|
41 | for the use this software, nor any responsibility for its quality or |
---|
42 | its support. |
---|
43 | |
---|
44 | |
---|
45 | Installation |
---|
46 | ------------ |
---|
47 | |
---|
48 | Nothing unique to the MVME167. It uses the standard build process for |
---|
49 | m68k targets. You will need to edit linkcmds to put in the start address |
---|
50 | of your board. We do TFTP transfers to our target. The mvme167.cfg file |
---|
51 | builds only the ELF images, which we download to the target, skipping |
---|
52 | over the first 0x54 bytes; Motorola S-records are not generated. Edit |
---|
53 | this file if you want S-records. |
---|
54 | |
---|
55 | |
---|
56 | Port Description |
---|
57 | |
---|
58 | Console driver |
---|
59 | --------------- |
---|
60 | |
---|
61 | This BSP includes an termios-capable interrupt-driven I/O console driver |
---|
62 | that supports all four serial ports on the MVME167 model. The port labelled |
---|
63 | Serial Port 1/Console on the MVME712 is normally used by 167Bug; do not open |
---|
64 | /dev/tty00 if you are debugging using 167Bug. |
---|
65 | |
---|
66 | Limited support is provided for polled terminal I/O. This is used when |
---|
67 | running the timing tests, and by the printk() debug output function. |
---|
68 | Polled I/O may use termios, or it may bypass those services. The printk() |
---|
69 | function does not use termios. When polled I/O is used, the terminal settings |
---|
70 | must be set through 167-Bug; trying to change the line settings through RTEMS |
---|
71 | has no effect. |
---|
72 | |
---|
73 | Three is no support for using interrupt-driven I/O without termios support. |
---|
74 | |
---|
75 | The default configuration is to use polled I/O and to bypass termios. This |
---|
76 | is done so the test can be built at the same time as the rest of the system. |
---|
77 | It is highly recommended that the defaults be changed in the mvme167.cfg file |
---|
78 | to reflect the desired defaults, or that the appropriate parameters be set up |
---|
79 | in NVRAM to select the appropriate I/O modes at boot time. |
---|
80 | |
---|
81 | When configured for interrupt-driven I/O, the console is initialized with |
---|
82 | whatever parameters are set up in termios before it calls the firtOpen driver |
---|
83 | callback, EXCEPT THAT HARDWARE HANDSHAKING IS TURNED OFF, i.e. CLOCAL is set |
---|
84 | in the struct termios c_cflag field. We use 3-wire cables for I/O, and find |
---|
85 | hardware handshaking a pain. If you enable hardware handshaking, you must drive |
---|
86 | CTS* low on the CD2401 for output to occur. If the port is in the DTE |
---|
87 | configuration, you must drive the RS-232 CTS line to space; if the port is |
---|
88 | in the DCE configuration, you must drive the RS-232 RTS line to space. |
---|
89 | |
---|
90 | To use interrupt-driven I/O, set the CD2401_IO_MODE manifest constant to 1 in |
---|
91 | rtems/make/custom/mvme167.cfg, or configure the appropriate parameter in |
---|
92 | User Area Non-volatile RAM. See the Configuration Parameters section below |
---|
93 | for instructions on setting up NVRAM. |
---|
94 | |
---|
95 | To use termios, set the CD2401_USE_TERMIOS manifest constant to 1 in |
---|
96 | rtems/make/custom/mvme167.cfg, or configure the appropriate parameter in |
---|
97 | User Area Non-volatile RAM. See the Configuration Parameters section |
---|
98 | below for instructions on setting up NVRAM. |
---|
99 | |
---|
100 | The RTEMS console, i.e. the port used by stdin, stdout and stderr (do not |
---|
101 | confuse it with the port labelled Console on the MVME712), must be |
---|
102 | specified in the rtems/make/custom/mvme167.cfg file, or in the NVRAM |
---|
103 | parameters. Set the value of CONSOLE_MINOR appropriately. See below for a |
---|
104 | list of choices. See the Configuration Parameters section below for |
---|
105 | instructions on setting up NVRAM. |
---|
106 | |
---|
107 | The RTEMS printk port, i.e. the port where printk sends it debugging output |
---|
108 | text, must be specified in the rtems/make/custom/mvme167.cfg file, or in the |
---|
109 | NVRAM parameters. Set the value of PRINTK_MINOR appropriately. See below for a |
---|
110 | list of choices. See the Configuration Parameters section below for |
---|
111 | instructions on setting up NVRAM. |
---|
112 | |
---|
113 | Interrupt-driven and polled I/O cannot be mixed in the MVME167, except that |
---|
114 | printk always used polled I/O without termios. If interrupt-driven I/O is |
---|
115 | used and printk is used, do not open the device that printk uses from an |
---|
116 | RTEMS application. |
---|
117 | |
---|
118 | Console and printk port choices: |
---|
119 | |
---|
120 | 0 - /dev/tty0, Serial Port 1/Console on the MVME712M. |
---|
121 | 1 - /dev/tty1, Serial Port 2/TTY01 on the MVME712M. |
---|
122 | 2 - /dev/tty2, Serial Port 3 on the MVME712M. |
---|
123 | 3 - /dev/tty3, Serial Port 4 on the MVME712M. |
---|
124 | |
---|
125 | Setting the RTEMS console to port 0 when interrupt-driven I/O is specified |
---|
126 | will prevent 167-Bug from using that port. |
---|
127 | |
---|
128 | To use polled I/O on port 2 or 3, the port must be configured in 167-Bug. See |
---|
129 | the "PF" command in the "Debugging Package for Motorola 68K CISC CPUs User's |
---|
130 | Manual", part number 68KBUG. |
---|
131 | |
---|
132 | |
---|
133 | Floating-point |
---|
134 | -------------- |
---|
135 | |
---|
136 | The MC68040 has a built-in FPU. This FPU does not implement all the |
---|
137 | instruction of the MC68881/MC68882 floating-point coprocessors in |
---|
138 | hardware. The -m68040 compilation options instructs gcc to not generate |
---|
139 | the missing instructions. All of the RTEMS code is built this way. Some |
---|
140 | of the missing functionality must be supplied by external libraries. The |
---|
141 | required functions are part of libgcc.a. |
---|
142 | |
---|
143 | The issue gets complicated because libc, libm and libgcc do not come as |
---|
144 | m68040-specific variants. The default variants of these libraries are for the |
---|
145 | MC68020 and MC68030. There are specific variants for the MC68000 (which has |
---|
146 | limited addressing modes with respect to later family members), and specific |
---|
147 | variants for systems without a floating-point unit, either a built-in FPU or |
---|
148 | a coprocessor. These latter variants will be referred to as the msoft-float |
---|
149 | variants. There is a msoft-float variant for the MC68000, and one for the |
---|
150 | other family members. |
---|
151 | |
---|
152 | The default variants of libc, libm and libgcc appear to work just fine for the |
---|
153 | MC68040, AS LONG AS NO FLOATING POINT FUNCTIONS ARE CALLED. In particular, |
---|
154 | printf() and scanf() raise unimplemented floating-point instruction exceptions |
---|
155 | at run time. Expect almost every function that must compute a floating-point |
---|
156 | result to also raise unimplemented floating-point instruction exceptions. Do |
---|
157 | not use these variants if your application does any floating-point operations, |
---|
158 | unless you use the Motorola FPSP package (described further down). |
---|
159 | |
---|
160 | The msoft-float variants do print out floating-point numbers properly, but we |
---|
161 | have not tested them extensively, so use them with caution. In particular, |
---|
162 | the Paranoia test fails when linked with the msoft-float variants of the |
---|
163 | libraries; it goes into an infinite loop after milestone 40. |
---|
164 | |
---|
165 | MSOFT_FLOAT VARIANTS MUST BE USED TOGETHER. If you use the msoft-float variant |
---|
166 | of libc and libm, you must also linked with the msoft-float variant of libgcc, |
---|
167 | otherwise calls such as printf() print out floating-point values incorrectly. |
---|
168 | |
---|
169 | RTEMS comes with the Motorola FPSP (Floating-Point Support Package) for the |
---|
170 | MC68040 (rtems/c/src/lib/libcp/m68k/m68040/fpsp). This package emulates the |
---|
171 | missing floating-point instructions. It is built automatically for the |
---|
172 | MVME167 and installed in bsp_start(). |
---|
173 | |
---|
174 | The FPSP allows the use of the default variants of libc, libm and libgcc. |
---|
175 | It also runs the paranoia test properly, and prints out the correct results. |
---|
176 | It should probably be used in preference to the msoft-float libraries, as it |
---|
177 | appears to work better. The disadvantage of the FPSP is that it increases the |
---|
178 | size of the executable by about 60KB and that it relies on run time |
---|
179 | exceptions. |
---|
180 | |
---|
181 | If your application does not do any floating-point operations at all, you |
---|
182 | should consider disabling the FPSP. In bsp_start(), emove the call to |
---|
183 | M68KFPSPInstallExceptionHandlers(), and uncomment the three lines in |
---|
184 | mvme167.cfg that redefine which variants of libc, libm and libgcc to link |
---|
185 | against. |
---|
186 | |
---|
187 | |
---|
188 | Configuration Parameters |
---|
189 | ------------------------ |
---|
190 | |
---|
191 | If Jumper J1-4 is installed, certain configuration parameters may be read from |
---|
192 | the first 31 bytes of User Area NVRAM starting at 0xFFFC0000. In this case, the |
---|
193 | remaining J1-[5-7] jumpers are ignored, and the user is responsible for writing |
---|
194 | the appropriate values in NVRAM (via 167-Bug) in order to alter the default |
---|
195 | behaviour. A zero value in NVRAM results in the default behaviour. The paramaters |
---|
196 | that are configurable and their default settings are described below. |
---|
197 | |
---|
198 | Cache Mode (0xFFFC0000 - 1 byte) |
---|
199 | Set the following bits in the byte to set the desired cache mode: |
---|
200 | bit 0 |
---|
201 | 0 - data cache disable |
---|
202 | 1 - data cache enable |
---|
203 | bit 1 |
---|
204 | 0 - instruction cache disable |
---|
205 | 1 - instruction cache enable |
---|
206 | bits 2 & 3: |
---|
207 | 00 = cachable, write-through |
---|
208 | 01 = cachable, copyback |
---|
209 | 10 = noncachable, serialized |
---|
210 | 11 = noncachable |
---|
211 | |
---|
212 | Console driver I/O mode (0xFFFC0001 - 1 byte) |
---|
213 | Set the following bits in the byte to set the desired I/O mode: |
---|
214 | bit 0 |
---|
215 | 0 - do not use termios |
---|
216 | 1 - use termios |
---|
217 | bit 1 |
---|
218 | 0 - polled I/O |
---|
219 | 1 - interrupt-driven I/O |
---|
220 | |
---|
221 | Console driver ports (0xFFFC0002 - 1 byte) |
---|
222 | Set the following bits in the byte to select the console and printk ports: |
---|
223 | bit 0 & 1 select the RTEMS console port |
---|
224 | 00 - /dev/tty0, Serial Port 1/Console on the MVME712M. |
---|
225 | 01 - /dev/tty1, Serial Port 2/TTY01 on the MVME712M. |
---|
226 | 10 - /dev/tty2, Serial Port 3 on the MVME712M. |
---|
227 | 11 - /dev/tty3, Serial Port 4 on the MVME712M. |
---|
228 | bit 4 & 5 select the RTEMS printk port |
---|
229 | 00 - /dev/tty0, Serial Port 1/Console on the MVME712M. |
---|
230 | 01 - /dev/tty1, Serial Port 2/TTY01 on the MVME712M. |
---|
231 | 10 - /dev/tty2, Serial Port 3 on the MVME712M. |
---|
232 | 11 - /dev/tty3, Serial Port 4 on the MVME712M. |
---|
233 | If the printk port is the same as some other port that will be opened by an |
---|
234 | RTEMS application, then the driver must use polled I/O, or the printk port |
---|
235 | must not be used. |
---|
236 | |
---|
237 | IP Address (0xFFFC0004 - 4 bytes) |
---|
238 | write the hexadecimal representation of the IP address of the board in this |
---|
239 | locatio, e.g. 192.168.1.2 = 0xC0A80102 |
---|
240 | default: obtain the IP address from an rtems_bsdnet_ifconfig structure |
---|
241 | |
---|
242 | Netmask (0xFFFC0008 - 4 bytes) |
---|
243 | write the hexadecimal representation of the netmask in this location |
---|
244 | for example, 255.255.255.0 = 0xFFFFFF00 |
---|
245 | default: obtain the netmask from an rtems_bsdnet_ifconfig structure |
---|
246 | |
---|
247 | Ethernet Address (0xFFFC000C - 6 bytes) |
---|
248 | write the Ethernet address of the board in this location |
---|
249 | default: obtain the hardware address from an rtems_bsdnet_ifconfig |
---|
250 | structure |
---|
251 | |
---|
252 | Processor ID (0xFFFC0012 - 2 bytes) |
---|
253 | reserved for future use |
---|
254 | |
---|
255 | RMA start (0xFFFC0014 - 4 bytes) |
---|
256 | reserved for future use |
---|
257 | |
---|
258 | VMA start (0xFFFC0018 - 4 bytes) |
---|
259 | reserved for future use |
---|
260 | |
---|
261 | RamSize (0xFFFC001C - 4 bytes) |
---|
262 | reserved for future use |
---|
263 | |
---|
264 | |
---|
265 | Cache Control and Memory Mapping |
---|
266 | -------------------------------- |
---|
267 | |
---|
268 | If configuration is not obtained from non-volatile RAM (ie. J1-4 is off), |
---|
269 | cache control is done through the remaining J1 jumpers as follows: |
---|
270 | |
---|
271 | If Jumper J1-7 is installed, the data cache will be turned on. If Jumper |
---|
272 | J1-6 is installed, the instruction cache will be turned on. (If a jumper |
---|
273 | is off, its corresponding cache will remain disabled). |
---|
274 | |
---|
275 | If Jumper J1-5 is installed, the data cache will be placed in copyback |
---|
276 | mode. If it is removed, it will be placed in writethrough mode. |
---|
277 | |
---|
278 | Currently, block address translation is set up to map the virtual |
---|
279 | 0x00000000--0x7FFFFFFF to the physical range 0x00000000--0x7FFFFFFF. The |
---|
280 | port relies on the hardware to raise exceptions when addressing |
---|
281 | non-existent memory. Caching is not controllable on a finer grain. |
---|
282 | |
---|
283 | |
---|
284 | Networking |
---|
285 | ---------- |
---|
286 | |
---|
287 | If configuration is not obtained from non-volatile RAM (ie. J1-4 is off), |
---|
288 | the networking parameters shown above must be specified in an initialized |
---|
289 | rtems_bsdnet_ifconfig struct. This structure is declared and initialized to |
---|
290 | specify any network devices and includes entries for ip_address, ip_netmask |
---|
291 | and hardware_address. See the Network Device Configuration section of the |
---|
292 | RTEMS Networking Supplement. |
---|
293 | |
---|
294 | When non-default (non-zero) networking paramaters are provided in NVRAM (ie. |
---|
295 | j1-4 is on), the user MUST ensure that the corresponding entries in the |
---|
296 | ifconfig struct are NULL. Failing to do so is an error, because it causes |
---|
297 | the memory allocated for the initialized struct values to be lost. |
---|
298 | |
---|
299 | |
---|
300 | Miscellaneous |
---|
301 | ------------- |
---|
302 | |
---|
303 | The timer and clock drivers were patterned after the MVME162 and MVME152 |
---|
304 | ports. |
---|
305 | |
---|
306 | At this time, we do not have an MPCI layer for the MVME167. We are planning |
---|
307 | to write one. |
---|
308 | |
---|
309 | This port supplies its own fatal_error_handler, which attempts to print some |
---|
310 | error message through 167Bug (on the Serial Port 1/Console on the MVME712M). |
---|
311 | |
---|
312 | |
---|
313 | Host System |
---|
314 | ----------- |
---|
315 | |
---|
316 | The port was initially developed on an RS-6000 running AIX 4.2. The following |
---|
317 | tools were used: |
---|
318 | |
---|
319 | - GNU gcc 2.8.1 configured for a powerpc-ibm-aix4.2.0.0 host and |
---|
320 | m68k-rtems target; |
---|
321 | - GNU binutils 2.9.1 configured for a powerpc-ibm-aix4.2.0.0 host and |
---|
322 | m68k-rtems target; |
---|
323 | |
---|
324 | It was also tested on a Pentium II-based PC running Windows NT Workstation 4.0 |
---|
325 | and the Cygnus Cygwin32 release b20.1 environment, with the following tools: |
---|
326 | |
---|
327 | - EGCS 1.1.1 configured for a i586-cygwin32 host and m68k-rtems target; |
---|
328 | - GNU binutils 2.9.4 configured for a i586-cygwin32 host and m68k-rtems |
---|
329 | target; |
---|
330 | |
---|
331 | With the latter environment, be patient; builds take a very looong time... |
---|
332 | |
---|
333 | Current development is done on a Pentium III PC running RedHat Linux 6.1. |
---|
334 | At the time this README was composed, the latest working compiler that was |
---|
335 | used successfully was gcc version 2.96 20000213 (experimental). Both the C |
---|
336 | and C++ compilers were working. Binutils 2.10 are used. |
---|
337 | |
---|
338 | |
---|
339 | Known Problems |
---|
340 | -------------- |
---|
341 | |
---|
342 | Polled I/O without termios may not work very well on input. The problem |
---|
343 | is that input processing is not done: applications may get characters too |
---|
344 | early, and may get characters that they normally would not get, such as |
---|
345 | backspace or delete. Furthermore, input is not buffered at all. The latest |
---|
346 | versions of rtems seem to set the count field in the rtems_libio_rw_args_t |
---|
347 | argument to the buffer size, not to the number of characters expected on |
---|
348 | input. Rather than wait for 1024 characters on each call, the driver |
---|
349 | returns each character when it is received. |
---|
350 | |
---|
351 | The cdtest will not run with interrupt-driven I/O. The reason is that the |
---|
352 | constructors for the static objects are called at boot time when the |
---|
353 | interrupts are still disabled. The output buffer fills up, but never empties, |
---|
354 | and the application goes into an infinite loop waiting for buffer space. This |
---|
355 | should have been documented in the rtems/c/src/tests/PROBLEMS file. The moral |
---|
356 | of this story is: do not do I/O from the constructors or destructors of static |
---|
357 | objects. |
---|
358 | |
---|
359 | Output stops prematurely in the termios test when the console is operating in |
---|
360 | interrupt-driven mode because the serial port is re-initialized before all |
---|
361 | characters in the last raw output buffer are sent. Adding calls to tcdrain() |
---|
362 | in the test task helps, but it does not solve the problem. What happens is |
---|
363 | that the CD2401 raises a transmit interrupt when the last character in the |
---|
364 | DMA buffer is written into the transmit FIFO, not when the last character |
---|
365 | has been transmitted. When tcdrain() returns, there might be up to 16 |
---|
366 | characters in the output FIFO. The call to tcsetattr() causes the serial port |
---|
367 | to re-initialize, at which point the output FIFO is cleared. We could not find |
---|
368 | a way to detect whether characters are still in the FIFO and to wait for them |
---|
369 | to be transmitted. |
---|
370 | |
---|
371 | The first raw buffer to be transmitted after the console is re-initialized |
---|
372 | with tcsetattr() is garbled. At this time, it does not seem worth while to |
---|
373 | track this problem down. |
---|
374 | |
---|
375 | In the stackchk test, an access fault exception is raised after the stack is |
---|
376 | blown. This is one case were overwritting the first or last 16 bytes of the |
---|
377 | stack does cause problems (but hey, an exception occurred, which is better |
---|
378 | than propagating the error). |
---|
379 | |
---|
380 | In the stackchk test, an access fault exception is raised after the stack is |
---|
381 | blown. This is one case were overwritting the first or last 16 bytes of the |
---|
382 | stack does cause problems (but hey, an exception occurred, which is better |
---|
383 | than propagating the error). |
---|
384 | |
---|
385 | When using interrupt-driven I/O, psx08 produces all the expected output, but |
---|
386 | it does not return control to 167Bug. Is this test supposed to work with |
---|
387 | interrupt-driven console I/O? |
---|
388 | |
---|
389 | |
---|
390 | What is new |
---|
391 | ----------- |
---|
392 | |
---|
393 | Support for Java is being actively worked on. |
---|
394 | |
---|
395 | |
---|
396 | Thanks |
---|
397 | ------ |
---|
398 | |
---|
399 | - to On-Line Applications Research Corporation (OAR) for developing |
---|
400 | RTEMS and making it available on a Technology Transfer basis; |
---|
401 | |
---|
402 | - to FSF and Cygnus Support for great free software; |
---|
403 | |
---|
404 | |
---|
405 | Test Configuration |
---|
406 | ------------------ |
---|
407 | |
---|
408 | Board: Motorola MVME167 |
---|
409 | CPU: Motorola MC68040 |
---|
410 | Clock Speed: 25 MHz |
---|
411 | RAM: 4 MBytes of 32-bit DRAM with parity |
---|
412 | Cache Configuration: Instruction cache on; data cache on, copyback mode. |
---|
413 | Times Reported in: microseconds |
---|
414 | Timer Source: VMEchip2 Tick Timer 1 |
---|
415 | GCC Flags: -m68040 -g -O4 -fomit-frame-pointer |
---|
416 | Console: Operate in polled mode. Set CD2401_POLLED_IO to 1 in |
---|
417 | rtems/c/src/lib/libbsp/m68k/mvme167/console/console.c. |
---|
418 | |
---|
419 | |
---|
420 | Test Results |
---|
421 | ------------ |
---|
422 | |
---|
423 | Single processor tests: All tests passed, except the following ones: |
---|
424 | |
---|
425 | - paranoia required the FPSP and the default variants of libm (and libc and |
---|
426 | libgcc) for us. It may work with the msoft-float variants for you, but it |
---|
427 | does require the FPSP. |
---|
428 | |
---|
429 | - cpuuse and malloctest did not work. |
---|
430 | |
---|
431 | - The stackchk test got an access fault exception before the RTEMS stack |
---|
432 | checker had had a chance to detect the corrupted stack. |
---|
433 | |
---|
434 | |
---|
435 | Multi-processort tests: not applicable -- No MPCI layer yet. |
---|
436 | |
---|
437 | |
---|
438 | Timing tests: See rtems/c/src/lib/libbsp/m68k/mvme167/times |
---|
439 | |
---|