embedded target communications with tcf martin oberhuber michael scharf wind river

70
Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

Upload: shana-dennis

Post on 24-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

Embedded Target Communications with TCF

Martin Oberhuber

Michael Scharf

Wind River

Page 2: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

2 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Tutorial Themes

How we’re going to run this:

• Practical• Interactive• Workspace Take-away

Page 3: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

3 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

Page 4: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

4 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)

Page 5: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

5 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

CPU

HWIP

DSP

3rd party SW

CPUDebugger

3rd party SW

DSPDebugger

SoC (Model)

Target DescriptionIP-XACT,

XML

Target Server(s)

TCF

TCFTCF

TCF

TCF

This slide © SPRINT and Infineon 2007, 2008. All rights reserved.

Eclipse

Page 6: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

6 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Today: Separate Communications per tool

UI

Target

Tool A Tool B Tool C Tool D

Agent A Agent B Hardware C

Value Add B

Value Add CHost P1

P3

P2

Page 7: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

7 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

UI

Target

Tool A Tool B Tool C Tool D

Agent A Agent B Agent C

Value Add B

Value Add CHost P1

P3

P2

? ? ?

Page 8: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

8 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Bad Design!

UI

Target

Tool A Tool B Tool C Tool D

Agent A Agent B Agent C

Value Add B

Value Add CHost

Page 9: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

9 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Limited eco system

• Too many different tools agents and protocols• Add-on providers need to provide multiple integrations• Huge effort putting it all together end-to-end• Lock-in to single vendor for end-to-end solution

– No best-of-breed mashup solutions

Page 10: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

10 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

• Protocol Framework provides common infrastructure – communication protocol– Agent: “Service container”– Proxying

• Same protocol on all layers supporting value-add– Support pass-through

• Tools can use services in uniform way• Service implementers can focus on functionality

Page 11: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

11 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

• ECF – Eclipse Communication Framework– API independent of Protocol– API in Java - abstract specification of concepts:

• Message, Channel, Container, ID• Datashare, Filetransfer, Directory Listing

– ONE API for multiple protocols (e.g. Files; FTP, HTTP, EFS, …)– Very flexible one-to-many communications

• TCF and ECF are similar, but ECF is on a higher layer

Page 12: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

12 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

• Use the same extendable protocol end-to-end– allow value-adding servers to intercept select services

• Extension: Abstract Services as building blocks – Same tool for multiple targets (e.g. agent, OCD, simulator)– Avoid tools specific agents– Bridge gap with specific services to configure common ones

• Data-driven by target– Service knows best how to represent the system– If not possible, put the knowledge in the lowest possible layer and data

drive the layers above

• Support high latency communication links

Page 13: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

13 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Service 4

Service 5

TCF: Common agent and protocol

Tool A Tool B Tool C Tool D

TCF Agent

Value Add

UI

Target

Host

Service 1 Service 2 Service 3

Page 14: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

14 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

Service 4

Service 5

Tool A Tool B Tool C Tool D

Value Add

UI

Target

Host

Service 1 Service 2 Service 3

TCF Agent

Page 15: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

15 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Service

Service 4

Service 5

Tool A Tool B Tool C Tool D

TCF Agent

Value Add

UI

Target

Host

Service 1 Service 2 Service 3

Page 16: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

16 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Message Channel

Service 4

Service 5

Tool A Tool B Tool C Tool D

TCF Agent

Value Add

UI

Target

Host

Service 1 Service 2 Service 3

TCF Channel

TCF Channel

Page 17: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

17 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Channels and Messages

• Communication between peers use channels• Channels abstract/hide the transport layer

– Currently TCP– Possible: RS232, JTAG, USB etc

• Channels transmit Messages

Page 18: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

18 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

• Multiple channels per peer

• Proxying/Tunneling– Message forwarding– “Decorator” can intercept communication– “Value-add” services (e.g. debug info)– No protocol conversion needed

