OpenOCD-K3

OpenOCD primer – K3 Devices
Date: 2023-09-22
Nishanth Menon
1
Overview
 What is OpenOCD
 Features of OpenOCD
 OpenOCD overview
 OpenOCD Hardware setup: xds110, cTI20, tag-connect
 Building OpenOCD
 OpenOCD integration with IDEs
 Debugging U-Boot
 Debugging Linux Kernel
 Self Hosted Debug
2
What is OpenOCD
OpenOCD (Open On-Chip Debugger) is an open-source software project that
provides debugging and in-circuit programming support for various
microcontrollers and microprocessors. It allows developers to interact with and
control the hardware of embedded systems during both development and
production phases. OpenOCD supports a wide range of target architectures and
interfaces with various hardware debugging probes.
3
Features of OpenOCD
 Debugging: OpenOCD enables developers to perform source-level debugging, inspect memory, set
breakpoints, and single-step through code on embedded systems.
 Hardware Debug Probes: OpenOCD interfaces with hardware debug probes like JTAG (Joint Test
Action Group) and SWD (Serial Wire Debug) adapters to connect to the target hardware.
 GDB Integration: OpenOCD can be used as a target for the GNU Debugger (GDB), allowing
developers to use familiar debugging tools with their embedded systems.
 Scripting: OpenOCD can be scripted to automate various debugging and programming tasks, making it
useful for both manual and automated testing.
 Flash Programming: OpenOCD supports programming the flash memory of microcontrollers and
microprocessors, allowing developers to load and update firmware.
 Support for Various Targets: OpenOCD provides support for a wide range of target architectures,
including ARM, MIPS, RISC-V, and others, making it versatile for different embedded systems.
 Cross-Platform: OpenOCD is cross-platform and can be used on various operating systems, including
Windows, Linux, and macOS.
4
OpenOCD overview
5
K3 Generation — Das U-Boot unknown version documentation
OpenOCD hardware setup – XDS110
K3 Generation — Das U-Boot unknown version documentation
Connect a micro-USB cable to the board to
the mentioned port.
OpenOCD hardware setup – cTI20
K3 Generation — Das U-Boot unknown version documentation
•TUMPA or equivalent dongles supported by OpenOCD.
•Cable such as Tag-connect ribbon cable
•Adapter to convert cTI20 to ARM20 such as those from Segger or Lauterbach LA-3780 Or optionally, if you have
manufacturing capability then you could try BeagleBone JTAG Adapter
OpenOCD hardware setup – tagConnect
K3 Generation — Das U-Boot unknown version documentation
•TUMPA or equivalent dongles supported by OpenOCD.
•Tag-Connect cable appropriate to the board such as TC2050-IDC-NL
•In case of no-leg, version, a retaining clip
•Tag-Connect to ARM20 adapter
Building OpenOCD
9
# Check the packages to be installed: needs deb-src in sources.list
sudo apt build-dep openocd
# The following list is NOT complete - please check the latest
sudo apt-get install libtool pkg-config texinfo libusb-dev 
libusb-1.0.0-dev libftdi-dev libhidapi-dev autoconf automake
git clone https://github.com/openocd-org/openocd.git openocd
cd openocd
git submodule init
git submodule update
./bootstrap
./configure --prefix=/usr/local/
make -j`nproc`
sudo make install
K3 Generation — Das U-Boot unknown version documentation
OpenOCD IDE integration with GDB
gdb-dashboard
GEF (GDB Enhanced Features)
K3 Generation — Das U-Boot unknown version documentation
Debugger Setup with GDB + OpenOCD
in Visual Studio Code (justinmklam.com)
AND MANY MANY MANY MORE!
Debug U-boot
11
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index 69e281b086..744929e825 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -37,6 +37,8 @@
#endif
reset:
+dead_loop:
+ b dead_loop
/* Allow the board to save important registers */
b save_boot_params
save_boot_params_ret:
K3 Generation — Das U-Boot unknown version documentation
void board_init_f(ulong dummy)
{
.
.
/* Code to run on the R5F (Wakeup/Boot Domain) */
if (IS_ENABLED(CONFIG_CPU_V7R)) {
volatile int x = 1;
while(x) {};
}
...
/* Code to run on the ARMV8 (Main Domain) */
if (IS_ENABLED(CONFIG_ARM64)) {
volatile int x = 1;
while(x) {};
}
.
.
}
Option 1: reset Option 2: board_init_f
Demo – Debug U-Boot
12
K3 Generation — Das U-Boot unknown version documentation
xds110
Console
AM625-SK
Demo – Debug U-Boot – VsCode integration
13
https://gist.github.com/nmenon/c2984e28f1af73292c0bd472c7522460
Debug Kernel
14
Pending Patches (on track to merge in next few
weeks)
https://review.openocd.org/c/openocd/+/7896
https://review.openocd.org/c/openocd/+/7897
https://review.openocd.org/c/openocd/+/7898
• Step 1: Disable kernel options:
• CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU=n
• CONFIG_CORESIGHT=n
• Step 2: kernel command line options: Add:
• rodata=off cpuidle.off=1 nokaslr
• nosmp – to disable multi-cpu debug
openocd -c 'set V8_SMP_DEBUG 1' -c "set RTOS(am625.cpu.a53.0) hwthread" -f board/ti_am625evm.cfg
Demo – Debug Kernel
15
OpenOCD Self hosted debug
 Debug M4F or R5F from A53 itself.
