-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_juno_a57a53.cmm
269 lines (228 loc) · 9.37 KB
/
start_juno_a57a53.cmm
1
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
; --------------------------------------------------------------------------------
; @Title: Startup script for the ARM juno board
; @Description:
; This script configures the base addresses for debug and attaches to the core
; @Keywords: AARCH, ARMv8, ARM64, armcc, Cortex-A53, Cortex-A57, Juno, Juno-Board
; big.LITTLE
; @Author: BES
; @Board: Juno
; @Chip: Cortex-A57 Cortex-A53
; @Copyright: (C) 1989-2014 Lauterbach GmbH, licensed for use with TRACE32(R) only
; --------------------------------------------------------------------------------
; $Id: start_juno_a57a53.cmm 8511 2015-07-07 06:46:45Z bschroefel $
;
; NOTE: Interrupts are disabled with SYStem.Option IMASKASM and IMASKHLL per
; default
;
;
; Juno board big.LITTLE Configuration:
; * 2x Cortex-A57
; * 4x Cortex-A53
;
; --------------------------------------------------------------------------------
; Calling convention:
;
; CD.DO start_juno_a57a53.cmm <cpu_num> <cfg_mode>
;
; <cpu_num> The number of CPUs to be debugged. If this parameter is omitted
; the CPU number will default to 6. (4x Cortex-A53 and
; 2x Cortex-A57) and the system is NOT configured as a big.LITTLE
; system. It is configured as a SMP-6 system. When <cpu_num> is
; specified, the system will be configured as big.LITTLE.
;
; <cfg_mode> Determines whether the sript attaches to the CPU or not.
; If PREPAREONLY is. passed, only the Coresight configuration
; will be done. if no parameter or ATTACH is passed, the script
; will attach to the cores.
; --------------------------------------------------------------------------------
; Examples:
;
; 1) Call without parameters. In this case all cores will be debugged as SMP-6
; system. The script will wait for system power and automatically attach to
; the CPU. Without any further parameters, the system will not be debugged as
; big.LITTLE system.
; CD.DO start_juno_a57a53.cmm
;
; 2) Call with a defined number of CPUs, example 2 CPUs. The script will wait
; for system power and automatically attach to the CPU. The system is
; debugged as big.LITTLE system
; CD.DO start_juno_a57a53.cmm 2.
;
; 3) Call with a defined number of CPUs, example 2 CPUs. Just configure, do
; not attach.
; The system is debugged as big.LITTLE system.
; CD.DO start_juno_a57a53.cmm 2. PREPAREONLY
; --------------------------------------------------------------------------------
LOCAL &cpuNumber &prepare &biglittle
ENTRY &cpuNumber &prepare
&biglittle=true()
; --------------------------------------------------------------------------------
; Parameters
; Possible values: 1. - 6. . 6. means 4x Cortex-A53 and 2x Cortex-A57
; 6. is default
IF "&cpuNumber"==""
(
&cpuNumber=6.
&biglittle=false()
)
; Possible values: ATTACH, PREPAREONLY
; ATTACH is default
IF "&prepare"==""
&prepare="ATTACH"
; Make sure that case of parameter is ignored
&prepare=STRing.UPpeR("&prepare")
; --------------------------------------------------------------------------------
; Configuration
SYStem.RESet
SYStem.CPU CORTEXA57A53
SYStem.CONFIG CORENUMBER 8.
IF (&cpuNumber<1.)||(&cpuNumber>6.)
(
DIALOG.OK "Invalid number of CPUs: &cpuNumber - End of script"
ENDDO
)
; Assignment: big_1 LITTLE_1 big_2 LITTLE_2 etc.
IF &cpuNumber==1.
CORE.ASSIGN BIGLITTLE 1. NONE NONE NONE NONE NONE NONE NONE
IF &cpuNumber==2.
CORE.ASSIGN BIGLITTLE 1. 2. NONE NONE NONE NONE NONE NONE
IF &cpuNumber==3.
CORE.ASSIGN BIGLITTLE 1. 2. 3. NONE NONE NONE NONE NONE
IF &cpuNumber==4.
CORE.ASSIGN BIGLITTLE 1. 2. 3. 4. NONE NONE NONE NONE
IF &cpuNumber==5.
CORE.ASSIGN BIGLITTLE 1. 2. 3. 4. NONE 6. NONE NONE
IF &cpuNumber==6.
(
if &biglittle
CORE.ASSIGN BIGLITTLE 1. 2. 3. 4. NONE 6. NONE 8.
else
CORE.ASSIGN 2. 4. 6. 8. 1. 3.
)
; --------------------------------------------------------------------------------
;
; Cortex-A57 | debug | CTI | PMU | trace
; --------------------------------------------------------------------------------
; core 0 | 0x22010000 | 0x22020000 | 0x22030000 | 0x22040000
; core 1 | 0x22110000 | 0x22120000 | 0x22130000 | 0x22140000
;
; Cortex-A57 ROM-Table: 0x22000000
;
;
; Cortex-A53 | debug | CTI | PMU | trace
; --------------------------------------------------------------------------------
; core 0 | 0x23010000 | 0x23020000 | 0x23030000 | 0x23040000
; core 1 | 0x23110000 | 0x23120000 | 0x23130000 | 0x23140000
; core 2 | 0x23210000 | 0x23220000 | 0x23230000 | 0x23240000
; core 3 | 0x23310000 | 0x23320000 | 0x23330000 | 0x23340000
;
; Cortex-A53 ROM-Table: 0x23000000
;
; --------------------------------------------------------------------------------
; Access port numbers are
SYStem.CONFIG APBACCESSPORT 1.
SYStem.CONFIG DEBUGACCESSPORT 1.
SYStem.CONFIG AXIACCESSPORT 0.
SYStem.CONFIG MEMORYACCESSPORT 0.
; Pre/Post settings
SYStem.CONFIG DAPIRPRE 4.
SYStem.CONFIG DAPDRPRE 1.
SYStem.CONFIG DAPIRPOST 0.
SYStem.CONFIG DAPDRPOST 0.
; Assignment: big_1 LITTLE_1 big_2 LITTLE_2 etc. Non-existing cores get a
; dummy value
SYStem.CONFIG COREDEBUG BASE DAP:0x22010000 DAP:0x23010000 DAP:0x22110000 DAP:0x23110000 DAP:0x00000000 DAP:0x23210000 DAP:0x00000000 DAP:0x23310000
SYStem.CONFIG CTI BASE DAP:0x22020000 DAP:0x23020000 DAP:0x22120000 DAP:0x23120000 DAP:0x00000000 DAP:0x23220000 DAP:0x00000000 DAP:0x23320000
SYStem.CONFIG BMC BASE DAP:0x22030000 DAP:0x23030000 DAP:0x22130000 DAP:0x23130000 DAP:0x00000000 DAP:0x23230000 DAP:0x00000000 DAP:0x23330000
SYStem.CONFIG ETM BASE DAP:0x22040000 DAP:0x23040000 DAP:0x22140000 DAP:0x23140000 DAP:0x00000000 DAP:0x23240000 DAP:0x00000000 DAP:0x23340000
; FUNNEL1: Funnel main
; FUNNEL2: Cortex-A57 funnel
; FUNNEL3: Cortex-A53 funnel
SYStem.CONFIG FUNNEL1 Base DAP:0x20040000
SYStem.CONFIG FUNNEL2 Base DAP:0x220C0000
SYStem.CONFIG FUNNEL3 Base DAP:0x230C0000
SYStem.CONFIG ETF Base DAP:0x20010000
SYStem.CONFIG TPIU Base DAP:0x20030000
SYStem.CONFIG ETR Base DAP:0x20070000
SYStem.CONFIG FUNNEL1 ATBSource FUNNEL2 0 FUNNEL3 1
SYStem.CONFIG FUNNEL2 ATBSource ETM.0 0 ETM.2 1
SYStem.CONFIG FUNNEL3 ATBSource ETM.1 0 ETM.3 1 ETM.5 2 ETM.7 3
SYStem.CONFIG ETF ATBSource FUNNEL1
SYStem.CONFIG TPIU ATBSource ETF
SYStem.CONFIG ETR ATBSource ETF
; Uncomment settings if needed
IF ANALYZER()
(
; A.CLOCK 2000.0mhz
; ETM.TimeStampCLOCK 50.mhz
ETM.PortType TPIU ; TRACE32 Preprocessor AutoFocus II
ETM.PORTMODE Continuous ; Embed trace IDs, multiple trace sources
; ETM.PORTMODE 6000Mbps
; ETM.FIFOLEVEL 0x40 ; Generate FIFOFULL if the FIFO has less
; than 0x40 bytes of space available
; ETM.PORTSIZE 16 ; Trace single connector
ETM.PORTSIZE 32 ; Trace dual connector
)
; Disable interrupts in debug mode.
; Set to off to debug interrupt routines
SYStem.Option IMASKASM ON
SYStem.Option IMASKHLL ON
SYStem.Option EnReset OFF ; Avoid that reset line is pulled low
; during Prepare mode
; --------------------------------------------------------------------------------
; Attach
IF "&prepare"=="ATTACH"
(
LOCAL &edscr &connected &edlar &wasrunning
&connected=TRUE()
&wasrunning=TRUE()
IF !STATE.POWER()
(
DIALOG.OK "Board is not powered. Press red button at the back of the Juno \
device or enter REBOOT command in serial terminal (UART0) and press OK"
PRINT "Waiting for SYStem.Power"
ON TIME 10.0s GOTO powerdown ; Wait max 10 sec for VTREF
WHILE !STATE.POWER()
(
WAIT 0.5s
)
ON TIME ; Disable time out again
)
PRINT "System power detected, waiting for debug registers"
ON ERROR GOSUB ConnectHandler ; On bus error return false
SYStem.Mode Prepare ; Prepare mode for debug access
CORE 0. ; Current core is core 0
; Poll EDLAR register until no further bus error occurs.
waitconnect:
&connected=TRUE() ; Assume: next read will succeed
&edlar=Data.Long(eapb:(corebase()+0xFB0)) ; Use EDLAR to check connection.
IF !&connected ; EDLAR should also be available
( ; even when a lock is active
WAIT 0.5s
GOTO waitconnect
)
; Finally attach to the target
SYStem.Mode Attach
IF RUN()
Break.direct
ELSE
&wasrunning=FALSE()
; Toggle ETM to make trace work
ETM.OFF
ETM.ON
IF &wasrunning
Go.direct
PRINT "Target is up and running"
)
ENDDO
; --------------------------------------------------------------------------------
; Support handlers
ConnectHandler:
&connected=FALSE()
RETURN
; --------------------------------------------------------------------------------
; Error handlers
powerdown:
DIALOG.OK "Board power did not come up. Please check the power supply and if \
the debug connector is correctly plugged"
ENDDO