Page 19: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

19 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

Page 20: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

20 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!

Page 21: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

21 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!

Page 22: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

22 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Commands are Asynchronous

• Sender of a command returns immediately– Fast on high latency connections

• Sender receives results– asynchronously

Page 23: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

23 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

Page 24: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

24 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

• Keep state of remote peer• Without message ordering no consistent state• Ordering per channel and direction

Command X=1

Result X=1

Event X=2

Command X=3

Event X=4

Result X=3

Event X=5

Page 25: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

25 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

Page 26: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

26 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Service 4

Service 5

TCF: Layered View

Tool A Tool B Tool C Tool D

TCF Agent

Value Add

UI

Target

Host

Service 1 Service 2 Service 3

Page 27: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

27 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Communication Layers

Channel

Messages

Services

Transport Layer (e.g. TCP/IP)

Page 28: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

28 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

Channel

Messages

?????????????????????????????????????????????

Services

Transport Layer (e.g. TCP/IP)

Page 29: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

29 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Channel: Message Stream

Messages

??????????????????????????????????????????Channel

Services

??????????????????????????????????????????????Transport Layer (e.g. TCP/IP)

Page 30: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

30 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

Messages

??????????????????????????????????????????

C 17 SysMonitor getChildren ??????

??????????????????????????????????????????????

Channel

Transport Layer (e.g. TCP/IP)

Services

Page 31: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

31 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Message Type

Messages C 17 SysMonitor getChildren ??????

Message Type

??????????????????????????????????????????

??????????????????????????????????????????????

Channel

Transport Layer (e.g. TCP/IP)

Services

Page 32: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

32 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Token

Messages C 17 SysMonitor getChildren ??????

Token: Channel Unique

To identify Result

??????????????????????????????????????????

??????????????????????????????????????????????

Channel

Transport Layer (e.g. TCP/IP)

Services

Page 33: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

33 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Service Id

Messages C 17 SysMonitor getChildren ??????

Service id

??????????????????????????????????????????

??????????????????????????????????????????????

Channel

Transport Layer (e.g. TCP/IP)

Services

Page 34: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

34 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Command Name

Messages C 17 SysMonitor getChildren ??????

Command name

??????????????????????????????????????????

??????????????????????????????????????????????

Channel

Transport Layer (e.g. TCP/IP)

Services

Page 35: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

35 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Arguments (byte array)

Messages C 17 SysMonitor getChildren ??????

Arguments (byte array)

??????????????????????????????????????????

??????????????????????????????????????????????

Channel

Transport Layer (e.g. TCP/IP)

Services

Page 36: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

36 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

Messages

C 17 SysMonitor getChildren [“p123”]

C 17 SysMonitor getChildren ??????

??????????????????????????????????????????

??????????????????????????????????????????????

Channel

Transport Layer (e.g. TCP/IP)

Services

Marshalling: JSON

Page 37: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

37 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> •

Page 38: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

38 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

7 Application Layer

6 Presentation Layer

5 Session Layer

4 Transport Layer

3 Network Layer

2 Data Link Layer

1 Physical Layer

Channel + Messages

JSON

Services

Page 39: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

39 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

7 Application Layer

6 Presentation Layer

5 Session Layer

4 Transport Layer

3 Network Layer

2 Data Link Layer

1 Physical Layer

JSON

Services

Channel + Messages

Page 40: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

40 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Prototype implementation

• Lightweight C-based agent– Minimal agent has < 4000 lines of C code– Minimal impact on the target

• Eclipse plug-ins– Java TCF implementation to access service

Page 41: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

41 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

• Compilers: *.exe with installer– Cygwin, or MinGW 5.1.4+MSYS (with Wascana), or VS Express– CodeSourcery g++ Lite for ARM

Page 42: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

42 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

• Import into Workspace: tcf.zip– Import > General > Existing Projects > Archive– Or import SVN Team Project Set

