• No results found

VM Application Debugging via JTAG: Android TRACE32 JTAG Debug Bridge ADB Architecture Stop-Mode implications for ADB JTAG Transport Outlook

N/A
N/A
Protected

Academic year: 2021

Share "VM Application Debugging via JTAG: Android TRACE32 JTAG Debug Bridge ADB Architecture Stop-Mode implications for ADB JTAG Transport Outlook"

Copied!
30
0
0

Loading.... (view fulltext now)

Full text

(1)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 1

VM Application Debugging via JTAG:

Android TRACE32 JTAG Debug Bridge

ADB Architecture

Stop-Mode implications for ADB

JTAG Transport

(2)

Android Target

Android Target

Host

Host

adb

adb

daemon

daemon

adb

adb

server

server

application debugging

Eclipse

TCP/IP

TCP/IP

DVM

DVM

USB

USB

USB

USB

TCP/IP

TCP/IP

adb

physical connection

(3)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 3

Android Debug Bridge

Application Debugging (Run-Mode)

Android

Android

Target

Target

Virtual Machine Process

VM Core Libraries

VM Core Libraries

Code + Objects

Code + Objects

Dalvik VM

Dalvik VM

VM Application

VM Application

Code + Objects

Code + Objects

Memory

Model

VM

Interpreter

VM

Control

adb

adb

daemon

daemon

TCP/IP

TCP/IP

or USB

or USB

stack

stack

VM Debug

Support

Host

Host

Eclipse IDE

ADT

adb

adb

server

server

TCP/IP

TCP/IP

or USB

or USB

stack

stack

(4)

Architecture

system/core/adb/OVERVIEW.TXT

[...] As a whole, everything works through the following components:

1.

The ADB server [...] runs on the host [and] is really one giant

multiplexing loop whose purpose is to orchestrate the exchange

of data (packets, really) between clients, services and devices.

2.

The ADB daemon (adbd) [runs on a] device or emulated system [and

connects] to the ADB server (through USB for devices, through TCP for

emulators) and provide[s] a few services for clients that run on the host.

3.

The ADB command-line client [...] is used to run adb commands from a

shell or a script. It first tries to locate the ADB server on the host

machine, and will start one automatically if none is found.

(5)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 5

Android Debug Bridge

Architecture

system/core/adb/protocol.txt

--- a replacement for aproto

---When it comes down to it, aproto's primary purpose is to forward various

streams between the host computer and client device (in either direction).

This replacement further simplifies [this concept].

The host side becomes a simple comms bridge with no "UI", which will be

used by either commandline or interactive tools to communicate with a

device or emulator that is connected to the bridge.

The protocol is designed to be straightforward and well-defined [...].

The protocol discards the layering aproto has and should allow the

implementation to be much more robust. [...]

(6)

Communication Architecture

adb server

adb server

adb_main

adb_main

transport

transport

usb

usb

socket

socket

adb daemon

adb daemon

adb_main

adb_main

transport

transport

usb

usb

socket

socket

Different transport methods

active at the same time:

► usb_init()

► local_init()

Select transport at startup:

IF

property(service.adb.tcp.port)

► listen at tcp:

port

IF

access(/dev/android_adb)

(7)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 7

Android Debug Bridge

Case A: Using Sockets

adb server

adb server

adb_main

adb_main

transport

transport

usb

usb

socket

socket

adb daemon

adb daemon

adb_main

adb_main

transport

transport

usb

usb

socket

socket

(8)

Case B: Using USB

adb server

adb server

adb_main

adb_main

transport

transport

usb

usb

socket

socket

adb daemon

adb daemon

adb_main

adb_main

transport

transport

usb

usb

socket

socket

(9)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 9

VM Application Debugging via JTAG:

Android TRACE32 JTAG Debug Bridge

ADB Architecture

Stop-Mode implications for ADB

JTAG Transport

(10)

Application Debugging via TCP/IP

Android

Android

Target

Target

Virtual Machine Process

VM Core Libraries

VM Core Libraries

Code + Objects

Code + Objects

Dalvik VM

Dalvik VM

VM Application

VM Application

Code + Objects

Code + Objects

Memory

Model

VM

Interpreter

VM

Control

adb

adb

daemon

daemon

TCP/IP

TCP/IP

VM Debug

Support

Host

Host

Eclipse IDE

ADT

adb

adb

server

server

TCP/IP

TCP/IP

(11)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 11

Android Debug Bridge

