xref: /btstack/port/renesas-ek-ra6m4a-da14531/ozone.jdebug.in (revision ce6f85e79d1d141c1b45dfa16b2671762457cbb4)
1/*********************************************************************
2*                 (c) SEGGER Microcontroller GmbH                    *
3*                      The Embedded Experts                          *
4*                         www.segger.com                             *
5**********************************************************************
6
7File          : /Users/mringwal/Projects/Renesas/RA6/renesas-ek-ra6m4a-da14531/ozone.jdebug
8Created       : 10 Aug 2022 23:12
9Ozone Version : V3.26c
10*/
11
12/*********************************************************************
13*
14*       OnProjectLoad
15*
16* Function description
17*   Project load routine. Required.
18*
19**********************************************************************
20*/
21void OnProjectLoad (void) {
22  //
23  // Dialog-generated settings
24  //
25  Project.SetDevice ("R7FA6M4AF");
26  Project.SetHostIF ("USB", "");
27  Project.SetTargetIF ("SWD");
28  Project.SetTIFSpeed ("4 MHz");
29  Project.AddPathSubstitute ("@CMAKE_SOURCE_DIR@", "$(ProjectDir)");
30  Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M33F.svd");
31  //
32  // User settings
33  //
34  Edit.SysVar (VAR_RTT_ENABLED, 1);
35  File.Open ("@CMAKE_CURRENT_BINARY_DIR@/@[email protected]");
36}
37
38/*********************************************************************
39*
40*       OnStartupComplete
41*
42* Function description
43*   Called when program execution has reached/passed
44*   the startup completion point. Optional.
45*
46**********************************************************************
47*/
48//void OnStartupComplete (void) {
49//}
50
51/*********************************************************************
52*
53*      TargetReset
54*
55* Function description
56*   Replaces the default target device reset routine. Optional.
57*
58* Notes
59*   This example demonstrates the usage when
60*   debugging an application in RAM on a Cortex-M target device.
61*
62**********************************************************************
63*/
64//void TargetReset (void) {
65//
66//  unsigned int SP;
67//  unsigned int PC;
68//  unsigned int VectorTableAddr;
69//
70//  VectorTableAddr = Elf.GetBaseAddr();
71//  //
72//  // Set up initial stack pointer
73//  //
74//  if (VectorTableAddr != 0xFFFFFFFF) {
75//    SP = Target.ReadU32(VectorTableAddr);
76//    Target.SetReg("SP", SP);
77//  }
78//  //
79//  // Set up entry point PC
80//  //
81//  PC = Elf.GetEntryPointPC();
82//
83//  if (PC != 0xFFFFFFFF) {
84//    Target.SetReg("PC", PC);
85//  } else if (VectorTableAddr != 0xFFFFFFFF) {
86//    PC = Target.ReadU32(VectorTableAddr + 4);
87//    Target.SetReg("PC", PC);
88//  } else {
89//    Util.Error("Project file error: failed to set entry point PC", 1);
90//  }
91//}
92
93/*********************************************************************
94*
95*       BeforeTargetReset
96*
97* Function description
98*   Event handler routine. Optional.
99*
100**********************************************************************
101*/
102//void BeforeTargetReset (void) {
103//}
104
105/*********************************************************************
106*
107*       AfterTargetReset
108*
109* Function description
110*   Event handler routine. Optional.
111*   The default implementation initializes SP and PC to reset values.
112**
113**********************************************************************
114*/
115void AfterTargetReset (void) {
116  _SetupTarget();
117}
118
119/*********************************************************************
120*
121*       DebugStart
122*
123* Function description
124*   Replaces the default debug session startup routine. Optional.
125*
126**********************************************************************
127*/
128//void DebugStart (void) {
129//}
130
131/*********************************************************************
132*
133*       TargetConnect
134*
135* Function description
136*   Replaces the default target IF connection routine. Optional.
137*
138**********************************************************************
139*/
140//void TargetConnect (void) {
141//}
142
143/*********************************************************************
144*
145*       BeforeTargetConnect
146*
147* Function description
148*   Event handler routine. Optional.
149*
150**********************************************************************
151*/
152//void BeforeTargetConnect (void) {
153//}
154
155/*********************************************************************
156*
157*       AfterTargetConnect
158*
159* Function description
160*   Event handler routine. Optional.
161*
162**********************************************************************
163*/
164//void AfterTargetConnect (void) {
165//}
166
167/*********************************************************************
168*
169*       TargetDownload
170*
171* Function description
172*   Replaces the default program download routine. Optional.
173*
174**********************************************************************
175*/
176//void TargetDownload (void) {
177//}
178
179/*********************************************************************
180*
181*       BeforeTargetDownload
182*
183* Function description
184*   Event handler routine. Optional.
185*
186**********************************************************************
187*/
188//void BeforeTargetDownload (void) {
189//}
190
191/*********************************************************************
192*
193*      AfterTargetDownload
194*
195* Function description
196*   Event handler routine. Optional.
197*   The default implementation initializes SP and PC to reset values.
198*
199**********************************************************************
200*/
201void AfterTargetDownload (void) {
202  _SetupTarget();
203}
204
205/*********************************************************************
206*
207*       BeforeTargetDisconnect
208*
209* Function description
210*   Event handler routine. Optional.
211*
212**********************************************************************
213*/
214//void BeforeTargetDisconnect (void) {
215//}
216
217/*********************************************************************
218*
219*       AfterTargetDisconnect
220*
221* Function description
222*   Event handler routine. Optional.
223*
224**********************************************************************
225*/
226//void AfterTargetDisconnect (void) {
227//}
228
229/*********************************************************************
230*
231*       AfterTargetHalt
232*
233* Function description
234*   Event handler routine. Optional.
235*
236**********************************************************************
237*/
238//void AfterTargetHalt (void) {
239//}
240
241/*********************************************************************
242*
243*       BeforeTargetResume
244*
245* Function description
246*   Event handler routine. Optional.
247*
248**********************************************************************
249*/
250//void BeforeTargetResume (void) {
251//}
252
253/*********************************************************************
254*
255*       OnSnapshotLoad
256*
257* Function description
258*   Called upon loading a snapshot. Optional.
259*
260* Additional information
261*   This function is used to restore the target state in cases
262*   where values cannot simply be written to the target.
263*   Typical use: GPIO clock needs to be enabled, before
264*   GPIO is configured.
265*
266**********************************************************************
267*/
268//void OnSnapshotLoad (void) {
269//}
270
271/*********************************************************************
272*
273*       OnSnapshotSave
274*
275* Function description
276*   Called upon saving a snapshot. Optional.
277*
278* Additional information
279*   This function is usually used to save values of the target
280*   state which can either not be trivially read,
281*   or need to be restored in a specific way or order.
282*   Typically use: Memory Mapped Registers,
283*   such as PLL and GPIO configuration.
284*
285**********************************************************************
286*/
287//void OnSnapshotSave (void) {
288//}
289
290/*********************************************************************
291*
292*       OnError
293*
294* Function description
295*   Called when an error ocurred. Optional.
296*
297**********************************************************************
298*/
299//void OnError (void) {
300//}
301
302/*********************************************************************
303*
304*       AfterProjectLoad
305*
306* Function description
307*   After Project load routine. Optional.
308*
309**********************************************************************
310*/
311//void AfterProjectLoad (void) {
312//}
313
314/*********************************************************************
315*
316*       _SetupTarget
317*
318* Function description
319*   Setup the target.
320*   Called by AfterTargetReset() and AfterTargetDownload().
321*
322*   Auto-generated function. May be overridden by Ozone.
323*
324**********************************************************************
325*/
326void _SetupTarget(void) {
327  unsigned int SP;
328  unsigned int PC;
329  unsigned int VectorTableAddr;
330
331  VectorTableAddr = Elf.GetBaseAddr();
332  //
333  // Set up initial stack pointer
334  //
335  SP = Target.ReadU32(VectorTableAddr);
336  if (SP != 0xFFFFFFFF) {
337    Target.SetReg("SP", SP);
338  }
339  //
340  // Set up entry point PC
341  //
342  PC = Elf.GetEntryPointPC();
343  if (PC != 0xFFFFFFFF) {
344    Target.SetReg("PC", PC);
345  } else {
346    Util.Error("Project script error: failed to set up entry point PC", 1);
347  }
348}