# Check the packages to be installed: needs deb-src in sources.list
sudo apt build-dep openocd
# The following list is NOT complete - please check the latest
sudo apt-get install libtool pkg-config texinfo libusb-dev 
libusb-1.0.0-dev libftdi-dev libhidapi-dev autoconf automake
git clone https://github.com/openocd-org/openocd.git openocd
cd openocd
git submodule init
git submodule update
./bootstrap
./configure --prefix=/usr/local/ --enable-dmem
make -j`nproc`
sudo make install
sudo openocd -c "set RTOS(am625.cpu.gp_mcu) Zephyr" -f board/ti_am625_swd_native.cfg
References
 https://medium.com/@aliaksandr.kavalchuk/diving-into-jtag-protocol-part-1-
overview-fbdc428d3a16
 https://medium.com/@aliaksandr.kavalchuk/diving-into-jtag-protocol-part-2-
debugging-56a566db3cf8
 https://u-boot.readthedocs.io/en/latest/board/ti/k3.html#common-debugging-
environment-openocd
 https://review.openocd.org/
1 de 17

Recomendados

Hardware hacking por
Hardware hackingHardware hacking
Hardware hackingTavish Naruka
3.2K vistas30 diapositivas
STM -32 por
STM -32STM -32
STM -32SeoTechnoscripts
10 vistas26 diapositivas
learning STM -32 por
learning STM -32 learning STM -32
learning STM -32 SeoTechnoscripts
5 vistas26 diapositivas
OpenCR tutorial_icra2017 por
OpenCR tutorial_icra2017 OpenCR tutorial_icra2017
OpenCR tutorial_icra2017 chcbaram
2.1K vistas18 diapositivas
Embedded Linux BSP Training (Intro) por
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)RuggedBoardGroup
782 vistas29 diapositivas
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo... por
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...ryancox
7.6K vistas38 diapositivas

Más contenido relacionado

Similar a OpenOCD-K3

Share the Experience of Using Embedded Development Board por
Share the Experience of Using Embedded Development BoardShare the Experience of Using Embedded Development Board
Share the Experience of Using Embedded Development BoardJian-Hong Pan
271 vistas50 diapositivas
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood por
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hoodEmbedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hoodEmbeddedFest
421 vistas25 diapositivas
Userspace drivers-2016 por
Userspace drivers-2016Userspace drivers-2016
Userspace drivers-2016Chris Simmonds
1.9K vistas20 diapositivas
Linxu conj2016 96boards por
Linxu conj2016 96boardsLinxu conj2016 96boards
Linxu conj2016 96boardsLF Events
293 vistas46 diapositivas
Lab Handson: Power your Creations with Intel Edison! por
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Codemotion
2K vistas66 diapositivas
Getting started with Intel IoT Developer Kit por
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitSulamita Garcia
17.8K vistas67 diapositivas

Similar a OpenOCD-K3(20)

