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