source: rtems/bsps/m68k/mcf5206elite/start/gdbinit @ 753873e5

Last change on this file since 753873e5 was 753873e5, checked in by Joel Sherrill <joel@…>, on 03/22/22 at 20:03:30

Update Eric Norum contact info and start to normalize file headers

  • Property mode set to 100644
File size: 4.8 KB
RevLine 
[e56c3546]1#
2# GDB Init script for the Coldfire 5206e processor.
3#
4# The main purpose of this script is to perform minimum initialization of
5# processor so code can be loaded. Also, exception handling is performed.
6#
[753873e5]7
[e56c3546]8# Copyright (C) OKTET Ltd., St.-Petersburg, Russia
9# Author: Victor V. Vengerov <vvv@oktet.ru>
10#
11# This script partially based on gdb scripts written by
[753873e5]12# Eric Norum, <eric@norum.ca>
[e56c3546]13#
14# The license and distribution terms for this file may be
15# found in the file LICENSE in this distribution or at
[c499856]16# http://www.rtems.org/license/LICENSE.
[e56c3546]17#
18
19define addresses
20
21set $mbar  = 0x10000001
22set $simr  = $mbar - 1 + 0x003
23set $icr1  = $mbar - 1 + 0x014
24set $icr2  = $mbar - 1 + 0x015
25set $icr3  = $mbar - 1 + 0x016
26set $icr4  = $mbar - 1 + 0x017
27set $icr5  = $mbar - 1 + 0x018
28set $icr6  = $mbar - 1 + 0x019
29set $icr7  = $mbar - 1 + 0x01A
30set $icr8  = $mbar - 1 + 0x01B
31set $icr9  = $mbar - 1 + 0x01C
32set $icr10 = $mbar - 1 + 0x01D
33set $icr11 = $mbar - 1 + 0x01E
34set $icr12 = $mbar - 1 + 0x01F
35set $icr13 = $mbar - 1 + 0x020
36set $imr   = $mbar - 1 + 0x036
37set $ipr   = $mbar - 1 + 0x03A
38set $rsr   = $mbar - 1 + 0x040
39set $sypcr = $mbar - 1 + 0x041
40set $swivr = $mbar - 1 + 0x042
41set $swsr  = $mbar - 1 + 0x043
42set $dcrr  = $mbar - 1 + 0x046
43set $dctr  = $mbar - 1 + 0x04A
44set $dcar0 = $mbar - 1 + 0x04C
45set $dcmr0 = $mbar - 1 + 0x050
46set $dccr0 = $mbar - 1 + 0x057
47set $dcar1 = $mbar - 1 + 0x058
48set $dcmr1 = $mbar - 1 + 0x05C
49set $dccr1 = $mbar - 1 + 0x063
50set $csar0 = $mbar - 1 + 0x064
51set $csmr0 = $mbar - 1 + 0x068
52set $cscr0 = $mbar - 1 + 0x06E
53set $csar1 = $mbar - 1 + 0x070
54set $csmr1 = $mbar - 1 + 0x074
55set $cscr1 = $mbar - 1 + 0x07A
56set $csar2 = $mbar - 1 + 0x07C
57set $csmr2 = $mbar - 1 + 0x080
58set $cscr2 = $mbar - 1 + 0x086
59set $csar3 = $mbar - 1 + 0x088
60set $csmr3 = $mbar - 1 + 0x08C
61set $cscr3 = $mbar - 1 + 0x092
62set $csar4 = $mbar - 1 + 0x094
63set $csmr4 = $mbar - 1 + 0x098
64set $cscr4 = $mbar - 1 + 0x09E
65set $csar5 = $mbar - 1 + 0x0A0
66set $csmr5 = $mbar - 1 + 0x0A4
67set $cscr5 = $mbar - 1 + 0x0AA
68set $csar6 = $mbar - 1 + 0x0AC
69set $csmr6 = $mbar - 1 + 0x0B0
70set $cscr6 = $mbar - 1 + 0x0B6
71set $csar7 = $mbar - 1 + 0x0B8
72set $csmr7 = $mbar - 1 + 0x0BC
73set $cscr7 = $mbar - 1 + 0x0C2
74set $dmcr  = $mbar - 1 + 0x0C6
75set $par   = $mbar - 1 + 0x0CA
76set $tmr1  = $mbar - 1 + 0x100
77set $trr1  = $mbar - 1 + 0x104
78set $tcr1  = $mbar - 1 + 0x108
79set $tcn1  = $mbar - 1 + 0x10C
80set $ter1  = $mbar - 1 + 0x111
81set $tmr2  = $mbar - 1 + 0x120
82set $trr2  = $mbar - 1 + 0x124
83set $tcr2  = $mbar - 1 + 0x128
84set $tcn2  = $mbar - 1 + 0x12C
85set $ter2  = $mbar - 1 + 0x131
86
87end
88
89#
90#  Setup CSAR0 for the FLASH ROM.
91#
92
93define setup-cs
94
95set *((short*) $csar0) = 0xffe0
96set *((int*)   $csmr0) = 0x000f0000
97set *((short*) $cscr0) = 0x1da3
98set *((short*) $csar1) = 0x5000
99set *((int*)   $csmr1) = 0x00000000
100set *((short*) $cscr1) = 0x3d43
101set *((short*) $csar2) = 0x3000
102set *((int*)   $csmr2) = 0x000f0000
103set *((short*) $cscr2) = 0x1903
104set *((short*) $csar3) = 0x4000
105set *((int*)   $csmr3) = 0x000f0000
106set *((short*) $cscr3) = 0x0083
107
108end
109
110#
111# Setup the DRAM controller.
112#
113
114define setup-dram
115
116set *((short*) $dcrr)  = 24
117set *((short*) $dctr)  = 0x0000
118set *((short*) $dcar0) = 0x0000
119set *((long*)  $dcmr0) = 0x000e0000
120set *((char*)  $dccr0) = 0x07
121set *((short*) $dcar1) = 0x0000
122set *((long*)  $dcmr1) = 0x00000000
123set *((char*)  $dccr1) = 0x00
124
125end
126
127
128#
129# Wake up the board
130#
131
132define initboard
133
134addresses
135setup-cs
136# setup-dram
137
138end
139
140define ss
141si
142x/i $pc
143end
144
145#
146# Display exception information
147#
148define exception-info
149set $excpc = *(unsigned int *)($sp+4)
150set $excfmt = (*(unsigned int *)$sp >> 28) & 0x0f
151set $excfs = ((*(unsigned int *)$sp >> 24) & 0x0c) | \
152             ((*(unsigned int *)$sp >> 16) & 0x03)
153set $excvec = (*(unsigned int *)$sp >> 18) & 0xff
154set $excsr = *(unsigned int *)$sp & 0xffff
155
156printf "EXCEPTION -- SR:0x%X  PC:0x%X  FRAME:0x%X VECTOR:%d\n", \
157        $excsr, $excpc, $sp, $excvec
158if $excvec == 2
159    printf "Access error exception"
160end
161if $excvec == 3
162    printf "Address error exception"
163end
164if $excvec == 4
165    printf "Illegal instruction exception"
166end
167if $excvec == 8
168    printf "Privelege violation exception"
169end
170if $excvec == 9
171    printf "Trace exception"
172end
173if $excvec == 10
174    printf "Unimplemented LINE-A opcode exception"
175end
176if $excvec == 11
177    printf "Unimplemented LINE-F opcode exception"
178end
179if $excvec == 12
180    printf "Debug interrupt"
181end
182if $excvec == 14
183    printf "Format error exception"
184end
185if $excfs == 0x04
186    printf " on instruction fetch"
187end
188if $excfs == 0x08
189    printf " on operand write"
190end
191if $excfs == 0x09
192    printf " on write to write-protected space"
193end
194if $excfs == 0x0c
195    printf " on operand read"
196end
197printf "\n"
198x/4i $excpc
199set $pc=$excpc
200set $sp=$sp+8
201end
202
203target bdm /dev/bdmcf0
204initboard
205load
206set $pc=start
207set $sp=0x20001ffc
208b bsp_cleanup
209b _stop
210b _unexp_exception
211commands
212silent
213exception-info
214end
215b _unexp_int
216b _reserved_int
217b _spurious_int
Note: See TracBrowser for help on using the repository browser.