Share the Experience of Using Embedded Development Board por Jian-Hong Pan
Share the Experience of Using Embedded Development BoardShare the Experience of Using Embedded Development Board
Share the Experience of Using Embedded Development Board
Jian-Hong Pan271 vistas
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood por EmbeddedFest
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hoodEmbedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood
EmbeddedFest421 vistas
Linxu conj2016 96boards por LF Events
Linxu conj2016 96boardsLinxu conj2016 96boards
Linxu conj2016 96boards
LF Events293 vistas
Lab Handson: Power your Creations with Intel Edison! por Codemotion
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
Codemotion2K vistas
Getting started with Intel IoT Developer Kit por Sulamita Garcia
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
Sulamita Garcia17.8K vistas
Stm32 f4 first touch por Benux Wei
Stm32 f4 first touchStm32 f4 first touch
Stm32 f4 first touch
Benux Wei3.6K vistas
Cross-compilation native sous android por Thierry Gayet
Cross-compilation native sous androidCross-compilation native sous android
Cross-compilation native sous android
Thierry Gayet320 vistas
IoT with openHAB on pcDuino3B por Jingfeng Liu
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3B
Jingfeng Liu3.7K vistas
First Steps Developing Embedded Applications using Heterogeneous Multi-core P... por Toradex
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...First Steps Developing Embedded Applications using Heterogeneous Multi-core P...
First Steps Developing Embedded Applications using Heterogeneous Multi-core P...
Toradex 692 vistas
Deploy STM32 family on Zephyr - SFO17-102 por Linaro
Deploy STM32 family on Zephyr - SFO17-102Deploy STM32 family on Zephyr - SFO17-102
Deploy STM32 family on Zephyr - SFO17-102
Linaro2.2K vistas
Linux Kernel , BSP, Boot Loader, ARM Engineer - Satish profile por Satish Kumar
Linux Kernel , BSP, Boot Loader, ARM Engineer - Satish profileLinux Kernel , BSP, Boot Loader, ARM Engineer - Satish profile
Linux Kernel , BSP, Boot Loader, ARM Engineer - Satish profile
Satish Kumar238 vistas
pcDuino Presentation at SparkFun por Jingfeng Liu
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFun
Jingfeng Liu2.4K vistas
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD por Linaro
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
Linaro1.2K vistas
LAS16-403 - GDB Linux Kernel Awareness por Peter Griffin
LAS16-403 - GDB Linux Kernel Awareness LAS16-403 - GDB Linux Kernel Awareness
LAS16-403 - GDB Linux Kernel Awareness
Peter Griffin121 vistas
LAS16-403: GDB Linux Kernel Awareness por Linaro
LAS16-403: GDB Linux Kernel AwarenessLAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel Awareness
Linaro1.4K vistas
IoT Getting Started with Intel® IoT Devkit por Vasily Ryzhonkov
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT Devkit
Vasily Ryzhonkov5.4K vistas

Último

dummy.pptx por
dummy.pptxdummy.pptx
dummy.pptxJamesLamp
5 vistas2 diapositivas
Design_Discover_Develop_Campaign.pptx por
Design_Discover_Develop_Campaign.pptxDesign_Discover_Develop_Campaign.pptx
Design_Discover_Develop_Campaign.pptxShivanshSeth6
49 vistas20 diapositivas
Renewal Projects in Seismic Construction por
Renewal Projects in Seismic ConstructionRenewal Projects in Seismic Construction
Renewal Projects in Seismic ConstructionEngineering & Seismic Construction
5 vistas8 diapositivas
Integrating Sustainable Development Goals (SDGs) in School Education por
Integrating Sustainable Development Goals (SDGs) in School EducationIntegrating Sustainable Development Goals (SDGs) in School Education
Integrating Sustainable Development Goals (SDGs) in School EducationSheetalTank1
9 vistas29 diapositivas
Robotics in construction enterprise por
Robotics in construction enterpriseRobotics in construction enterprise
Robotics in construction enterpriseKhalid Abdel Naser Abdel Rahim
5 vistas1 diapositiva
AWS A5.18 A5.18M-2021.pdf por
AWS A5.18 A5.18M-2021.pdfAWS A5.18 A5.18M-2021.pdf
AWS A5.18 A5.18M-2021.pdfThinhNguyen455948
7 vistas48 diapositivas

Último(20)