App Debug via TCP/IP (Run-Mode) + JTAG Debug (Stop-Mode)

Android Target

Android Target

TCP/IP

TCP/IP

Host

Host

TCP/IP

TCP/IP

adbd

adbd

adb

adb

server

server

JTAG

JTAG

USB/ETH

USB/ETH

PowerDebug

Eclipse

TRACE32

stop-mode debugging

(12)

Stop-Mode Implications for TCP/IP

IP was designed for robustness

Host does not detect device presence

Communication can be resumed

Eclipse can time out

(13)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 13

Android Debug Bridge

Application Debugging via USB

Android

Android

Target

Target

Virtual Machine Process

VM Core Libraries

VM Core Libraries

Code + Objects

Code + Objects

Dalvik VM

Dalvik VM

VM Application

VM Application

Code + Objects

Code + Objects

Memory

Model

VM

Interpreter

VM

Control

adb

adb

daemon

daemon

USB

USB

VM Debug

Support

Host

Host

Eclipse IDE

ADT

adb

adb

server

server

USB

USB

(14)

App Debug via USB (Run-Mode) + JTAG Debug (Stop-Mode)

Android Target

Android Target

Host

Host

adb

adb

JTAG

JTAG

USB/ETH

USB/ETH

PowerDebug

Eclipse

TRACE32

stop-mode debugging

(15)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 15

Android Debug Bridge

JTAG 'Stop' ►►► loss of USB communication

Android

Android

Target

Target

Virtual Machine Process

VM Core Libraries

VM Core Libraries

Code + Objects

Code + Objects

Dalvik VM

Dalvik VM

VM Application

VM Application

Code + Objects

Code + Objects

Memory

Model

VM

Interpreter

VM

Control

adb

adb

daemon

daemon

USB

USB

VM Debug

Support

Host

Host

Eclipse IDE

ADT

adb

adb

server

server

USB

USB

USB comm loss

on JTAG 'break'

(16)

Stop-Mode Implications for USB

Host periodically polls USB devices

Host detects device presence

ADB 'kicks' disconnected devices

Host reconnect possible only with USB plug-in event

No on-the-fly device reconnect mechanism provided

Multiple reconnects per second can be dangerous

(17)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 17

VM Application Debugging via JTAG:

Android TRACE32 JTAG Debug Bridge

ADB Architecture

Stop-Mode implications for ADB

JTAG Transport

(18)

Introduce Case C: Using JTAG

adb server

adb server

adb_main

adb_main

transport

transport

usb

usb

socket

socket

???

???

adb daemon

adb daemon

adb_main

adb_main

transport

transport

usb

usb

socket

socket

???

???

JTAG

(19)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 19

Android Debug Bridge

“TRACE32 JTAG Bridge” Ideas:

ARM9|10|11 has “Debug Communication Channel” - a DCC

register (pair) that debugger can r/w via JTAG

TRACE32 “Fast Data eXchange” (FDX) can use DCC

TRACE32 FDX client can send/receive data

via “TRACE32 RemoteAPI” or via “named pipes”

Try to keep changes limited to system/core/adb

Must be possible on Linux + Windows hosts

Must work on SMP systems

(20)

Communication Architecture

adb server

adb server

adb_main

adb_main

transport

transport

usb

usb

socket

socket

pipe

pipe

adb daemon

adb daemon

adb_main

adb_main

transport

transport

usb

usb

socket

socket

DCC

DCC

On the host:

TRACE32 FDX using

JTAG (named pipe) transport

On the target:

TRACE32 FDX using

(21)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 21

Android Debug Bridge

Introduce Case C: Using JTAG

adb server

adb server

adb_main

adb_main

transport

transport

usb

usb

socket

socket

pipe

pipe

adb daemon

adb daemon

adb_main

adb_main

transport

transport

usb

usb

socket

socket

DCC

DCC

JTAG

(22)

Communication Architecture – New Version

adb server

adb server

adb_main

adb_main

transport

transport

usb

usb

socket

socket

pipe

pipe

adb daemon

adb daemon

adb_main

adb_main

transport

transport

usb

usb

socket

socket

DCC

DCC

Different transport methods

active at the same time:

► jtag_init()

► usb_init()

► local_init()

IF

property(service.adb.jtag) > 0

► listen at DCC register ■

IF

property(service.adb.tcp.port)

► listen at tcp:

port

IF

access(/dev/android_adb)

(23)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 23

Android Debug Bridge

Assisted Run-Mode Debugging via JTAG bridge

