Professional Documents
Culture Documents
Embedded Target Communications With TCF: Martin Oberhuber Michael Scharf Wind River
Embedded Target Communications With TCF: Martin Oberhuber Michael Scharf Wind River
with TCF
Martin Oberhuber
Michael Scharf
Wind River
Tutorial Themes
• Practical
• Interactive
• Workspace Take-away
2 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
The Stick
• All-in-one Eclipse ZIP
• QEMU/mini.zip
• Workspace.zip
• Compilers
– OPTIONAL - For the adventurous
– We provide pre-built executables
– If you want to build yourself, install the compiler EXE’s
• Tools
– Ingredients of the all-in-one. Install if you want your own
Eclipse.
• Tcf_source
– patches
3 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Agenda
• TCF Overview
• Building and running TCF native
– Workspace Setup
– Command-line tools
– Protocol Basics
• Building and running embedded
– Source structure, Removing a Service
– Proxy Setup
• Adding a Service or Value-add
– The C side (client and server)
– The Java side (client)
4 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
System Debug: the Big Picture
Eclipse
SoC (Model)
3rd party TCF
SW TCF
CPU
CPU
Debugger Target Target
Description Server(s) TCF HW
IP-XACT, IP
3rd party XML
SW
TCF
DSP
TCF
DSP
Debugger
5 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
This slide
except © SPRINT
logos and Infineon
and trademarks made2007, 2008.
available All rights
under reserved.
the EPL v1.0
Today: Separate Communications per tool
P2
Value Add Value Add
Host P1 B C
P3
6 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Bad for the User
? ? ?
Tool A Tool B Tool C Tool D
UI
P2
Value Add Value Add
Host P1 B C
P3
7 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Bad Design!
8 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Limited eco system
9 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Design Goals of TCF
10 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF vs. ECF
• TCF – Target Communication (Protocol) Framework
– Protocol, independent of API
– API in multiple languages (C, Java, Perl, …)
– One extendable Protocol (though supports multiple transports)
– Typically point-to-point only
11 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF - Core Design Ideas
12 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF: Common agent and protocol
Host Service 4
Value Add
Service 5
TCF Agent
Target Service 1 Service 2 Service 3
13 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Peer is a Communication endpoint
Host Service 4
Value Add
Service 5
TCF Agent
Target Service 1 Service 2 Service 3
14 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Service
Host Service 4
Value Add
Service 5
TCF Agent
Target Service 1 Service 2 Service 3
15 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Message Channel
TCF Channel
Host Service 4
Value Add
Service 5
TCF Channel
TCF Agent
Target Service 1 Service 2 Service 3
16 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Channels and Messages
17 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF Communication Protocol
• Message
– A packet of data
– Transmitted over communication channel
• Proxying/Tunneling
– Message forwarding
– “Decorator” can intercept communication
– “Value-add” services (e.g. debug info)
– No protocol conversion needed
18 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
The TCF Message Types
• Command (send)
– Request some action on remote peer
• Progress
– Long running commands may send “progress ticks”
• Result (reply)
– Remote peer sends one result for each command!
• Event
– Notify a change
• Flow control
– prevent congestion
19 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Command
• Command is a message
• Sent to remote peer
• Remote peer must send one Result for each Command!
20 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Result
• Result is a message
– Data, Errors
• Sent as a response to a command
• Remote peer sends one Result per Command!
21 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Commands are Asynchronous
22 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Event
• Event is a message
• Notification about state changes
23 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Message order guaranteed on channel
Command X=1
Result X=1
Event X=2
Command X=3
Event X=4
Result X=3
Event X=5
24 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Flow Control
• Prevent congestion
25 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF: Layered View
Host Service 4
Value Add
Service 5
TCF Agent
Target Service 1 Service 2 Service 3
26 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Communication Layers
Services
Messages
Channel
27 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Transport Layer: Byte Stream
Services
Messages
Channel
?????????????????????????????????????????????
Transport Layer (e.g. TCP/IP)
28 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Channel: Message Stream
Services
Messages
Channel ??????????????????????????????????????????
??????????????????????????????????????????????
Transport Layer (e.g. TCP/IP)
29 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Messages: Command Result Event Flow
Services
Channel ??????????????????????????????????????????
??????????????????????????????????????????????
Transport Layer (e.g. TCP/IP)
30 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Message Type
Message Type
Services
Channel ??????????????????????????????????????????
??????????????????????????????????????????????
Transport Layer (e.g. TCP/IP)
31 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Token
Token: Channel Unique
To identify Result
Services
Channel ??????????????????????????????????????????
??????????????????????????????????????????????
Transport Layer (e.g. TCP/IP)
32 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Service Id
Service id
Services
Channel ??????????????????????????????????????????
??????????????????????????????????????????????
Transport Layer (e.g. TCP/IP)
33 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Command Name
Command name
Services
Channel ??????????????????????????????????????????
??????????????????????????????????????????????
Transport Layer (e.g. TCP/IP)
34 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Arguments (byte array)
Arguments (byte array)
Services
Channel ??????????????????????????????????????????
??????????????????????????????????????????????
Transport Layer (e.g. TCP/IP)
35 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Argument Representation: e.g. JSON
Marshalling: JSON
Channel ??????????????????????????????????????????
??????????????????????????????????????????????
Transport Layer (e.g. TCP/IP)
36 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
The 5 TCF Messages
Command
C • <token> • <service> • <command> • <arguments>
Progress
P • <token> • <progress_data>
Result
R • <token> • <result_data>
Event
E • <service> • <event> • <event_data>
Flow
F • <traffic_congestion_level> •
37 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF and the OSI Layers
4 Transport Layer
3 Network Layer
1 Physical Layer
38 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF as Layer 3 and 4
4 Transport Layer
3 Network Layer
1 Physical Layer
39 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Prototype implementation
40 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Getting Real: Development Tools
• Eclipse-TCF-Preinstalled.zip
– Eclipse SDK 3.5m6
– CDT 6.0m6
– RSE 3.1m6
– Optional: Subclipse with GEF or Subversive
– Target Emulator
• QEMU-arm-tcf.zip with mini Linux + ssh
41 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Workspace Setup and Build
42 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF Sample Session
– cd org.eclipse.tm.tcf.agent/Cygwin/i686/Debug
– ./agent -L-
• Open Command prompt 2 for client: Agent is auto-detected
– ./client -L-
Shortcut: connect TCP::
– help
– peers
– connect tcp:127.0.0.1:1534 JSON messages
Using an ID
– tcf FileSystem roots
– tcf FileSystem opendir "/root"
– tcf FileSystem readdir "FS0"
– tcf <serviceName> <command> <JSONargs>
43 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Auto Discovery
• Simplifies setup
– Client UI can easily find peers and discover services
44 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
How Discovery works
45 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Cross-compiling for QEMU ARM
46 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Agent Structure
47 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Agent Structure (2)
48 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Advanced: connecting into QEMU
49 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Connecting QEMU from outside
• This is in puppy_redir.bat:
– start puppy.exe -redir tcp:1534::1534
• 1534 is the TCF default port for discovery. QEMU
forwards it from the client to the host in both directions
• From Eclipse, launch RSE+TCF
– Run > Debug Configurations > Eclipse App
– Open RSE Perspective
– New Connection : TCF
– Files Subsystem Properties : Port : 7000
– Expand Processes / All Processes
Shows QEMU Linux Processes
50 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
RSE sample
• Process service
• File service
51 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Multiplexing: Tunnel into QEMU
52 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
More on command-line tools
53 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
The Java side
• org.eclipse.tm.tcf
– Plain Java, no dependency to Eclipse
– Protocol binding only
– Asynchronous, callbacks
54 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Java: TCF Service Implementation
Callback
55 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
More about Services
56 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Required service: Locator
57 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF Services
• Processes Service
• Stack Trace Service
• System Monitor Service
• File System Service
58 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Value-add
Host Service 4
Value Add
Service 5
TCF Agent
Target Service 1 Service 2 Service 3
59 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Use Case: SimpleJtagDevice
• Protocol
– TCP/IP
• Services
– Service Manager (returns fixed list of services)
– Debug (run-control, breakpoint, memory access)
– Possibly Others (flash programming, download, etc)
• No Dynamic Addition or Removal of Services
• No Multiplexing (single client)
• No Forwarding
• No Dynamic Discovery
60 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0 60
Use Case: TestExceutionAgent
• Protocol
– Depends on OS configuration and board
• Services
– Service Manager (returns fixed list of services)
– Process launch and kill
– Standard I/O redirection
– File system access
• No Dynamic Addition or Removal of Services
• No Multiplexing (multiple clients)
• No Forwarding
• No Dynamic Discovery
61 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0 61
Use Case: LinuxUserModeAgent
• Protocol
– Typically TCP/IP, but depends on OS configuration and hardware
• Services
– Service Manager
– Debug (run-control, breakpoint, memory access)
– OS Awareness (process/thread list, CPU utilization, etc)
– Process launch and kill
– Standard I/O redirection
– File system access
• Possibly Dynamic Addition or Removal of Services
• Possibly Multiplexing (multiple clients)
• Possibly Forwarding
• Possibly Dynamic Discovery
62 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0 62
TCF Plugins
63 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Debugging
64 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF Debugging example
65 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
TCF: Next Steps
66 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Specification Status
• Transport Channel
• Current Services
– Run Control, Memory, Register, Breakpoint, Processes, Stack
Trace, File System, System Monitoring
67 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Links
68 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0 68
Questions?
69 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0
Credits
• Idea:
– Felix Burton (Wind River),
– Eugene Tarassov (Wind River)
• Original implementation
– Eugene Tarassov
70 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents
except logos and trademarks made available under the EPL v1.0