본문 바로가기
Trace32

ARM core debug module

by 暻煥 2024. 2. 5.

ARM Core에서 "Debugging을 위한 Core-Sight"에 대하여 개념적인 설명


ARM core는 JTAG뿐만 아니라, Trace라는 Debugging 기능을 제공한다.

Trace를 사용하면 processor가 동작 중인 상태에서도 register나 memory에 접근하여 데이터를 읽을 수 있다.

이러한 Trace 기술은 Soc에서 Core-Sight Architecture라는 이름으로 설계된다.

아래 그림은 Single Core에서 Core-Sight Design이다.

Single Core에서 Core-Sight Design

CoreSight는 기존의 방식과 달리 모든 디버그 로직들이 Memory-mapped 방식으로 각기 고유한 주소를 가진다.

또한, SoC에서 보다 다양하고 자세한 디버깅 정보를 얻기 위해 기존의 JTAG, ETM에 더해 ITM, HTM과 같은 다양한 로직을 사용한다.


DAP : Debugging Access Port

대부분의 일반적인 SoC에서 구현되어 있는 물리적인 Port이다. 해당 Port를 통하여 Debug Tools를 연결하고, Memory Mapped Peripherals에 접근할 수 있다.

또한, system memory에 바로 접근이 가능하므로 빠른 속도의 SW download도 가능하다.

Core-Sight ARM에서는 on-chip JTAG 기능으로도 사용이 가능하다.

아래 그림은 DAP에서 사용되는 debug memory mapped space에 대한 component 들이다.

Debug port를 통하여 processor는 외부 debug tool과 연결되고, 현재 상태 정보를 제공할 수 있다.

또한, power/reset request를 수신할 수도 있다.

debug tool로부터 수신된 request는 AP(Access Port)를 통하여 APB, AHB, AXI와 같은 Bus system에 접근하다.

Debugging을 위해서는 debug toold에게 DAP Address Space를 명시해주어야 한다.

대략적으로는 아래의 정보들이 외부 debug tool 이 필요한 정보이다.

 

DP Identifier
동시에 여러 DAP가 존재할 수 있기 때문에 ID 필요
AP Select
register에 접근할 때, 사용할 Bus 및 Address Space를 지정해 주어야 하기 때문에 AP 선택 필요
TAR Select
접근하고자 하는 target address 선택
Data Access
address가 모두 명시되어 있다면, on-chip read/write 동작을 선택한다
Read Data retrieval
on-chip access 후, debugger는 DAP에 다시 한번 접근하여 data를 읽어들인다.

Sef Hosted Debug

Multi processor 상황에서, Debugging SW를 preocessor 中 하나에서 동작시키는 방법을 말한다.

해당 방식을 이용하면 reset 과 같은 초기 booting에 대해서도 debugging이 가능하다.


ROM Table

Core-Sight 시스템은 ROM Table을 가지고 있다. 그렇기 때문에 debugger가 ROM에 접근할 수 있으며, 시스템에 존재하는 모든 component 들에 대해서 debugging이 가능하다.

해당 table은 일반적으로 ROM의 가장 낮은 주소에 위치하고 4K의 크기를 가진다.

즉, debugging을 위한 top-level ROM table이 AP의 identification registers에 저장되어 있고, 각각의 구성요소 들의 offset이 ROM table에 저장되어 있다.


ECT : Embedded Cross Triggering

debug tools에서 발생하는 signal를 각각의 module에 전달하는 routing 기능을 제공한다.

어떠한 signal을 어떠한 module에 전달해야 하는지는 CTM(Cross Trigger Matrix)에 프로그램 되어 있다.

일반적인 경우의 CTM은 아래와 같다.

From
to
Example
Trace logic External Outputs (4 bits)
CTI Trigger inputs
Trace logic resources to trigger trace capture or debug
Trace logic External Outputs (4 bits)
PMU inputs
PMU counters to extend trace logic counters
PMU Events (~30 bits)
Trace logic External inputs
Filter trace based on processor events such as cache miss
PMU overflow
CTI Trigger input
Forward PMU counter overflow to interrupt controller or other clusters
Processor Debug Restart
CTI Trigger input
Synchronized debug restart across clusters (supporting halt and restart)
Trace Buffer Full
CTI Trigger input
Halt processor on trace buffer full
CTI Trigger Output
Processor interrupt input
Cause interrupt based on input to CTI or other CTI in system
CTI Trigger Output
Processor Debug Halt Request
Enter debug state based on input to CTI or other CTI in system
CTI Trigger Output
Trace Port Trigger request
Indicate trace trigger to trace capture device

※ PMU : Performance Monitoring Unit


STM : System Trace Macrocell

system의 각종 변화와 상태가 기록되는 main trace source이다. STM을 통하여 system 내의 각종 component 들에 연결되며, FIFO 구조로 data를 저장한다.


ETB : Embedded Trace Buffer

