From bf52f486735d7905f10dbf3860e20f0632298cd7 Mon Sep 17 00:00:00 2001 From: Sergey Date: Mon, 22 Nov 2021 15:13:56 +0300 Subject: [PATCH] Ozone --- .gitignore | 3 - ozone.jdebug | 240 ++++++++++++++++++++++++++++++++++++++++++++++ ozone.jdebug.user | 29 ++++++ 3 files changed, 269 insertions(+), 3 deletions(-) create mode 100644 ozone.jdebug create mode 100644 ozone.jdebug.user diff --git a/.gitignore b/.gitignore index 7a436b1f26..827583ed94 100755 --- a/.gitignore +++ b/.gitignore @@ -172,6 +172,3 @@ __pycache__ eeprom.dat imgui.ini -#Ozone -ozone.jdebug -ozone.jdebug.user diff --git a/ozone.jdebug b/ozone.jdebug new file mode 100644 index 0000000000..03781e7378 --- /dev/null +++ b/ozone.jdebug @@ -0,0 +1,240 @@ + +/********************************************************************* +* +* OnProjectLoad +* +* Function description +* Project load routine. Required. +* +********************************************************************** +*/ +void OnProjectLoad (void) { + // + // Dialog-generated settings + // + Project.SetDevice ("STM32F103VE"); + Project.SetHostIF ("USB", ""); + Project.SetTargetIF ("SWD"); + Project.SetTIFSpeed ("4 MHz"); + Project.AddPathSubstitute ("/home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0", "$(ProjectDir)"); + Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M3.svd"); + Project.AddSvdFile ("$(ProjectDir)/STM32F103.svd"); + // + // User settings + // + + File.Open ("$(ProjectDir)/.pio/build/mks_robin_nano35/firmware.elf"); +} + +/********************************************************************* +* +* TargetReset +* +* Function description +* Replaces the default target device reset routine. Optional. +* +* Notes +* This example demonstrates the usage when +* debugging a RAM program on a Cortex-M target device +* +********************************************************************** +*/ +//void TargetReset (void) { +// +// unsigned int SP; +// unsigned int PC; +// unsigned int VectorTableAddr; +// +// Exec.Reset(); +// +// VectorTableAddr = Elf.GetBaseAddr(); +// +// if (VectorTableAddr != 0xFFFFFFFF) { +// +// Util.Log("Resetting Program."); +// +// SP = Target.ReadU32(VectorTableAddr); +// Target.SetReg("SP", SP); +// +// PC = Target.ReadU32(VectorTableAddr + 4); +// Target.SetReg("PC", PC); +// } +//} + +/********************************************************************* +* +* 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); + } +} + +/********************************************************************* +* +* 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) { +//} + +/********************************************************************* +* +* AfterTargetConnect +* +* Function description +* Event handler routine. Optional. +* +********************************************************************** +*/ +//void AfterTargetConnect (void) { +//} + +/********************************************************************* +* +* TargetDownload +* +* Function description +* Replaces the default program download routine. Optional. +* +********************************************************************** +*/ +//void TargetDownload (void) { +//} + +/********************************************************************* +* +* 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); + } +} + +/********************************************************************* +* +* 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) { +//} diff --git a/ozone.jdebug.user b/ozone.jdebug.user new file mode 100644 index 0000000000..c576510843 --- /dev/null +++ b/ozone.jdebug.user @@ -0,0 +1,29 @@ + +Breakpoint=/home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0/Marlin/src/HAL/STM32/Sd2Card_sdio_stm32duino.cpp:197, State=BP_STATE_ON +OpenDocument="xpt2046.cpp", FilePath="/home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0/Marlin/src/HAL/STM32/tft/xpt2046.cpp", Line=136 +OpenDocument="SdVolume.h", FilePath="/home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0/Marlin/src/sd/SdVolume.h", Line=88 +OpenDocument="cardreader.cpp", FilePath="/home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0/Marlin/src/sd/cardreader.cpp", Line=477 +OpenDocument="stl_algobase.h", FilePath="/home/sergey/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/9.2.1/bits/stl_algobase.h", Line=190 +OpenDocument="stm32f1xx_hal_spi.c", FilePath="/home/sergey/.platformio/packages/framework-arduinoststm32@4.10900.200819/system/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c", Line=416 +OpenDocument="planner.h", FilePath="/home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0/Marlin/src/module/planner.h", Line=873 +OpenDocument="Sd2Card_sdio_stm32duino.cpp", FilePath="/home/sergey/Projects/3D_Printer/FirmWare/Marlin/Marlin2.0/Marlin/src/HAL/STM32/Sd2Card_sdio_stm32duino.cpp", Line=216 +OpenDocument="main.cpp", FilePath="/home/sergey/.platformio/packages/framework-arduinoststm32@4.10900.200819/cores/arduino/main.cpp", Line=36 +OpenToolbar="Debug", Floating=0, x=0, y=0 +OpenWindow="Call Stack", DockArea=RIGHT, x=0, y=0, w=421, h=464, TabPos=1, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0 +OpenWindow="Registers 1", DockArea=RIGHT, x=0, y=0, w=421, h=464, TabPos=0, TopOfStack=1, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, FilteredItems=[], RefreshRate=1 +OpenWindow="Source Files", DockArea=LEFT, x=0, y=0, w=326, h=464, TabPos=0, TopOfStack=0, FilterBarShown=1, TotalValueBarShown=0, ToolBarShown=0 +OpenWindow="Disassembly", DockArea=LEFT, x=0, y=0, w=326, h=464, TabPos=2, TopOfStack=1, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0 +OpenWindow="Break & Tracepoints", DockArea=LEFT, x=0, y=0, w=326, h=464, TabPos=1, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VectorCatchIndexMask=254 +OpenWindow="Memory 1", DockArea=BOTTOM, x=1, y=0, w=448, h=279, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, EditorAddress=0x2000D940 +OpenWindow="Watched Data 1", DockArea=BOTTOM, x=2, y=0, w=529, h=279, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0 +OpenWindow="Terminal", DockArea=BOTTOM, x=0, y=0, w=549, h=279, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0 +OpenWindow="RTOS", DockArea=RIGHT, x=0, y=0, w=421, h=464, TabPos=2, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, Showing="" +TableHeader="Call Stack", SortCol="Function", SortOrder="ASCENDING", VisibleCols=["Function";"Stack Frame";"Source";"PC";"Return Address";"Stack Used"], ColWidths=[238;126;88;82;156;100] +TableHeader="Vector Catches", SortCol="None", SortOrder="ASCENDING", VisibleCols=["";"Vector Catch";"Description"], ColWidths=[50;300;500] +TableHeader="Break & Tracepoints", SortCol="None", SortOrder="ASCENDING", VisibleCols=["";"Type";"Location";"Extras"], ColWidths=[55;102;112;189] +TableHeader="Source Files", SortCol="File", SortOrder="DESCENDING", VisibleCols=["File";"Status";"Size";"#Insts";"Path"], ColWidths=[147;59;48;57;1113] +TableHeader="Power Sampling", SortCol="Index", SortOrder="ASCENDING", VisibleCols=["Index";"Time";"Ch 0"], ColWidths=[100;100;100] +TableHeader="Watched Data 1", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Value";"Location";"Refresh";"Access"], ColWidths=[100;100;100;229;100] +TableHeader="RegisterSelectionDialog", SortCol="None", SortOrder="ASCENDING", VisibleCols=[], ColWidths=[] +TableHeader="Registers 1", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Description"], ColWidths=[203;153;259] +TableHeader="TargetExceptionDialog", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Address";"Description"], ColWidths=[200;100;100;792] \ No newline at end of file