SoC
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
  • Arm Cortex M3
  • Contact
Reading: Integrating Cortex-M1 with JTAG debugger
SUBSCRIBE
SoCSoC
Font ResizerAa
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Search
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Have an existing account? Sign In
Follow US
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
© S-O-C.ORG, All Rights Reserved.
Arm

Integrating Cortex-M1 with JTAG debugger

Mike Johnston
Last updated: September 20, 2023 7:33 am
Mike Johnston 6 Min Read
Share
SHARE

The Cortex-M1 processor from ARM can be debugged using a JTAG (Joint Test Action Group) debugger. JTAG provides a standard way to connect debugging tools to the processor and gain visibility into the running code. A JTAG debugger is an invaluable tool for firmware engineers working with Cortex-M1 as it allows stepping through code, setting breakpoints, and examining memory and registers.

Contents
Understanding JTAG InterfaceConnecting JTAG HardwareConfiguring JTAG SoftwareConnecting with Debugger SoftwareDebugging CapabilitiesDebugging CodeGoing Further with JTAGConclusion

Understanding JTAG Interface

The Cortex-M1 processor includes an embedded trace macrocell (ETM) which implements a JTAG interface. This provides a 4-pin TAP (Test Access Port) interface for connecting a JTAG debugger. The pins are:

  • TCK – Test Clock
  • TMS – Test Mode Select
  • TDI – Test Data In
  • TDO – Test Data Out

These pins provide the basic serial interface for communicating between the debugger and the processor. The ETM includes instruction trace buffers and export capabilities over this JTAG interface to enable advanced debugging.

Connecting JTAG Hardware

To connect a JTAG debugger to your Cortex-M1 hardware, you will need:

  • Cortex-M1 development board or target hardware
  • JTAG debugger device with 20-pin connector
  • 20-pin adapter or cable to connect debugger to target

The JTAG connector on the target hardware should bring out the 4 TAP pins plus power, ground, and reset signals. The adapter or cable connects between this target JTAG header and the debugger device. It maps the debugger connector pins to the corresponding pins on the target.

Common JTAG debuggers like Segger J-Link include a 20-pin connector. Adapters are available to convert this to various target connectors. For example, you may need a 20-pin to 10-pin adapter to interface with a Cortex-M1 development board.

Configuring JTAG Software

With the hardware connected, the JTAG debugger software also needs to be set up and configured. This involves:

  • Installing debugger software (e.g. J-Link) on your host computer
  • Connecting and identifying the JTAG debugger hardware
  • Selecting the Cortex-M1 target processor
  • Configuring target interface speed

The JTAG speed is an important setting, and should match the maximum TCK frequency supported by the target Cortex-M1 chip and hardware design. For the Cortex-M1 this is typically between 1 MHz and 10 MHz.

Connecting with Debugger Software

With hardware set up and software configured, the next step is connecting them together. The basic steps are:

  1. Power up JTAG debugger and connect to host computer
  2. Power up target Cortex-M1 board
  3. Connect from debugger software to debugger hardware
  4. The debugger should now detect and connect to the target processor

This process establishes the physical JTAG connections and enables communication between the debugger and processor.

Debugging Capabilities

Once connected, the JTAG debugger unlocks a number of powerful debugging capabilities including:

  • Registers – View and modify core and peripheral registers
  • Memory – Read and write data and variables in memory
  • Breakpoints – Pause execution at specific lines of code
  • Stepping – Step through code line-by-line
  • Watchpoints – Pause when memory addresses are accessed
  • Trace – Capture execution trace for offline analysis

This provides extensive visibility into program execution and makes debugging issues much easier compared to using printf-style debugging alone.

Debugging Code

With JTAG set up, you can start interacting with live code on the target Cortex-M1. Useful techniques include:

  • Stepping through initialization code to identify issues
  • Setting breakpoints in key functions and examining variables
  • Watching peripheral registers to see hardware interactions
  • Checking stack pointer to identify overflow issues
  • Tracing through interrupt handlers to analyze latency

JTAG debugging provides a powerful window into program execution that can quickly shed light on bugs. It’s an essential tool for firmware engineers working with Cortex-M1 or other ARM chips.

Going Further with JTAG

The core JTAG functionality provides enormous benefits for debugging Cortex-M1 code. Additional features can further augment its capabilities:

  • RTOS Awareness – Debuggers with OS awareness make multithreading bugs easier to spot.
  • Profiling – Performance profiling shows how much time is spent in each function.
  • Power Measurements – Built-in power data reveals power consumption issues.
  • Trace Buffer – On-chip trace buffers capture extensive execution traces.

Upgrading to an advanced JTAG debugger unlocks these additional capabilities for Cortex-M1 and provides even deeper insight into program behavior.

Conclusion

Connecting a JTAG debugger provides invaluable visibility and control when working with Cortex-M1 processors. Following the steps to set up hardware, configure software, and connect provides access to a wide range of debugging features unavailable otherwise. JTAG is a game-changer for firmware engineers developing with Cortex-M1 that enables finding and fixing bugs much faster.

Newsletter Form (#3)

More ARM insights right in your inbox

 


Share This Article
Facebook Twitter Email Copy Link Print
Previous Article Merging FPGA bitstream with Cortex-M1 application hex file
Next Article Optimizing 32×32 bit Multiplication on Cortex-M0/M0+/M1
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

2k Followers Like
3k Followers Follow
10.1k Followers Pin
- Sponsored-
Ad image

You Might Also Like

What is EEPROM Memory?

EEPROM (Electrically Erasable Programmable Read-Only Memory) is a type of…

11 Min Read

Link Register and Program Counter

The link register and program counter are key components of…

8 Min Read

gcc-arm cross compiler

A cross compiler is a compiler capable of creating executable…

7 Min Read

What are the exceptions in ARM architecture?

The ARM architecture defines a set of exceptions that can…

5 Min Read
SoCSoC
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
Welcome Back!

Sign in to your account