30
www.bandxi.com Copyright © 2009 Band XI International, LLC Building Modular Applications for Embedded Devices EclipseRT Day - November 2009 Brett Hackleman

Eclipse RT Day

Embed Size (px)

DESCRIPTION

Slides presented at EclipseRT day in Austin and Toronto.

Citation preview

Page 1: Eclipse RT Day

www.bandxi.com

Copyright © 2009 Band XI International, LLC

Building Modular Applications for Embedded Devices

EclipseRT Day - November 2009

Brett Hackleman

Page 2: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Overview

• OSGi, Equinox

• DeviceKit (interfacing with external hardware)

• Industrial Graphics Framework (custom SWT widgets)

• Remote Provisioning with p2

• Applied to:

– Industrial, Mining, Construction Systems

– US Army Distributed WMD Sensor System (Cyrano)

• Best practices

Page 3: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Challenges of Embedded Systems

• Platforms

– Availability, variability, scarcity, stability, cost (future of Java?)

• Peripheral hardware: sensors and actuators

– Availability, scarcity, size, cost

• User interfaces

– Input methods, desktop vs. appliance

• Constraints

– “Realtime”, memory/CPU limitations, development vs runtime costs

• Applications

– Yes, you still have to write the application(s) too!

Page 4: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Accepting the Challenge

• Lots of Risk == More Fun! (yes, we’re sick)

• Tackle risks head-on

– Build simulators, identify alternate paths and representative systems

• Embrace change

– Agile development methodologies build change into the process

• Use agile methods, frameworks, and tools

– Testing frameworks (JUnit, FitNesse)

– Continuous integration build systems (Jazz)

– Software Configuration Management (Jazz)

– And, of course…

Page 5: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

OSGi / EquinoxOSGi / Equinox

Page 6: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

OSGi: Introduction

• OSGi has been an open standard for over a decade

• Original domain (home gateways) has yet to take off

• Instead, OSGi has gained significant traction as a well-designed software componentization and deployment framework

– Eclipse, as the base platform

– J2EE server providers (Server-side OSGi)

– Mobile (Nokia, Sprint Titan)

– Embedded (MicroDoc & Band XI)

• Equinox is the most widely used OSGi implementation

• Bundle development well-supported by Eclipse PDE tooling

Page 7: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Our Perspective: A Decade of Embedded OSGi

• Automotive, Fleet Management, Remote Monitoring

– OnStar scenarios, diagnostics, infotainment, hands-free, navigation

• Industrial Controls, RFID

– Sensors, scaling, configuration management, deployment

• National Guard: WMD Sensors, Situational Awareness

– Provisioning new apps, biometric sensors, P2P comms

• Army: Vehicle Diagnostics & Prognostics Architecture

– Provisioning new algorithms, flexible UI, provisioning

• Mining Equipment: Diagnostics, Machine Control

– Rapid turnaround on new applications, flexible architecture

Page 8: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

OSGi: Highly Cohesive, Loosely Coupled Component Model

• Strong component model, common language

• Forces best practices from day one

• Core specification is pure and simple

• Logical and clear mapping with whiteboard drawings

• Dynamic life-cycle allows install/unintall/update without restart

• Integrated and sophisticated deployment mechanism

• Isolation of external libraries to monitor and consume capabilities

• Discourages spaghetti code: bundle partitions are like firebreaks

• Discourages code rot: containment lowers barrier to refactoring

Page 9: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

DeviceKitDeviceKit

Page 10: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

DeviceKit

• Tooling and components for communicating with hardware devices

• Provides high-level APIs for commands, signals, measurements

• Includes support for common interface types

– RS232, RS485 - serial port interfaces

– TCP, UDP network interfaces

– CAN, J1939, J1850, J1708 vehicle communications buses

– MIL-STD-1553 avionics communication bus

– JNI (onboard GPIO, transceivers, etc)

• OSGi-enabled out of the box

• Provides smooth path:

– Development --> Testbench --> Field-testing -> Production

• Currently lives in the Eclipse OHF project

Page 11: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

DeviceKit: Development Path

QuickTime™ and a decompressor

are needed to see this picture.

Page 12: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

DeviceKit: J1939 Protocols

• J1939-21: Datalink

– Basic Protocol Data Unit (PDU), PGNs, priorities, etc.

– Transport Protocol (multi-packet, broadcast and point to point)

• J1939-81: Network Management

– Address Claim (fixed, arbitrary address)

– Discovery

• J1939-73: Diagnostic Messages

– DM1: Active Diagnostic Trouble Codes (DTCs)

– DM2: Logged DTCs

– DM14/15/16: Memory Configuration

– Additional information for active/logged DTCs

• Proprietary J1939 Messages

– For solution-specific ECU’s

Page 13: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

DeviceKit: In-Vehicle J1939 Software Stack

CAN BUS

DTC

Lamp Status

J1939 Message

J1939 Address Claim

Data Transfer Record

JP CAN

Peak CAN

Fake CAN

CAN Connection

J1939 Transport

J1939 Diagnostics

Page 14: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

DeviceKit: J1939 Interfaces Supported

• Dearborn Group Gryphon (Ethernet to CAN)

• Peak CAN (USB to CAN)

• Wachendorff on-board PCAN transceiver

