]> rtime.felk.cvut.cz Git - rtems-devel.git/blob - rtems-patches/current/rtems-mo376-m68376-updates.patch
Update of the build and patches to rtems-4.7.1
[rtems-devel.git] / rtems-patches / current / rtems-mo376-m68376-updates.patch
1 ---
2  c/src/lib/libbsp/m68k/mo376/clock/ckinit.c       |    2 
3  c/src/lib/libbsp/m68k/mo376/include/bsp.h        |   26 +
4  c/src/lib/libbsp/m68k/mo376/include/mo376.h      |   27 -
5  c/src/lib/libbsp/m68k/mo376/misc/gdbinit68       |  395 ++++++++++++++++++++++-
6  c/src/lib/libbsp/m68k/mo376/spurious/spinit.c    |   10 
7  c/src/lib/libbsp/m68k/mo376/startup/linkcmds     |   10 
8  c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM |   17 
9  c/src/lib/libbsp/m68k/mo376/startup/start_c.c    |    6 
10  make/custom/mo376.cfg                            |   10 
11  9 files changed, 455 insertions(+), 48 deletions(-)
12
13 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/bsp.h
14 ===================================================================
15 --- rtems.orig/c/src/lib/libbsp/m68k/mo376/include/bsp.h        2007-08-14 17:24:09.000000000 +0200
16 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/bsp.h     2007-08-14 17:36:35.000000000 +0200
17 @@ -1,6 +1,6 @@
18  /*  bsp.h
19   *
20 - *  This include file contains all mrm board IO definitions.
21 + *  This include file contains all mo376 board IO definitions.
22   *
23   *  COPYRIGHT (c) 1989-1999.
24   *  On-Line Applications Research Corporation (OAR).
25 @@ -41,6 +41,30 @@
26  /* #define CONFIGURE_INTERRUPT_STACK_MEMORY  (TBD * 1024) */
27  
28  /*
29 + * Network driver configuration
30 + */
31 +struct rtems_bsdnet_ifconfig;
32 +extern int cs8900_driver_attach (struct rtems_bsdnet_ifconfig *config, int attaching);
33 +#define RTEMS_BSP_NETWORK_DRIVER_NAME  "cs8900"
34 +#define RTEMS_BSP_NETWORK_DRIVER_ATTACH        cs8900_driver_attach
35 +
36 +/* CS8900 ethernet interface definitions */
37 +
38 +#define CS8900_DEVICES            (1)
39 +#define CS8900_IO_BASE            (0x0300)
40 +#define CS8900_MEMORY_BASE        (0x1000)
41 +#define CS8900_DATA_BUS_SWAPPED        
42 +#define CS8900_IO_MODE
43 +#define CS8900_RX_QUEUE_SIZE      (50)
44 +
45 +#define ETHERNET_BASE             (0xf8a000)
46 +#define ETHERNET_IRQ_LEVEL        (2)
47 +#define ETHERNET_IRQ_PRIORITY     (2)
48 +#define ETHERNET_IRQ_VECTOR       (26)
49 +/* #define ETHERNET_IRQ_VECTOR       (AUTOVEC_VECTOR + ETHERNET_IRQ_LEVEL) */
50 +#define ETHERNET_MAC_ADDRESS {0x00,0x00,0xc0,0x2c,0x54,0xa4}
51 +
52 +/*
53   *  Simple spin delay in microsecond units for device drivers.
54   *  This is very dependent on the clock speed of the target.
55   */
56 Index: rtems/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c
57 ===================================================================
58 --- rtems.orig/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c       2007-08-14 17:24:09.000000000 +0200
59 +++ rtems/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c    2007-08-14 17:36:35.000000000 +0200
60 @@ -60,7 +60,7 @@
61    Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
62  
63    /* enable 1mS interrupts */
64 -  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );/* load counter */
65 +  *PITR = (unsigned short int)( SAM(0x08,0,PITM) );/* load counter */
66    *PICR = (unsigned short int)                     /* enable interrupt */
67      ( SAM(ISRL_PIT,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
68  
69 Index: rtems/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68
70 ===================================================================
71 --- rtems.orig/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68       2007-08-14 17:20:30.000000000 +0200
72 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68    2007-08-14 17:36:35.000000000 +0200
73 @@ -1,16 +1,399 @@
74  #
75  #  $Id: gdbinit68,v 1.1 2001/05/25 16:28:46 joel Exp $
76  #
77 -echo Setting up the environment for mrm debuging.\n
78 +echo Setting up the environment for mo376 debuging.\n
79  
80 -target bdm /dev/bdmcpu320
81 -bdm_setdelay 1000
82 +# invoke by "source run376.gdb"
83 +
84 +echo Setting bdm\n
85 +
86 +#set prompt (gdb68)
87 +
88 +#file tst
89 +#file flash
90 +
91 +# Linux
92 +target bdm /dev/bdm
93 +#target bdm /dev/m683xx-bdm/icd0
94 +#target bdm /dev/icd_bdm0
95 +#target bdm /dev/pd_bdm0
96 +
97 +# Windows
98 +#target bdm bdm-cpu32-icd1
99 +
100 +# Serial targets
101 +#target remote COM2
102 +#target remote /dev/ttyS1
103 +
104 +# automatic resed of board before "run" command execution
105 +# depends on correct "cpu32init" file in current ditectory
106  bdm_autoreset on
107 +
108 +# confirmation of dangerous operations (kill, run, ..)
109 +set confirm on
110 +
111 +#===========================================================
112 +# sets chipselects and configuration
113 +define bdm_hw_init
114 +echo bdm_hw_init ...\n
115 +
116  set remotecache off
117  bdm_timetocomeup 0
118 -bdm_init
119 +bdm_autoreset off
120 +bdm_setdelay 100
121  bdm_reset
122 +bdm_setdelay 0
123  set $sfc=5
124  set $dfc=5
125 -r
126 -q
127 +
128 +# system configuration
129 +
130 +# 0xFFFA00 - SIMCR - SIM Configuration Register
131 +# 15    14    13    12 11     10 9  8 7    6  5 4 3     0
132 +# EXOFF FRZSW FRZBM 0  SLVEN  0  SHEN SUPV MM 0 0 IARB
133 +# 0     0     0     0  DATA11 0  0  0 1    1  0 0 1 1 1 1
134 +# set *(short *)0xfffa00=0x42cf
135 +set *(short *)0xfffa00=0x40cf
136 +
137 +# 0xFFFA21 - SYPCR - System Protection Control Register 
138 +# 7   6      5 4 3   2   1 0
139 +# SWE SWP    SWT HME BME BMT
140 +# 1   MODCLK 0 0 0   0   0 0
141 +set *(char *)0xfffa21=0x06
142 +
143 +# 0xYFFA27 - SWSR - Software Service Register
144 +# write 0x55 0xAA for watchdog 
145 +
146 +# 0xFFFA04 - SYNCR Clock Synthesizer Control Register 
147 +# 15 14 13        8 7    6 5 4     3     2     1     0
148 +# W  X  Y           EDIV 0 0 SLIMP SLOCK RSTEN STSIM STEXT
149 +# 0  0  1 1 1 1 1 1 0    0 0 U     U     0     0     0
150 +#set *(short *)0xfffa04=0xd408
151 +# set 21 MHz system clock for ref 4 MHz
152 +
153 +# $YFFA17 - PEPAR - Port E Pin Assignment Register
154 +# 7     6     5     4     3     2     1      0
155 +# PEPA7 PEPA6 PEPA5 PEPA4 PEPA3 PEPA2 PEPA1  PEPA0
156 +# SIZ1  SIZ0  AS    DS    RMC   AVEC  DSACK1 DSACK0
157 +#   1 .. control signal, 0 .. port F
158 +#   after reset determined by DATA8
159 +set *(char*)0xfffa17=0xf4
160 +
161 +# 0xFFFA1F - PFPAR - Port F Pin Assignment Register
162 +# 7     6     5     4     3     2     1     0
163 +# PFPA7 PFPA6 PFPA5 PFPA4 PFPA3 PFPA2 PFPA1 PFPA0
164 +# INT7  INT6  INT5  INT4  INT3  INT2  INT1  MODCLK
165 +#   1 .. control signal, 0 .. port F
166 +#   after reset determined by DATA9
167 +set *(char*)0xfffa1f=0
168 +
169 +# Setup internal RAM
170 +
171 +# setup STANBY RAM at 0x8000
172 +#   RAMMCR ... STOP
173 +set *(short *)0xFFFB40=0x8000
174 +#   RAMBAH RAMBAL
175 +set *(int *)0xFFFB44=0xFFD000
176 +#   RAMMCR ... ENABLE
177 +set *(short *)0xFFFB40=0
178 +
179 +# setup TPU RAM at 0x8000
180 +#   TRAMMCR
181 +set *(short *)0xFFFB00=0x8000
182 +#   TRAMBAR
183 +set *(short *)0xFFFB04=0xFFE000>>8
184 +#   TRAMMCR
185 +set *(short *)0xFFFB00=0
186 +
187 +# 0xYFFA44 - CSPAR0 - Chip Select Pin Assignment Register 0 
188 +# 15 14 13 12    11 10    9 8      7 6      5 4      3 2      1 0
189 +# 0  0  CSPA0[6] CSPA0[5] CSPA0[4] CSPA0[3] CSPA0[2] CSPA0[1] CSBOOT
190 +# 0  0  DATA2 1  DATA2 1  DATA2 1  DATA1 1  DATA1 1  DATA1 1  1 DATA0
191 +#       CS5      CS4      CS3      CS2      CS1      CS0      CSBOOT
192 +#       FC2 PC2  FC1 PC1  FC0 PC0  BGACK    BG       BR
193 +#
194 +# 00 Discrete Output
195 +# 01 Alternate Function
196 +# 10 Chip Select (8-Bit Port)
197 +# 11 Chip Select (16-Bit Port)
198 +#
199 +set *(short *)0xfffa44=0x3bff
200 +# CS4 8-bit rest 16-bit
201 +
202 +
203 +# 0xFFFA46 - CSPAR1 - Chip Select Pin Assignment Register 1
204 +# 15 14 13 12 11 10 9 8      7 6      5 4      3 2      1 0
205 +# 0  0  0  0  0  0  CSPA1[4] CSPA1[3] CSPA1[2] CSPA1[1] CSPA1[0]
206 +# 0  0  0  0  0  0  DATA7 1  DATA76 1 DATA75 1 DATA74 1 DATA73 1
207 +#                   CS10     CS9      CS8      CS7      CS6
208 +#                   A23 ECLK A22 PC6  A21 PC5  A20 PC4  A19 PC3
209 +#
210 +set *(short *)0xfffa46=0x03a9
211 +# CS7,CS8,CS9 8-bit CS10 16-bit and A19
212 +
213 +#
214 +# Chip selects configuration
215 +#
216 +# 0xFFFA48 - CSBARBT - Chip-Select Base Address Register Boot ROM
217 +# 0xFFFA4C..0xFFFA74 - CSBAR[10:0] - Chip-Select Base Address Registers
218 +# 15  14  13  12  11  10  9   8   7   6   5   4   3   2   0
219 +# A23 A22 A21 A20 A19 A18 A17 A16 A15 A14 A13 A12 A11 BLKSZ
220 +# reset 0x0003 for CSBARBT and 0x0000 for CSBAR[10:0]  
221 +#
222 +# BLKSZ Size Address Lines Compared
223 +# 000   2k   ADDR[23:11]
224 +# 001   8k   ADDR[23:13]
225 +# 010   16k  ADDR[23:14]
226 +# 011   64k  ADDR[23:16]
227 +# 100   128k ADDR[23:17]
228 +# 101   256k ADDR[23:18]
229 +# 110   512k ADDR[23:19]
230 +# 111   1M   ADDR[23:20]
231 +#
232 +#
233 +# 0xFFFA4A - CSORBT - Chip-Select Option Register Boot ROM
234 +# 0xFFFA4E..0xFFFA76 - CSOR[10:0] - Chip-Select Option Registers
235 +# 15   14 13  12 11 10   9       6  5  4  3 1  0
236 +# MODE BYTE   R/W   STRB DSACK      SPACE IPL  AVEC
237 +# 0    1  1   1  1  0    1 1 0 1 1  1  0  0 0  0  - for CSORBT
238 +#
239 +# BYTE  00 Disable, 01 Lower Byte, 10 Upper Byte, 11 Both Bytes
240 +# R/W   00 Reserved,01 Read Only,  10 Write Only, 11 Read/Write
241 +# SPACE 00 CPU,     01 User,       10 Supervisor, 11 Supervisor/User
242 +#
243 +set *(short *)0xfffa48=(0x800000>>8)&0xfff8 | 7
244 +set *(short *)0xfffa4a=(0<<15)|(3<<13)|(3<<11)|(0<<10)|(0<<6)|(3<<4)
245 +# BOOT ROM 0x800000 1MB  RW UL
246 +
247 +set *(short *)0xfffa4c=(0x900000>>8)&0xfff8 | 7
248 +set *(short *)0xfffa4e=(0<<15)|(3<<13)|(3<<11)|(0<<10)|(0<<6)|(3<<4)
249 +# CS0  ROM 0x900000 1MB  RW UL
250 +
251 +#set *(long *)0xfffa50=0x0003303e  
252 +# CS1  RAM 0x000000 64k   WR L
253 +
254 +set *(short *)0xfffa54=(0x000000>>8)&0xfff8 | 7
255 +set *(short *)0xfffa56=(0<<15)|(3<<13)|(3<<11)|(0<<10)|(0<<6)|(3<<4)
256 +# CS2  RAM 0x000000 1MB   RW UL - Main RAM first 1MB
257 +
258 +#set *(short *)0xfffa58=(0x100000>>8)&0xfff8 | 7
259 +#set *(short *)0xfffa5A=(0<<15)|(3<<13)|(3<<11)|(0<<10)|(0<<6)|(3<<4)
260 +# CS3  RAM 0x100000 1MB   RW UL - Main RAM second 1MB
261 +
262 +set *(short *)0xfffa5c=(0xf00000>>8)&0xfff8 | 6
263 +set *(short *)0xfffa5e=(0<<15)|(3<<13)|(3<<11)|(1<<10)|(2<<6)|(3<<4)
264 +# CS4 PER 0xf00000 512kB  RW UL - CMOS RAM, RTC, other devices
265 +
266 +#set *(long *)0xfffa60=0xffe8783f  
267 +# CS5
268 +
269 +#set *(long *)0xfffa64=0x100438f0  
270 +# CS6  R/R 0x100000 128k  RW L
271 +
272 +set *(short *)0xfffa68=(0xf87000>>8)&0xfff8 | 0
273 +set *(short *)0xfffa6a=(0<<15)|(3<<13)|(3<<11)|(1<<10)|(1<<6)|(3<<4)
274 +# CS7  PER 0xf87000  2k   RW UL - MO_PWR
275 +
276 +set *(short *)0xfffa6c=(0xf88000>>8)&0xfff8 | 0
277 +set *(short *)0xfffa6e=(0<<15)|(3<<13)|(3<<11)|(1<<10)|(1<<6)|(3<<4)
278 +# CS8  PER 0xf88000  2k   RO UL - IRC
279 +
280 +set *(short *)0xfffa70=(0xf89000>>8)&0xfff8 | 0
281 +set *(short *)0xfffa72=(0<<15)|(3<<13)|(3<<11)|(1<<10)|(3<<6)|(3<<4)
282 +# CS9  PER 0xf89000  2k   WR UL - KBD
283 +
284 +#set *(long *)0xfffa74=0x01035030  
285 +# CS10 RAM 0x010000 64k   WR U
286 +
287 +#
288 +# My change
289 +#
290 +#set *(long *)0xfffa58=0x02036870  
291 +# CS3  RAM 0x020000 64k   RO UL
292 +
293 +#set *(long *)0xfffa64=0x02033030  
294 +# CS6  RAM 0x020000 64k   WR L
295 +
296 +#set *(long *)0xfffa68=0x02035030  
297 +# CS7  RAM 0x020000 64k   WR U
298 +
299 +
300 +# CPU registers
301 +
302 +# SR=PS Status Register
303 +# 15 14 13 12 11 10  8 7 6 5 4 3 2 1 0
304 +# T1 T0  S  0  0 IP___ 0 0 0 X N Z V C
305 +# 0   0  1  0  0 1 1 1 0 0 0 U U U U U
306 +
307 +bdm_status
308 +
309 +end
310 +#===========================================================
311 +
312 +# sets well defined values into VBR 
313 +define vbr_set_all
314 +  set $vec_num=0
315 +  set $vbr_val=(unsigned)$vbr
316 +  while $vec_num<256
317 +    set *(unsigned*)($vbr_val+$vec_num*4)=($vec_num*16)+0xf0000
318 +    set $vec_num++
319 +  end
320 +end
321 +
322 +# Test writability of RAM location
323 +define bdm_test_ram_acc
324 +  echo testing ...
325 +  p /x $arg0
326 +  set $ram_addr=(unsigned int)$arg0
327 +  set $old_ram_val0=*(int*)$ram_addr
328 +  set $old_ram_val1=*(int*)($ram_addr+4)
329 +  set *(int*)($ram_addr+3)=0xff234567
330 +  set *(int*)$ram_addr=0x12345678
331 +  if *(int*)$ram_addr!=0x12345678
332 +    printf "Error1  %08X\n",*(int*)$ram_addr
333 +  end
334 +  set *(char*)$ram_addr=0xab
335 +  if *(int*)$ram_addr!=0xab345678
336 +    printf "Error2  %08X\n",*(int*)$ram_addr
337 +  end
338 +  set *(char*)($ram_addr+1)=0xcd
339 +  if *(int*)$ram_addr!=0xabcd5678
340 +    printf "Error3  %08X\n",*(int*)$ram_addr
341 +  end
342 +  set *(char*)($ram_addr+3)=0x01
343 +  if *(int*)$ram_addr!=0xabcd5601
344 +    printf "Error4  %08X\n",*(int*)$ram_addr
345 +  end
346 +  set *(char*)($ram_addr+2)=0xef
347 +  if *(int*)$ram_addr!=0xabcdef01
348 +    printf "Error5  %08X\n",*(int*)$ram_addr
349 +  end
350 +  if *(int*)$ram_addr!=0xabcdef01
351 +    printf "Error5  %08X\n",*(int*)$ram_addr
352 +  end
353 +  if *(int*)($ram_addr+1)!=0xcdef0123
354 +    printf "Error6  %08X\n",*(int*)$ram_addr
355 +  end
356 +  if *(int*)($ram_addr+2)!=0xef012345
357 +    printf "Error7  %08X\n",*(int*)$ram_addr
358 +  end
359 +  if *(int*)($ram_addr+2)!=0xef012345
360 +    printf "Error8  %08X\n",*(int*)$ram_addr
361 +  end
362 +  if *(int*)($ram_addr+3)!=0x01234567
363 +    printf "Error9  %08X\n",*(int*)$ram_addr
364 +  end
365 +  set *(int*)$ram_addr=$old_ram_val0
366 +  set *(int*)($ram_addr+4)=$old_ram_val1
367 +end
368 +
369 +# Read flash identification
370 +define bdm_read_flash_id
371 +  set $flash_base=(int)$arg0&~0xffff
372 +  output /x $flash_base
373 +  echo \n
374 +  set *(char*)($flash_base+0x555*2+1)=0xf0
375 +  set *(char*)($flash_base+0x555*2+1)=0xaa
376 +  set *(char*)($flash_base+0x2aa*2+1)=0x55
377 +  set *(char*)($flash_base+0x555*2+1)=0x90
378 +  p /x *(char*)($flash_base+0x00*2+1) 
379 +  set *(char*)($flash_base+0x555*2+1)=0xf0
380 +  set *(char*)($flash_base+0x555*2+1)=0xaa
381 +  set *(char*)($flash_base+0x2aa*2+1)=0x55
382 +  set *(char*)($flash_base+0x555*2+1)=0x90
383 +  p /x *(char*)($flash_base+0x01*2+1) 
384 +end
385 +
386 +define bdm_read_flash1_id
387 +  bdm_read_flash_id 0x800000
388 +end
389 +
390 +define bdm_read_flash2_id
391 +  bdm_read_flash_id 0x900000
392 +end
393 +
394 +define bdm_test_flash_write
395 +  set $flash_base=(int)$arg0 & ~0xffff
396 +  output /x $flash_base
397 +  echo \n
398 +  set *(char*)($flash_base+0x555*2+1)=0xf0
399 +  set *(char*)($flash_base+0x555*2+1)=0xaa
400 +  set *(char*)($flash_base+0x2aa*2+1)=0x55
401 +  set *(char*)($flash_base+0x555*2+1)=0xA0
402 +  set *(char*)($arg0)=$arg1
403 +end
404 +
405 +define bdm_test_pwm0
406 +
407 +  #BIUMCR - BIU Module Configuration Register $YFF400
408 +  set *(short*)0xfff400=*(short*)0xfff400&~0x8000
409 +  #CPCR - CPSM Control Register $YFF408  
410 +  set *(short*)0xfff408=*(short*)0xfff408|8
411 +  #PWM5SIC - PWM5 Status/Interrupt/Control Register $YFF428
412 +  set *(short*)0xfff428=0x18
413 +  #PWM5A1 - PWM5 Period Register $YFF42A
414 +  set *(short*)0xfff42a=512
415 +  #PWM5B1 - PWM5 Pulse Width Register $YFF42C
416 +  set *(short*)0xfff42c=0
417 +
418 +  if $arg0==0
419 +    set *(short*)0xf87000=0
420 +    set $pwm_val=0
421 +  else
422 +    if $arg0>0
423 +      set *(char*)0xf87000=1
424 +      set $pwm_val=$arg0
425 +    else
426 +      set *(char*)0xf87000=2
427 +      set $pwm_val=-($arg0)
428 +    end
429 +  end
430 +  #DDRQA
431 +  set *(short*)0xfff208=0x8000
432 +  #PORTQA
433 +  set *(short*)0xfff206=~0x8000
434 +
435 +  #PWM5B1 - PWM5 Pulse Width Register $YFF42C
436 +  set *(short*)0xfff42c=$pwm_val
437 +
438 +end
439 +
440 +define bdm_test_usd_irc
441 +  set $usd_irc_d=0xf88000
442 +  set $usd_irc_c=0xf88001
443 +  if $arg0!=0
444 +    # Load Gate
445 +    set *(unsigned char*)0xf88020=0
446 +    # CMR
447 +    set *(unsigned char*)$usd_irc_c=0x38
448 +    # IOR
449 +    set *(unsigned char*)$usd_irc_c=0x49
450 +    # IDR
451 +    set *(unsigned char*)$usd_irc_c=0x61
452 +    # RLD - Reset BP, BT CT CPT S
453 +    set *(unsigned char*)$usd_irc_c=0x05
454 +    # DATA - PSC
455 +    set *(unsigned char*)$usd_irc_d=0x02
456 +    # RLD - Reset BP, PR0 -> PSC
457 +    set *(unsigned char*)$usd_irc_c=0x1B
458 +  end
459 +  # RLD - Reset BP, CNTR -> OL
460 +  set *(unsigned char*)$usd_irc_c=0x11
461 +
462 +  set $usd_irc_val=((int)(*(unsigned char*)$usd_irc_d))
463 +  set $usd_irc_val+=((int)(*(unsigned char*)$usd_irc_d))<<8
464 +  set $usd_irc_val+=((int)(*(unsigned char*)$usd_irc_d))<<16
465 +  print /x $usd_irc_val
466 +
467 +end
468 +
469 +define six
470 +  si
471 +  x /10i $pc
472 +end
473 +
474 +bdm_hw_init
475 +
476 +#b main
477 +
478 +run
479 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/mo376.h
480 ===================================================================
481 --- rtems.orig/c/src/lib/libbsp/m68k/mo376/include/mo376.h      2007-08-14 17:24:09.000000000 +0200
482 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/mo376.h   2007-08-14 17:36:35.000000000 +0200
483 @@ -26,31 +26,22 @@
484  #define EFI_INT1 25            /* CTS interrupt */
485  #define ISRL_SCI 6
486  
487 -/* System Clock definitions */
488 -#define XTAL 32768.0           /* crystal frequency in Hz */
489 +#define SIM_PFPAR (SIM_CRB + 0x1f)
490  
491 -#if 0
492 -/* Default MRM clock rate (8.388688 MHz) set by CPU32: */
493 -#define MRM_W 0                        /* system clock parameters */
494 -#define MRM_X 0
495 -#define MRM_Y 0x3f
496 -#endif
497 +/* System Clock definitions */
498 +#define XTAL 4000000.0         /* crystal frequency in Hz */
499  
500  #if 1
501 -/* 16.77722 MHz: */
502 -#define MRM_W 1                        /* system clock parameters */
503 -#define MRM_X 1
504 -#define MRM_Y 0x0f
505 -#endif
506 -
507 -#if 0
508 -/* 25.16582 MHz: */
509 +/* Default MO376 clock rate (21.000 MHz) set by CPU32: */
510  #define MRM_W 1                        /* system clock parameters */
511  #define MRM_X 1
512 -#define MRM_Y 0x17
513 +#define MRM_Y 20
514  #endif
515  
516 -#define SYS_CLOCK (XTAL*4.0*(MRM_Y+1)*(1 << (2*MRM_W+MRM_X)))
517 +/*68332*/
518 +/*#define SYS_CLOCK (XTAL*4.0*(MRM_Y+1)*(1 << (2*MRM_W+MRM_X)))*/
519 +/*68376*/
520 +#define SYS_CLOCK (XTAL/32.0*(MRM_Y+1)*(1 << (2*MRM_W+MRM_X)))
521  #define SCI_BAUD 19200         /* RS232 Baud Rate */
522  
523  /* macros/functions */
524 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM
525 ===================================================================
526 --- rtems.orig/c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM 2007-08-14 17:20:30.000000000 +0200
527 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM      2007-08-14 17:36:35.000000000 +0200
528 @@ -4,7 +4,8 @@
529   */
530  
531  OUTPUT_ARCH(m68k)
532 -STARTUP(except_vect_332_ROM.o)
533 +/* Not needed, mo376 uses initialization by mo_flashbb */
534 +/* STARTUP(except_vect_332_ROM.o) */
535  __DYNAMIC  =  0;
536  
537  /*
538 @@ -39,18 +40,18 @@
539  
540  MEMORY
541  {
542 -  rom     : ORIGIN = 0x90000, LENGTH = 0x70000
543 -  ram     : ORIGIN = 0x03000, LENGTH = 0x7d000
544 +  ram     : ORIGIN = 0x001000, LENGTH = 0x0ff000
545 +  rom     : ORIGIN = 0x808000, LENGTH = 0x0f8000
546  }
547  
548 -_RamBase = DEFINED(_RamBase) ? _RamBase : 0x003000;
549 -_RamSize = DEFINED(_RamSize) ? _RamSize : 0x7d000;
550 +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x001000;
551 +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x0ff000;
552  _RamEnd = _RamBase + _RamSize;
553  
554 -__end_of_ram = 0x080000;
555 +__end_of_ram = 0x100000;
556  _copy_data_from_rom = 1;
557 -_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
558 -_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
559 +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x40000;
560 +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
561  
562  /*
563   * 
564 Index: rtems/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c
565 ===================================================================
566 --- rtems.orig/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c    2007-08-14 17:20:30.000000000 +0200
567 +++ rtems/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c 2007-08-14 17:45:18.000000000 +0200
568 @@ -33,8 +33,8 @@
569    rtems_vector_number vector
570  )
571  {
572 -  /*int sp = 0; */
573 -#if 0
574 +  int sp = 0;
575 +#if 1
576    const char * const VectDescrip[] = {
577      _Spurious_Error_[0],   _Spurious_Error_[0],  _Spurious_Error_[1],
578      _Spurious_Error_[2],   _Spurious_Error_[3],  _Spurious_Error_[4],
579 @@ -60,11 +60,11 @@
580      _Spurious_Error_[27], _Spurious_Error_[28]};
581  #endif
582  
583 -  /*asm volatile ( "movea.l   %%sp,%0 " : "=a" (sp) : "0" (sp) ); */
584 +  asm volatile ( "movea.l   %%sp,%0 " : "=a" (sp) : "0" (sp) );
585  
586    _CPU_ISR_Set_level( 7 );
587    /*_UART_flush(); */
588 -#if 0
589 +#if 1
590    RAW_PUTS("\n\rRTEMS: Spurious interrupt: ");
591    RAW_PUTS((char *)VectDescrip[( (vector>64) ? 64 : vector )]);
592    RAW_PUTS("\n\rRTEMS:    Vector: ");
593 @@ -89,6 +89,7 @@
594      {
595        switch (vector)
596         {
597 +#if 0
598         case 4:
599         case 9:
600         case 31:
601 @@ -96,6 +97,7 @@
602         case 66:
603           /* These vectors used by CPU32bug - don't overwrite them. */
604           break;
605 +#endif
606  
607         default:
608           (void) set_vector( Spurious_Isr, vector, 1 );
609 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds
610 ===================================================================
611 --- rtems.orig/c/src/lib/libbsp/m68k/mo376/startup/linkcmds     2007-08-14 17:20:30.000000000 +0200
612 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds  2007-08-14 17:36:35.000000000 +0200
613 @@ -33,15 +33,15 @@
614  /*
615   * Declare some sizes.
616   */
617 -_RamBase = DEFINED(_RamBase) ? _RamBase : 0x10000;
618 -_RamSize = DEFINED(_RamSize) ? _RamSize : 0x70000;
619 +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x001000;
620 +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x0ff000;
621  _RamEnd = _RamBase + _RamSize;
622 -_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
623 -_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
624 +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x40000;
625 +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
626  
627  MEMORY
628  {
629 -  ram     : ORIGIN = 0x10000, LENGTH = 0x70000
630 +  ram     : ORIGIN = 0x001000, LENGTH = 0x0ff000
631  }
632  
633  _copy_data_from_rom = 0;
634 Index: rtems/make/custom/mo376.cfg
635 ===================================================================
636 --- rtems.orig/make/custom/mo376.cfg    2007-08-14 17:24:09.000000000 +0200
637 +++ rtems/make/custom/mo376.cfg 2007-08-14 17:41:03.000000000 +0200
638 @@ -16,8 +16,14 @@
639  #  and (hopefully) optimize for it. 
640  CPU_CFLAGS = -mcpu32
641  
642 -# optimize flag: typically -O2
643 -CFLAGS_OPTIMIZE_V = -O2 -g -fomit-frame-pointer
644 +# Debugging flags:  If we debug with optimization on, single-stepping
645 +# sometimes looks a little odd, but there won't be any surprises later.
646 +CFLAGS_DEBUG_V += -O2 -ggdb
647 +CXXFLAGS_DEBUG_V += -O2 -ggdb
648 +
649 +# optimize flag: typically -0, could use -O4 or -fast, -O4 is ok for RTEMS
650 +CFLAGS_OPTIMIZE_V=-O2 -fomit-frame-pointer -ggdb
651 +CXXFLAGS_OPTIMIZE_V=-O2 -ggdb
652  
653  # The following are definitions of make-exe which will work using ld as
654  # is currently required.
655 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/start_c.c
656 ===================================================================
657 --- rtems.orig/c/src/lib/libbsp/m68k/mo376/startup/start_c.c    2007-08-14 17:24:09.000000000 +0200
658 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/start_c.c 2007-08-14 17:36:35.000000000 +0200
659 @@ -60,12 +60,12 @@
660  
661    /* Port E and F Data Direction Register */
662    /*    see section 9 of the SIM Reference Manual */
663 -  *DDRE = (unsigned char) 0xff;
664 -  *DDRF = (unsigned char) 0xfd;
665 +  *DDRE = (unsigned char) 0x01;
666 +  *DDRF = (unsigned char) 0x00;
667  
668    /* Port E and F Pin Assignment Register */
669    /*    see section 9 of the SIM Reference Manual */
670 -  *PEPAR = (unsigned char) 0;
671 +  *PEPAR = (unsigned char) 0xf4;
672    *PFPAR = (unsigned char) 0;
673  
674    /* end of SIM initalization code */