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 sur 17

Recommandé

Hardware hacking par
Hardware hackingHardware hacking
Hardware hackingTavish Naruka
3.2K vues30 diapositives
STM -32 par
STM -32STM -32
STM -32SeoTechnoscripts
9 vues26 diapositives
learning STM -32 par
learning STM -32 learning STM -32
learning STM -32 SeoTechnoscripts
5 vues26 diapositives
OpenCR tutorial_icra2017 par
OpenCR tutorial_icra2017 OpenCR tutorial_icra2017
OpenCR tutorial_icra2017 chcbaram
2.1K vues18 diapositives
Embedded Linux BSP Training (Intro) par
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)RuggedBoardGroup
778 vues29 diapositives
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo... par
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 vues38 diapositives

Contenu connexe

Similaire à OpenOCD-K3

Share the Experience of Using Embedded Development Board par
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 vues50 diapositives
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood par
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 vues25 diapositives
Userspace drivers-2016 par
Userspace drivers-2016Userspace drivers-2016
Userspace drivers-2016Chris Simmonds
1.9K vues20 diapositives
Linxu conj2016 96boards par
Linxu conj2016 96boardsLinxu conj2016 96boards
Linxu conj2016 96boardsLF Events
293 vues46 diapositives
Lab Handson: Power your Creations with Intel Edison! par
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 vues66 diapositives
Getting started with Intel IoT Developer Kit par
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitSulamita Garcia
17.8K vues67 diapositives

Similaire à OpenOCD-K3(20)

Share the Experience of Using Embedded Development Board par 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 vues
Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood par 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 vues
Linxu conj2016 96boards par LF Events
Linxu conj2016 96boardsLinxu conj2016 96boards
Linxu conj2016 96boards
LF Events293 vues
Lab Handson: Power your Creations with Intel Edison! par 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 vues
Getting started with Intel IoT Developer Kit par 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 vues
Stm32 f4 first touch par Benux Wei
Stm32 f4 first touchStm32 f4 first touch
Stm32 f4 first touch
Benux Wei3.6K vues
Cross-compilation native sous android par Thierry Gayet
Cross-compilation native sous androidCross-compilation native sous android
Cross-compilation native sous android
Thierry Gayet320 vues
IoT with openHAB on pcDuino3B par Jingfeng Liu
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3B
Jingfeng Liu3.7K vues
First Steps Developing Embedded Applications using Heterogeneous Multi-core P... par 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 vues
Deploy STM32 family on Zephyr - SFO17-102 par Linaro
Deploy STM32 family on Zephyr - SFO17-102Deploy STM32 family on Zephyr - SFO17-102
Deploy STM32 family on Zephyr - SFO17-102
Linaro2.2K vues
Linux Kernel , BSP, Boot Loader, ARM Engineer - Satish profile par 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 vues
pcDuino Presentation at SparkFun par Jingfeng Liu
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFun
Jingfeng Liu2.4K vues
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD par 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 vues
LAS16-403 - GDB Linux Kernel Awareness par Peter Griffin
LAS16-403 - GDB Linux Kernel Awareness LAS16-403 - GDB Linux Kernel Awareness
LAS16-403 - GDB Linux Kernel Awareness
Peter Griffin121 vues
LAS16-403: GDB Linux Kernel Awareness par Linaro
LAS16-403: GDB Linux Kernel AwarenessLAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel Awareness
Linaro1.4K vues
IoT Getting Started with Intel® IoT Devkit par 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 vues

Dernier

K8S Roadmap.pdf par
K8S Roadmap.pdfK8S Roadmap.pdf
K8S Roadmap.pdfMaryamTavakkoli2
6 vues1 diapositive
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L... par
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...Anowar Hossain
13 vues34 diapositives
DevOps-ITverse-2023-IIT-DU.pptx par
DevOps-ITverse-2023-IIT-DU.pptxDevOps-ITverse-2023-IIT-DU.pptx
DevOps-ITverse-2023-IIT-DU.pptxAnowar Hossain
9 vues45 diapositives
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,... par
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...AakashShakya12
72 vues115 diapositives
Design of machine elements-UNIT 3.pptx par
Design of machine elements-UNIT 3.pptxDesign of machine elements-UNIT 3.pptx
Design of machine elements-UNIT 3.pptxgopinathcreddy
32 vues31 diapositives
Object Oriented Programming with JAVA par
Object Oriented Programming with JAVAObject Oriented Programming with JAVA
Object Oriented Programming with JAVADemian Antony D'Mello
140 vues28 diapositives

Dernier(20)

DevOps to DevSecOps: Enhancing Software Security Throughout The Development L... par Anowar Hossain
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...
Anowar Hossain13 vues
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,... par AakashShakya12
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...
AakashShakya1272 vues
Design of machine elements-UNIT 3.pptx par gopinathcreddy
Design of machine elements-UNIT 3.pptxDesign of machine elements-UNIT 3.pptx
Design of machine elements-UNIT 3.pptx
gopinathcreddy32 vues
zincalume water storage tank design.pdf par 3D LABS
zincalume water storage tank design.pdfzincalume water storage tank design.pdf
zincalume water storage tank design.pdf
3D LABS5 vues
NEW SUPPLIERS SUPPLIES (copie).pdf par georgesradjou
NEW SUPPLIERS SUPPLIES (copie).pdfNEW SUPPLIERS SUPPLIES (copie).pdf
NEW SUPPLIERS SUPPLIES (copie).pdf
georgesradjou15 vues
Advances in micro milling: From tool fabrication to process outcomes par Shivendra Nandan
Advances in micro milling: From tool fabrication to process outcomesAdvances in micro milling: From tool fabrication to process outcomes
Advances in micro milling: From tool fabrication to process outcomes
Update 42 models(Diode/General ) in SPICE PARK(DEC2023) par Tsuyoshi Horigome
Update 42 models(Diode/General ) in SPICE PARK(DEC2023)Update 42 models(Diode/General ) in SPICE PARK(DEC2023)
Update 42 models(Diode/General ) in SPICE PARK(DEC2023)

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