Documente Academic
Documente Profesional
Documente Cultură
VM Debugging ...............................................................................................................................
Concept .................................................................................................................................
Prerequisites .........................................................................................................................
Linux
Windows
Linux
Windows
10
11
11
11
11
11
11
Test Loop
12
12
12
13
13
Backlog .................................................................................................................................
14
Timeline .................................................................................................................................
14
Intended Audience
This document is intended for Android System Developers who routinely do full Android system builds for
ARM platforms, who use TRACE32 for native Android debugging via JTAG, and now also want to debug
VM Applications using JTAG as data transport medium.
The TRACE32 JTAG bridge can also be used by Dalvik VM Application developers, once it is configured and
set up. But setup and configuration itself require expert knowledge about how to manage Android
repositories and how to build Android components.
Concept
The TRACE32 JTAG Bridge works by adding JTAG as an additional transport stream to the
Android Debug Bridge (adbd) and to the ADB host service (adb):
for the target, we extend adbd to use ARM/DCC for data transfer,
for the host, we extend adb to use named pipes to and from the TRACE32 FDX system.
Prerequisites
This document assumes
you already have a fully configured (up-and-running) TRACE32 Linux Awareness for your
Android installation
you have an Android repository and are able to build a full Android installation including SDK and
target root filesystem on Linux a development system
you can build the Android SDK for Windows (win_sdk) on your Linux development system
(only required if you have developers debugging on Windows host machines)
Intended Audience
apply the provided JTAG Bridge patch to the system/core git repository
(the set of files starting with 0001/0002/... makes one patch)
build adbd (for your target) and adb (for your SDK host setup)
copy the updated adbd into your target root filesystem as /sbin/adbd
copy the updated adb into the..../platform-tools directory of your Android SDK (ADT)
with <ARM architecture version> = { 9 | 10 | 11 }. A value of zero will disable JTAG connect attempts.
Example default.prop file for the ARM11 architecture of e.g., MEP-6410 (S3C6410):
#
# ADDITIONAL_DEFAULT_PROPERTIES
#
ro.secure=0
ro.allow.mock.location=1
ro.debuggable=1
persist.service.adb.enable=1
service.adb.jtag=11
#persist.adb.trace_mask=ffff
#
Note:
Note:
VSIZE
3456
WCHAN
PC
NAME
ffffffff 00013c24 S /sbin/adbd
RSS
200
WCHAN
PC
NAME
ffffffff 00013c24 S /sbin/adbd
Linux
For Linux, the default names for the named pipes used for communication with TRACE32 are:
/tmp/adb-t32
/tmp/t32-ad
The Linux adb will try to create the named pipe files if they dont already exist.
They may also be created in advance in a command shell with:
% mkfifo /tmp/adb-t32
% mkfifo /tmp/t32-adb
You can override the default pipe names by setting and exporting the environment variables TRACE32PI
and TRACE32PO before (re-)starting adb.
Windows
For Windows, the default names for the named pipes used for communication with TRACE32 are:
\\.\pipe\adb-t32
\\.\pipe\t32-adb
The Windows pipe mechanism is different from Linux. The adb host service executable (adb.exe) needs
to create the named pipes and then connects to them as a pipe server.
With the free tool PipeList from Microsoft Windows Sysinternals you can check if the named pipes exist.
As you can see in the patch file, you can also choose your own pipe names by setting the environment
variables TRACE32PI and TRACE32PO.
Configure TRACE32
Before starting a PRACTICE script to setup TRACE32 FDX via a named pipe connection, an adb host
service instance needs to be running (otherwise TRACE32 may terminate with a SIGPIPE), because
on Windows, a pipe server needs to create the named pipes and provide a connector for clients
So please make sure you have the updated adb host service executable running before you configure FDX!
Here is a PRACTICE sample script for Linux to setup FDX for DCC and named pipes (startfdx.cmm):
FDX.RESet
FDX.METHOD DCC4D
FDX.OutChannel
FDX.PipeWRITE /tmp/t32-adb 4
FDX.InChannel
FDX.PipeREAD /tmp/adb-t32 4
ENDDO
For Windows, you have to adapt the pipe names in startfdx.cmm to the Windows naming scheme:
FDX.RESet
FDX.METHOD DCC4D
FDX.OutChannel
FDX.PipeWRITE \\.\pipe\t32-adb 4
FDX.InChannel
FDX.PipeREAD \\.\pipe\adb-t32 4
ENDDO
Note:
Pipe connect order is important, adb first connects to the t32-adb pipe, then
to the adb-t32 pipe.
Configure Eclipse
When using the JTAG Bridge with some target/debugger combinations, the Eclipse JDWP timeout needs to
be increased. You will know you need to do it if the Thread Stack display is empty at a Java breakpoint and if
you cant single-step in the Eclipse Java Debug window.
Change the Eclipse setting in Window > Preferences > Java > Debug > Communication >
Debugger timeout (ms) from the default (3000) to 6000 or higher.
Configure TRACE32
Linux
1.
Start TRACE32 and then your PRACTICE script to download the Linux kernel into the target.
(For the inital 2011-04-08 version, you needed to create named pipes. From 2011-05-24, if you start
adb with sufficient rights, it will create the named pipes when it wants to open them.)
2.
[SMP TARGET ONLY] Run the script affinity-adb.cmm, to lock adbd to the first core.
3.
Start the patched version of the Android Debug Bridge host services with
user@ws:~$ adb kill-server
user@ws:~$ adb devices
4.
Once the adb host service is running, activate TRACE32 FDX via DCC and named pipes. For
this, in TRACE32 we start the script from section Configure TRACE32:
[B::] do startfdx.cmm
5.
List the Android devices known to adb to test the connection. Here is the output with the patched
adbd installed and running on the Android target, adbd connected via FDX and pipes to
TRACE32, and the target in run mode:
user@ws:~$ adb devices
List of devices attached
jtag-trace32-fdx-1
device
user@ws:~$
6.
Now start DDMS or debug your Dalvik VM Application via the TRACE32 JTAG Bridge in Eclipse.
Windows
1.
Start TRACE32 and then your PRACTICE script to download the Linux kernel into the target.
2.
[SMP TARGET ONLY] Run the script affinity-adb.cmm, to lock adbd to the first core.
3.
Start the patched version of the Android Debug Bridge host services with
E:\sdk\platform-tools> adb kill-server
E:\sdk\platform-tools> adb devices
4.
Once the adb host service is running, activate TRACE32 FDX via DCC and named pipes. For
this we start the script from section Configure TRACE32 in TRACE32:
[B::] do startfdx.cmm
5.
List the Android devices known to adb to test the connection. Here is the output with the patched
adbd installed and running on the Android target, adbd connected via FDX and pipes to
TRACE32, and the target in run mode:
E:\sdk\platform-tools> adb devices
List of devices attached
jtag-trace32-fdx-1
device
E:\sdk\platform-tools>
6.
Now you can e.g. start Eclipse and use DDMS or debug your Dalvik VM Application via the
TRACE32 JTAG Bridge.
10
Troubleshooting Tips
Eclipse Warning
If the target stops (e.g. on a native breakpoint) during application debugging with Eclipse, after a few
seconds you might get a dialog box with a warning.
Usually Eclipse recovers gracefully if the target is in run mode again when you dismiss this dialog box.
Please see the adb source files for the available mask bit values.
For Windows, you need to create an extra test program for this. Please consult the patch sources for ideas
how and what to do.
1989-2016 Lauterbach GmbH
11
Troubleshooting Tips
Test Loop
For communication testing (also for performance tests), you can replace the standard adb and adbd
communication loops with a simple test thread that just transfers data from/to the DCC registers. (E.g., a
test-adbd could echo test data generated by a test-adb.)
For Windows, you need to create an extra test program for this. Please consult the patch sources for ideas
how and what to do.
After adding the 0x0451 Vendor ID, an "adb kill-server", then "adb devices" should show the PandaBoard.
1989-2016 Lauterbach GmbH
12
Troubleshooting Tips
If you are debugging with TRACE32, please make sure the target is running. The target can not
control the USB connection in stop mode.
2.
Make sure you have deactivated JTAG Bridge Mode and then restarted adbd:
# setprop service.adb.jtag 0
# getprop service.adb.jtag
0
# ps adbd
USER
PID
PPID VSIZE RSS
root
11540 1
3456
208
WCHAN
PC
NAME
ffffffff 00013c24 S /sbin/adbd
# kill 11540
disabling adb
adb_release
enabling adb
adb_open
android_usb gadget: high speed config #1: android
# ps adbd
USER
PID
PPID
root
12620 1
#
VSIZE
3456
RSS
200
WCHAN
PC
NAME
ffffffff 00013c24 S /sbin/adbd
13
Troubleshooting Tips
Backlog
1.
Move JTAG Bridge hardware dependencies from Android into a Linux Kernel Device.
(Makes JTAG debuggig and profiling easier for many embedded platforms, if allowed into the
central Linux Kernel Repository. A kernel device could also multiplex the run-time JTAG
connection and support FDX Terminal and System Trace at the same time as adbd.)
2.
Profile JTAG bridge connection: current bandwidth is lower than USB or Ethernet. (One likely
reason is the requirement to use the same packet size as DCC for the pipe connection.)
3.
Fix pipe connect order dependency by using individual threads for each pipe connect.
4.
Timeline
2011-07-12
2011-06-10
2011-05-24
2011-04-08
14
Backlog