/********************************************************************* * * OnProjectLoad * * Function description * Project load routine. Required. * ********************************************************************** */ void OnProjectLoad (void) { Project.SetTraceSource ("None"); Project.SetTracePortWidth (2); Edit.SysVar (VAR_TRACE_CORE_CLOCK, 110000000); Project.SetDevice ("STM32L562QE"); Project.SetHostIF ("USB", ""); Project.SetTargetIF ("JTAG"); Project.SetTIFSpeed ("4 MHz"); Project.SetOSPlugin ("FreeRTOSPlugin_CM3.js"); Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M33F.svd"); Project.AddSvdFile ("C:/dev/BRC3-Application/config/CMSIS-SVD/STM32L5x2.svd"); File.Open ("C:/dev/BRC3-Application-Build/src/Core/BRC3-Application.elf"); } /********************************************************************* * * BeforeTargetReset * * Function description * Event handler routine. Optional. * ********************************************************************** */ //void BeforeTargetReset (void) { //} /********************************************************************* * * AfterTargetReset * * Function description * Event handler routine. * - Sets the PC register to program reset value. * - Sets the SP register to program reset value on Cortex-M. * ********************************************************************** */ void AfterTargetReset (void) { unsigned int SP; unsigned int PC; unsigned int VectorTableAddr; //VectorTableAddr = Elf.GetBaseAddr(); // //if (VectorTableAddr == 0xFFFFFFFF) { // Util.Log("Project file error: failed to get program base"); //} else { // SP = Target.ReadU32(VectorTableAddr); // Target.SetReg("SP", SP); // // PC = Target.ReadU32(VectorTableAddr + 4); // Target.SetReg("PC", PC); //} // Set PC and SP statically to STM32L562 Flash address. This works in any case (with or w/o Bootloader/Bootmanager) SP = Target.ReadU32(0x08000000); Target.SetReg("SP", SP); PC = Target.ReadU32(0x08000004); Target.SetReg("PC", PC); } /********************************************************************* * * DebugStart * * Function description * Replaces the default debug session startup routine. Optional. * ********************************************************************** */ //void DebugStart (void) { //} /********************************************************************* * * TargetConnect * * Function description * Replaces the default target IF connection routine. Optional. * ********************************************************************** */ //void TargetConnect (void) { //} /********************************************************************* * * BeforeTargetConnect * * Function description * Event handler routine. Optional. * ********************************************************************** */ void BeforeTargetConnect (void) { Project.SetJLinkScript("C:/dev/BRC3-Application/config/Ozone/trace_ini.JLinkScript"); } /********************************************************************* * * AfterTargetConnect * * Function description * Event handler routine. Optional. * ********************************************************************** */ //void AfterTargetConnect (void) { //} /********************************************************************* * * TargetDownload * * Function description * Replaces the default program download routine. Optional. * ********************************************************************** */ void TargetDownload (void) { Util.Log("Using test.bin for download"); Target.LoadMemory("C:/dev/BRC3-Application-Build/src/Core/test/test.bin", 0x90000000); } /********************************************************************* * * BeforeTargetDownload * * Function description * Event handler routine. Optional. * ********************************************************************** */ //void BeforeTargetDownload (void) { //} /********************************************************************* * * AfterTargetDownload * * Function description * Event handler routine. * - Sets the PC register to program reset value. * - Sets the SP register to program reset value on Cortex-M. * ********************************************************************** */ void AfterTargetDownload (void) { unsigned int SP; unsigned int PC; unsigned int VectorTableAddr; //VectorTableAddr = Elf.GetBaseAddr(); // //if (VectorTableAddr == 0xFFFFFFFF) { // Util.Log("Project file error: failed to get program base"); //} else { // SP = Target.ReadU32(VectorTableAddr); // Target.SetReg("SP", SP); // // PC = Target.ReadU32(VectorTableAddr + 4); // Target.SetReg("PC", PC); //} // Set PC and SP statically to STM32L562 Flash address. This works in any case (with or w/o Bootloader/Bootmanager) SP = Target.ReadU32(0x08000000); Target.SetReg("SP", SP); PC = Target.ReadU32(0x08000004); Target.SetReg("PC", PC); } /********************************************************************* * * BeforeTargetDisconnect * * Function description * Event handler routine. Optional. * ********************************************************************** */ //void BeforeTargetDisconnect (void) { //} /********************************************************************* * * AfterTargetDisconnect * * Function description * Event handler routine. Optional. * ********************************************************************** */ //void AfterTargetDisconnect (void) { //} /********************************************************************* * * AfterTargetHalt * * Function description * Event handler routine. Optional. * ********************************************************************** */ //void AfterTargetHalt (void) { //}