• Build TCF Agent native / cross– User-defined build (hand written Makefile) – external shell

• Type “make” on host

• Type “make ARCH=ARM” for target ARM

– Visual Studio (Express): open agent.sln and build• Need VS for Windows Debugging

• Need external dbghelp.dll for bug fixes – CQ 2553

Page 43: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

43 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

TCF Sample Session

• Open Command prompt 1 for agent:– cd org.eclipse.tm.tcf.agent/Cygwin/i686/Debug– ./agent -L-

• Open Command prompt 2 for client:– ./client -L- – help– peers– connect tcp:127.0.0.1:1534 – tcf FileSystem roots – tcf FileSystem opendir "/root" – tcf FileSystem readdir "FS0" – tcf <serviceName> <command> <JSONargs>

Agent is auto-detected

JSON messagesUsing an ID

Logging to stdout

Shortcut: connect TCP::

Page 44: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

44 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Auto Discovery

• Discovers Peers and Services

• Simplifies setup– Client UI can easily find peers and discover services

• TCF comes with a simple UDP auto discovery– Other mechanisms possible and optional

Page 45: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

45 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

How Discovery works

• First agent binds UDP::1534 to listen– If port is not available, somebody else is master already

• Become slave: periodically send “Hello” to UDP::1534• Master responds with list of known peers

• Master listens for new slaves announcing themselves– Keep list of known slaves, broadcast to all when asked

• When master dies, a slave will get no response on poll– After timeout on poll, slave becomes new master– It has the full list of known peers already at this time

• Across networks: fixed master – tcfreg program• Other implementations of Protocol / API are possible

Page 46: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

46 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

• Define OPSYS, ARCH in the Makefile• Not all Services may be supported on target Platform

– Use config.h to disable unwanted services

• Look at SVN diffs in your Workspace• Once built, use RSE “SSH Only” to drag & drop

executables into the remote. Don’t forget chmod +x

Page 47: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

47 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Agent Structure

• Documented on TCF Agent Prototype docs

Services: filesystem, sysmon, processes;runctrl, memory, breakpoints, registers;

expressions, stacktrace, symbols

Core handlers / event dispatchprotocol, channel*, streams, event, inputbuf, ip_ifc tcf.h

Infra: cmdline, errors, exceptions, asyncreq json / base64, mdep, myalloc, trace

Core servicesproxy, discovery*, streams

con

text

, dw

arf

*, li

nen

., m

em

orym

ap

, win

dbg

mai

n*,

test

, co

nfig

, di

ag.

Page 48: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

48 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Agent Structure (2)

• Main and config configures and instantiates framework and services („hook up“)– #define SERVICE_xxx

• Event loop sends request into service, service responds immediately or asynchronously

• One event Thread only• Service protocol spec relates to functions in code:

– command_roots, event_context_created, ...

• Client cmdline is just another source of events

Page 49: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

49 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

• This is in run.bat, to redirect SSH (2222) and port 7000:– qemu.exe –redir tcp:2222::22 -redir tcp:7000::7000

• Start run.bat– Login with “root : root”

• Or ssh localhost –p 2222 –l root

– ./agent –L- -sTCP::7000

• RSE: New TCF connection to localhost:7000– Show QEMU Linux processes

-sURLServer socket on port 7000

Page 50: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

50 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

Page 51: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

51 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

Page 52: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

52 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

• QEMU is not discoverable because it cannot talk to UDP::1534 – since that port is not shared– Use a remote value-add for dispatching multiple channels

• Inside QEMU:– Stop agent.exe– Shell 1: ./valueadd –L- -sTCP::7000– Shell 2: ./agent –L- -sTCP::7010

• Using default port

• On local commandline– ./client –L-– connect TCP::7000– peers– tcf Locator redirect TCP::7010– tcf FileSystem roots

Peer on 7010 is autodetected