TPIU : Trace Port Interface Unit

ETB는 Trace data에 대한 임시 저장 기능을 제공한다. ATB를 통하여 접근이 가능하고, 32bit read/write 기능을 제공한다.

TPIU는 TPA(Trace Port Analyzer)와 sync를 맞추고 data를 전달하는 역할을 한다. 여기서 TPA는 debugger tool을 말한다.

ETF(Embedded Trace FIFO)처럼 동작하지만, data가 peak bandwidth 상태가 되면 data lost를 방지하기 위하여 Trace data를 RAM에 저장한다.


Funnel

여러 종류의 source를 가지는 trace data들을 하나의 bus에 전송하는 역할을 한다.

Funnel과 TPIU는 디버깅에 활용할 수 있는 직접적인 정보를 생성하는 것은 아니다.

CoreSight가 적용되지 않은 멀티코어의 경우, 각 코어에서 ETM을 통해 생성되는 트레이스 데이터를 받으려면 각 ETM에 연결되는 트레이스 포트를 따로 뽑아주어야 한다. 하지만 Coresight는 ETM, ITM, HTM 등 여러 트레이스 소스에서 생성된 트레이스 데이터들이 ATB를 통해 Funnel로 전달되고 하나의 트레이스 스트림으로 합성된다.

하나의 트레이스 포트로도 여러 트레이스 소스의 데이터를 받을 수 있게 되는 것이다.


ETM : Embedded Trace Module

Core에 대한 모든 정보가 출력되는 Interface이다.

Funnel 혹은 TPIU에 해당 data들은 전송되어 Bus에 실리게 된다.


ETR : Embedded Trace Router

Trace Data를 AXI Bus를 통해서 DRAM에 저장한다. 즉, DRAM을 on-chip trace memory처럼 사용 가능하도록 한다.


AHB : Advanced High Performance Bus

AHB-AP는 DAP의 두 MEM-AP 중 하나로 설계 시 보통 포트번호로 0번을 할당하며, SoC 내 고속 시스템 버스인 AHB 버스와 연결되어 있다.

이로 인해 기존 debug Logic의 경우 debugger가 memory에 접근하기 위해서는 반드시 processor와 debug interface가 형성된 상황에서 debug logic을 통해 processor가 바라보고 있는 memory만을 바라볼 수 있었지만, CoreSight가 채용된 SoC의 경우 debugger는 AHB-AP를 거쳐 AHB 버스를 통해 바로 memory 접근이 가능하다.

AHB-AP는 System Bus를 이용해 memory에 접근하기 때문에 MMU나 cache를 거치지 않은 순수한 Physical memory 값을 볼 수 있다.


APB : Advanced Peripheral Bus

일반적으로 port번호는 1번을 할당한다. 일반적인 debug interface 및 debugging을 위한 동작은 APB-AP를 거치게 되며 debugger가 memory를 바라보는 시점은 processor와 동일하기 때문에 특별한 memory class 지정 없이 T32에서 Data.List나 Data.dump 창 등을 열어보면 MMU 및 cache 데이터가 반영된 값을 보게 된다.

APB-AP를 통해 CoreSight의 각 로직에 접근하는 경우 주소가 할당되어 있다는 것이다.

Exynos 시리즈의 경우 0x800xxxxx에 CoreSight 각 로직들의 base address가 할당되어 있는데, 이는 APB-AP를 통하는 경우의 address 이며, 실제 CPU가 인식하는 AHB-AP address로는 0x108xxxxx가 할당되어 있다.


참고 및 출처 :

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/how-to-debug-coresight-basics-part-1

 

How to debug: CoreSight basics (Part 1)

Debug can be a pain. At the best of times it's a nuisance and in the worst case scenario a complex web of wires that need to be configured properly to diagnose and solve SoC design problems.

community.arm.com

https://www.arm.com/

 

Building the Future of Computing

Together with its vast ecosystem, Arm technology is changing the world again, building the future of computing & bringing ideas to life.

www.arm.com

http://www2.lauterbach.com/

 

https://www2.lauterbach.com/

Welcome to LAUTERBACH DEVELOPMENT TOOLS This domain is the backbone für faster download of large files Do not access files directly. Access in controlled dynamically by our download scripts to download latest files and updates. Redirecting now to http://w

www2.lauterbach.com

http://www.epnc.co.kr/news/articleView.html?idxno=45631 

 

디버깅을 위한 CoreSight의 이해 ① - 테크월드뉴스

MDS테크놀로지에서 산업용 표준 디버깅 솔루션 ‘TRACE32’ 기술지원을 맡고 있다. 교육과 세미나를 통해 TRA CE32의 다양한 실전 사례와 활용방법을 임베디드 개발자들과 공유하고 있다....

www.epnc.co.kr

 

 

'Trace32' 카테고리의 다른 글

[T32] Debugger Module 자동 Reset  (0) 2024.02.05