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