Multiplexer on port 7000

value-add supports multiple clients/channels

Page 53: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

53 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

• Tcfreg: dumbed-down agent as UDP discovery registry only• Tcflog: no service itself: forwards requests and logs them• Valueadd: provides Locator.redirect service only

• Code mostly common, in main_*.c– l<num> : log level– L<file> : log to file– s<url> : for servers (agent, tcflog, valueadd): Port to expose

e.g. TCP:localhost:1534, default just TCP:

• Additional client option:– S<scriptfile> : replay a script

• Additional agent options:– i : interactive, -d : daemon, -t : test

Page 54: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

54 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

Page 55: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

55 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

• Asynchronous: DoneMkDir is the Callback• Commands go into a queue to run on Command Thread

Callback

Page 56: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

56 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

More about Services

• Protocol Specification / Docs can be viewed locally– org.eclipse.tm.tcf.docs project

• C Impl: Each has a macro define to enable/disable– FileSearch “#if SERVICE_” to find impl.– Common init function to register commands– Common naming pattern

• Java Impl: Each service is an interface– Extends Iservice– Implemented by a Proxies– Async callback mechanism

Page 57: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

57 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Required service: Locator

• Used to discover peers• Peer lifecycle events• When connected peers can list its services

Page 58: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

58 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

TCF Services

• Run Control Service• Breakpoints Service• Memory Service• Registers Service

• Processes Service• Stack Trace Service• System Monitor Service • File System Service

Page 59: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

59 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Value-add

Service 4

Service 5

Tool A Tool B Tool C Tool D

TCF Agent

Value Add

UI

Target

Host

Service 1 Service 2 Service 3

Page 60: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

60 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

Page 61: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

61 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

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

Page 62: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

62 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

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

Page 63: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

63 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

TCF Plugins

• Org.eclipse.tm.tcf – Core Java framework• Org.eclipse.tm.tcf.agent – The agent (plain C)• Org.eclipse.tm.tcf.debug.* - Debug Integration• Org.eclipse.tm.tcf.docs – • Org.eclipse.tm.tcf.dsf.* - DSF integration• Org.eclipse.tm.tcf.examples.daytime.* - How to create

a custom Service (both agent and client)• Org.eclpise.tm.tcf.rse – RSE Files and Processes

Page 64: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

64 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Debugging

• Run > Debug Configurations > TCF– Select connection (auto-discovered)– Program: /root/helloworld/helloworld– Args: “tcf is cool”– Debug

• Switch to “Debug Perspective”• Show View “TCF Trace”• Suspend / Resume, Registers

Page 65: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

65 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

TCF Debugging example

Page 66: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

66 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

TCF: Next Steps

• A large number of adopters today – “TCF Round Table”– Mostly “whitebox adoption” today– Conversion from TCF to legacy proprietary

• Protocol conversion agent (like valueadd)• TCF C Agent binding to legacy implementation

• Core Protocol spec is frozen, working on Services– Version / maturity / status info to be added to docs

• Getting involved:– mailto:[email protected]– Bugzilla, Newsgroup, Wiki

Page 67: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

67 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Specification Status

• Review of current and specification of additional services in power.org and Eclipse

• Transport Channel• Current Services

– Run Control, Memory, Register, Breakpoint, Processes, Stack Trace, File System, System Monitoring

Page 68: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

68 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Links

• TCF Homepage has all the pointers– http://wiki.eclipse.org/DSDP/TM/TCF– SVN Team Project Sets, ViewSVN– Documentation

• Getting Started (less than what we did)

• Protocol Specification (messages, events, JSON)

• Services description

• Agent description

68

Page 69: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

69 TCF Tutorial | © 2007, 2009 Wind River Systems, Inc. | all contents except logos and trademarks made available under the EPL v1.0

Questions?

Page 70: Embedded Target Communications with TCF Martin Oberhuber Michael Scharf Wind River

70 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