Android

Android

Target

Target

Virtual Machine Process

VM Core Libraries

VM Core Libraries

Code + Objects

Code + Objects

Dalvik VM

Dalvik VM

VM Application

VM Application

Code + Objects

Code + Objects

Memory

Model

VM

Interpreter

VM

Control

adb

adb

daemon

daemon

TRACE32

TRACE32

JTAG

JTAG

bridge

bridge

VM Debug

Support

Host

Host

Eclipse IDE

ADT

adb

adb

server

server

TRACE32

TRACE32

JTAG

JTAG

bridge

bridge

(24)

Application Debugging via TRACE32 JTAG Bridge

Android Target

Android Target

Host

Host

FDX

FDX

TRACE32

T

C

P

/IP

T

C

P

/IP

adb

adb

daemon

daemon

adb

adb

server

server

application debugging

Eclipse

DVM

DVM

ARM

ARM

DCC

DCC

U

S

B

U

S

B

adb

P

IP

E

P

IP

E

application debugging

run-mode debugging

stop-mode debugging

(25)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 25

Android Debug Bridge

TRACE32 JTAG Bridge – Initial Implementation

git patch for adb server (host) and adbd (target)

adds JTAG “transport” to adb (Run-Mode), tested on FroYo

TRACE32 FDX in ARM9|10|11 DCC4D mode for adbd data

TRACE32 FDX in “Named Pipe” mode for adb server data

tested on Linux + Windows hosts and on SMP target

on/off switch for adbd JTAG bridge mode (setprop, adbd restart)

not very fast, but only alternative if ETH or USB are not available

working reference code + open source: customers and 3

rd 

parties

(26)

TRACE32 JTAG Bridge Patch – Timeline

2011-04-08 – initial Linux version (tested on MEP6410)

2011-05-24 – reworked pipe system to support Windows

2011-06-10 – SMP support (tested on PandaBoard)

(27)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 27

VM Application Debugging via JTAG:

Android TRACE32 JTAG Debug Bridge

ADB Architecture

Stop-Mode implications for ADB

JTAG Transport

(28)

TRACE32 JTAG Bridge – What Can Be Done?

introduce Linux Kernel “JTAG Communication Device”

encapsulate target-specific communciation code,

different platforms expose the same JTAG interface

could provide multiple JTAG communication channels

for Terminal, System Trace, ADB and Customer Use

test on more target platforms

make adbd transport channel easily runtime-switchable

git-push code changes to Android and Linux Kernel repos

to improve JTAG debugging + transport awareness

(29)

TRACE32 JTAG Debug Bridge Hagen Patzke 2011-06-16 www.lauterbach.com 29

Android Debug Bridge

TRACE32 JTAG Bridge – Who Can Do It?

introduce Linux Kernel “JTAG Communication Device”

encapsulate target-specific communciation code,

different platforms expose the same JTAG interface

could provide multiple JTAG communication channels

for Terminal, System Trace, ADB and Customer Use

test on more target platforms

make adbd transport channel easily runtime-switchable

git-push code changes to Android and Linux Kernel repos

to improve JTAG debugging + transport awareness

profile TRACE32 FDX pipe connection, maybe add TCP/IP mode

►►► everyone can do this (Customer, 3

rd 

Party, You!)

(30)

References

Related documents

To summarize our results, for the focused questions, we found that being in a group yielded higher correct responses than working on the answers individually, and using the

Cut-and-cover construction of the extension of the 63rd Street Tunnel, Queens, New York: Tiebacks (steel bars or cables) are angled into the completed slurry walls and anchored

9 Review requests for and provide waiver on SLCM compliance Yes - Business Requirements - Security Plan - Design artifacts - Plan artifacts - Technical Design artifacts

The IT Research and Innovation Program consists of a program leadership function, responsible for overall planning, management, and cross-cutting issues, and four

The following members voted yea, to-wit: Bieritz, Bird, Boyd, Brenneman, Butler, Fourez, Golden, Green, Haton, Mackiewicz, Mockbee, Morse, Nesbitt, O’Kane, Becky Stark, Bruce

When fuel prices spiked in the summer of 2007, the reduction in resale value for low-mileage vehicles was immediate.. In the United States, this industry structure was even

consumers in the evaluation, critique and ongoing improvement of the Collaborative Recovery Model received in case management settings across three eastern Australian states.

Based on these relationships, we hypothesize that temperature is a leading control over the isotopic values of water in the Fredericksburg region, and that groundwater has