Design_Discover_Develop_Campaign.pptx por ShivanshSeth6
Design_Discover_Develop_Campaign.pptxDesign_Discover_Develop_Campaign.pptx
Design_Discover_Develop_Campaign.pptx
ShivanshSeth649 vistas
Integrating Sustainable Development Goals (SDGs) in School Education por SheetalTank1
Integrating Sustainable Development Goals (SDGs) in School EducationIntegrating Sustainable Development Goals (SDGs) in School Education
Integrating Sustainable Development Goals (SDGs) in School Education
SheetalTank19 vistas
MongoDB.pdf por ArthyR3
MongoDB.pdfMongoDB.pdf
MongoDB.pdf
ArthyR349 vistas
Unlocking Research Visibility.pdf por KhatirNaima
Unlocking Research Visibility.pdfUnlocking Research Visibility.pdf
Unlocking Research Visibility.pdf
KhatirNaima10 vistas
GDSC Mikroskil Members Onboarding 2023.pdf por gdscmikroskil
GDSC Mikroskil Members Onboarding 2023.pdfGDSC Mikroskil Members Onboarding 2023.pdf
GDSC Mikroskil Members Onboarding 2023.pdf
gdscmikroskil63 vistas
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx por lwang78
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx
2023Dec ASU Wang NETR Group Research Focus and Facility Overview.pptx
lwang78180 vistas
BCIC - Manufacturing Conclave - Technology-Driven Manufacturing for Growth por Innomantra
BCIC - Manufacturing Conclave -  Technology-Driven Manufacturing for GrowthBCIC - Manufacturing Conclave -  Technology-Driven Manufacturing for Growth
BCIC - Manufacturing Conclave - Technology-Driven Manufacturing for Growth
Innomantra 15 vistas
Web Dev Session 1.pptx por VedVekhande
Web Dev Session 1.pptxWeb Dev Session 1.pptx
Web Dev Session 1.pptx
VedVekhande17 vistas
Proposal Presentation.pptx por keytonallamon
Proposal Presentation.pptxProposal Presentation.pptx
Proposal Presentation.pptx
keytonallamon67 vistas
Design of Structures and Foundations for Vibrating Machines, Arya-ONeill-Pinc... por csegroupvn
Design of Structures and Foundations for Vibrating Machines, Arya-ONeill-Pinc...Design of Structures and Foundations for Vibrating Machines, Arya-ONeill-Pinc...
Design of Structures and Foundations for Vibrating Machines, Arya-ONeill-Pinc...
csegroupvn8 vistas

