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