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