OpenOCD-K3

  • 1. OpenOCD primer – K3 Devices Date: 2023-09-22 Nishanth Menon 1
  • 2. Overview  What is OpenOCD  Features of OpenOCD  OpenOCD overview  OpenOCD Hardware setup: xds110, cTI20, tag-connect  Building OpenOCD  OpenOCD integration with IDEs  Debugging U-Boot  Debugging Linux Kernel  Self Hosted Debug 2
  • 3. What is OpenOCD OpenOCD (Open On-Chip Debugger) is an open-source software project that provides debugging and in-circuit programming support for various microcontrollers and microprocessors. It allows developers to interact with and control the hardware of embedded systems during both development and production phases. OpenOCD supports a wide range of target architectures and interfaces with various hardware debugging probes. 3
  • 4. Features of OpenOCD  Debugging: OpenOCD enables developers to perform source-level debugging, inspect memory, set breakpoints, and single-step through code on embedded systems.  Hardware Debug Probes: OpenOCD interfaces with hardware debug probes like JTAG (Joint Test Action Group) and SWD (Serial Wire Debug) adapters to connect to the target hardware.  GDB Integration: OpenOCD can be used as a target for the GNU Debugger (GDB), allowing developers to use familiar debugging tools with their embedded systems.  Scripting: OpenOCD can be scripted to automate various debugging and programming tasks, making it useful for both manual and automated testing.  Flash Programming: OpenOCD supports programming the flash memory of microcontrollers and microprocessors, allowing developers to load and update firmware.  Support for Various Targets: OpenOCD provides support for a wide range of target architectures, including ARM, MIPS, RISC-V, and others, making it versatile for different embedded systems.  Cross-Platform: OpenOCD is cross-platform and can be used on various operating systems, including Windows, Linux, and macOS. 4
  • 5. OpenOCD overview 5 K3 Generation — Das U-Boot unknown version documentation
  • 6. OpenOCD hardware setup – XDS110 K3 Generation — Das U-Boot unknown version documentation Connect a micro-USB cable to the board to the mentioned port.
  • 7. OpenOCD hardware setup – cTI20 K3 Generation — Das U-Boot unknown version documentation •TUMPA or equivalent dongles supported by OpenOCD. •Cable such as Tag-connect ribbon cable •Adapter to convert cTI20 to ARM20 such as those from Segger or Lauterbach LA-3780 Or optionally, if you have manufacturing capability then you could try BeagleBone JTAG Adapter
  • 8. OpenOCD hardware setup – tagConnect K3 Generation — Das U-Boot unknown version documentation •TUMPA or equivalent dongles supported by OpenOCD. •Tag-Connect cable appropriate to the board such as TC2050-IDC-NL •In case of no-leg, version, a retaining clip •Tag-Connect to ARM20 adapter
  • 9. Building OpenOCD 9 # Check the packages to be installed: needs deb-src in sources.list sudo apt build-dep openocd # The following list is NOT complete - please check the latest sudo apt-get install libtool pkg-config texinfo libusb-dev libusb-1.0.0-dev libftdi-dev libhidapi-dev autoconf automake git clone https://github.com/openocd-org/openocd.git openocd cd openocd git submodule init git submodule update ./bootstrap ./configure --prefix=/usr/local/ make -j`nproc` sudo make install K3 Generation — Das U-Boot unknown version documentation
  • 10. OpenOCD IDE integration with GDB gdb-dashboard GEF (GDB Enhanced Features) K3 Generation — Das U-Boot unknown version documentation Debugger Setup with GDB + OpenOCD in Visual Studio Code (justinmklam.com) AND MANY MANY MANY MORE!
  • 11. Debug U-boot 11 diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index 69e281b086..744929e825 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -37,6 +37,8 @@ #endif reset: +dead_loop: + b dead_loop /* Allow the board to save important registers */ b save_boot_params save_boot_params_ret: K3 Generation — Das U-Boot unknown version documentation void board_init_f(ulong dummy) { . . /* Code to run on the R5F (Wakeup/Boot Domain) */ if (IS_ENABLED(CONFIG_CPU_V7R)) { volatile int x = 1; while(x) {}; } ... /* Code to run on the ARMV8 (Main Domain) */ if (IS_ENABLED(CONFIG_ARM64)) { volatile int x = 1; while(x) {}; } . . } Option 1: reset Option 2: board_init_f
  • 12. Demo – Debug U-Boot 12 K3 Generation — Das U-Boot unknown version documentation xds110 Console AM625-SK
  • 13. Demo – Debug U-Boot – VsCode integration 13 https://gist.github.com/nmenon/c2984e28f1af73292c0bd472c7522460
  • 14. Debug Kernel 14 Pending Patches (on track to merge in next few weeks) https://review.openocd.org/c/openocd/+/7896 https://review.openocd.org/c/openocd/+/7897 https://review.openocd.org/c/openocd/+/7898 • Step 1: Disable kernel options: • CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU=n • CONFIG_CORESIGHT=n • Step 2: kernel command line options: Add: • rodata=off cpuidle.off=1 nokaslr • nosmp – to disable multi-cpu debug openocd -c 'set V8_SMP_DEBUG 1' -c "set RTOS(am625.cpu.a53.0) hwthread" -f board/ti_am625evm.cfg
  • 15. Demo – Debug Kernel 15
  • 16. OpenOCD Self hosted debug  Debug M4F or R5F from A53 itself. # Check the packages to be installed: needs deb-src in sources.list sudo apt build-dep openocd # The following list is NOT complete - please check the latest sudo apt-get install libtool pkg-config texinfo libusb-dev libusb-1.0.0-dev libftdi-dev libhidapi-dev autoconf automake git clone https://github.com/openocd-org/openocd.git openocd cd openocd git submodule init git submodule update ./bootstrap ./configure --prefix=/usr/local/ --enable-dmem make -j`nproc` sudo make install sudo openocd -c "set RTOS(am625.cpu.gp_mcu) Zephyr" -f board/ti_am625_swd_native.cfg