• Eurotech Zeus on-board CAN transceiver

• DriverTech DT-3000A

• DRS TEM BlueRing Platform

• RP1210A library (CAN/J1939 on Windows, CMPD)

Page 15: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Industrial Graphics FrameworkIndustrial Graphics Framework

Page 16: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Industrial Graphics Framework

• Desktop metaphors do not work in industrial control settings

• Designed for touchscreen and hard-/soft-button navigation

• Set of custom SWT widgets and exemplary sample applications

• Includes application shell, menu bar, graphics oriented widgets, and pop-ups

Page 17: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

p2: Remote Provisioningp2: Remote Provisioning

Page 18: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

p2 in Eclipse

TransportsHttp/Https

File system

Volume

Repositoriesp2

Update Site

Engine

Eclipse/OSGi

Native/OS

Director

ProfilesRuntimes

Provisioning operation requested

Metadata fetched and constraints

analyzed

IU install, uninstall, update operations

Artifact availability and mirroring

Mirroring

Data transfer

IUs configured into runtimes

Profile updated

Page 19: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

p2: Embedded

TransportsHttp/Https

File system

VolumeRepositories

p2

Update Site

Engine

Eclipse/OSGi

Native/OS

Director

Profiles Runtimes

Provisioning operation requested

Metadata fetched and constraints

analyzed

IU install, uninstall, update operations

Artifact availability and mirroring

Mirroring

Data transfer

IUs configured into runtimes

Profile updated

and Synchronized

Server Profiles

TextServer

Client

Page 20: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

p2: Device Management Portal

Page 21: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

ApplicationsApplications

Page 22: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Cyrano™ Overview

Existing WMD CSTCBRN Sensors

ACAA MultiRAE AreaRAE Thermo FH40 IdentifinderGamma SpecHAZMAT IDVDR 2VDR 13

Barcode/RFID Scanner

SampleCollection

Wireless Digital Media

RemoteExpert Input

HazardDetection

Biometrics

SCBA Tank Pulse OximeterHeart Rate & BP Monitor Others…

Vehicle Diagnostics

CAN J1939 J1850 OBD IIOthers…

Health StatusMonitoring

Vehicle MountedSystems for StatusMonitoring

WIFINetwork

GPSLocationTracking

Joint Operation Command

Decision Support; Command and Control

Sensor Fusion

Mapping Services Software Updates Voice Over IP Comms Multicast to Other Units

Sensor FusionSystem

Page 23: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Industrial, Mining, Construction, & Military Applications

• Building field production applications for mining and construction machines

– Salt Harvester

– Foundation Drill

– Train Engines

• Proves viability of the architecture and implementation in fielded environments

Page 24: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Mining & Construction Systems: Goals & Challenges

• Goals

– Shorten Application Development Time from 6-9 months to 2 weeks!

– Tackle this in stages by building and refining the foundation• 1st application: Duplicate existing reference application (6 months)

• 2nd application: Salt Harvesting Machine (10 weeks)• 3rd application: Foundation Drill Machine (5 weeks)

• Challenges

– 2 platforms to be supported: one legacy, one newly selected• Legacy platform: 400MHz ARM, 32MB RAM/ROM, WindowsCE• New Platform: 400MHz PPC, 1GB RAM, 64MB ROM, Linux

– Machinery does not exist yet; we will never touch it

– Incumbent native application to be displaced

Page 25: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Challenge: New Platform Integration

• Risks at Development Start– Platform not available until late in project schedule– SWT not running on the platform– CAN native JNI libraries did not exist

• Coping Strategy to Get Started– Started development with similar Linux platform– Used Gryphon (Ethernet-to-CAN) transport bundles– Found a CAN transport supported by same driver (PCAN-USB)– Built native JNI libraries and bundles to access CAN bus

• When Platform Became Available– Validated JNI libraries and bundles against platform CAN transceiver– Ran application headless while SWT in development– Ran entire application once SWT had been ported

Page 26: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Best PracticesBest Practices

Page 27: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Best Practices (1 of 2): Eclipse

• Use Eclipse PDE and p2 tooling - bundles are first class citizens!

• Identify target platform early, put under version control

• Use product files to describe/build runtime configurations

• Get involved

Page 28: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Best Practices (2 of 2): OSGi

• Use only Import-Package and Export-Package for visibility

• Use Declarative Services to manage optional and required services

• Separate interfaces from implementation

• Separate application logic implementation from OSGi specific code

• Build fake, simulated, and real devices to keep moving

• Keep application work off OSGi threads (activation or call-backs)

• Assume nothing about start order

• Test shutdown behavior obsessively to expose loose ends

• Have at least one OSGi/Equinox expert on your team

• Develop using OSGi – even if it will not be used in final product

Page 29: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

Discussions & Demo

• Questions, Comments?

• Demo

Page 30: Eclipse RT Day

Copyright © 2009 Band XI International, LLC

DeviceKit: CAN/J1939 Test Bench

GryphonEthernet to J1939Protocol Bridge

DPA IIIRS232 to J1939Protocol Bridge

J1939 2-wire CAN bus

J1939 Sensors

Industrial A5M2 ECU

Embedded Platformw/CAN tranceiver

DT3000 (Windows)Eurotech Zeus (Linux)

Wachendorff A5 (Linux)