ozone.jdebug 9.3 KB

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