Mais conteúdo relacionado Semelhante a Use Eclipse Technologies to build a modern embedded development IDE (20) Mais de Benjamin Cabé (20) Use Eclipse Technologies to build a modern embedded development IDE1. Use Eclipse Technologies to build a modern
embedded development IDE.
Gaétan Morice – Benjamin Cabé
October 28th, 2009
3. Requirements
• What is M2M ?
API/Web
Services
Asset Communication Connectivity Customer
Device Network Application
• Definition : “M2M refers to data communication between machines.”
© Sierra Wireless inc. – Made available under EPL v1.0
4. Requirements
API/Web
Services
Asset Communication Connectivity Customer
Device Network Operated & Hosted Application
M2M Services
Platform
Hosted and operated M2M services platform. Highly scalable, available and secure.
Provides APIs to develop web-based custom designed applications.
Open embedded agent integrated in virtually any cell devices (Airlink box, modules
embedded in OEM equipment, custom box etc. both from Sierra or other 3rd party).
Patented world class Eclipse based IDE to develop embedded applications
and to generate widgets for end-users.
© Sierra Wireless inc. – Made available under EPL v1.0
5. Requirements
• Embedded development (Machine-to-Machine)
• Modeling environment
• Component-oriented approach
Model Code Binary Target Execution Debug
© Sierra Wireless inc. – Made available under EPL v1.0
6. Requirements
• Users profiles
►Newbies
►Solution providers
• Multiple targets
►Sierra Wireless devices
►Embedded Linux
►…
© Sierra Wireless inc. – Made available under EPL v1.0
8. Features
Editors
Validation Navigator
Model
Editor
Compilation Code
Navigator
Communication Target Navigator
© Sierra Wireless inc. – Made available under EPL v1.0
9. Features
Model
© Sierra Wireless inc. – Made available under EPL v1.0
10. Modeling
Model
• EMF - Eclipse Modeling Framework
►The model is the pillar of the tool
►Used to model what an embedded project is
►Benefits from EMF
–Notifications
–Serialization
–Reflective API
–… all the incredible EMF tools (GMF, Validation, Xpand, Ecore Tools, …)
© Sierra Wireless inc. – Made available under EPL v1.0
11. Modeling
Model
© Sierra Wireless inc. – Made available under EPL v1.0
12. Features
Navigator
Model
© Sierra Wireless inc. – Made available under EPL v1.0
13. Navigator
Navigator
• Objectives Model
►1:1 Mapping between Project and Model
►Display informations in the model as project’s artefacts
© Sierra Wireless inc. – Made available under EPL v1.0
14. Navigator
Navigator
• Workspace integration Model
►AdapterFactory transforms
–IProject into Model Project
–Model Project into Iproject
public class ProjectAdapterFactory implements IAdapterFactory {
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
Object result = null;
// Bi-directional adapter IProject <----> M2MProject
if (adaptableObject instanceof IProject && adapterType.equals(Project.class)) {
result = adaptToModel((IProject) adaptableObject);
}
else if (adaptableObject instanceof Project && adapterType.equals(IProject.class)) {
result = adaptIProject((Project) adaptableObject, adapterType);
}
return result;
}
}
© Sierra Wireless inc. – Made available under EPL v1.0
15. Navigator
Navigator
• Workspace integration Model
►EMF Transaction
–Global model repository
–Transactional Editing Domain
public class ProjectActivator extends Plugin {
public static final String TRANSACTIONAL_EDITING_DOMAIN_ID = "com.anwrt.ec598.project.editingDomain";
...
public TransactionalEditingDomain getEditingDomain(){
TransactionalEditingDomain shared = TransactionalEditingDomain.Registry.INSTANCE
.getEditingDomain(TRANSACTIONAL_EDITING_DOMAIN_ID);
return shared;
}
...
}
© Sierra Wireless inc. – Made available under EPL v1.0
16. Navigator
Navigator
• Project Explorer Model
►Displays model objects as the Project structure
►Based on Common Navigator Framework
–Extensible tree view
–Rather complex API
–But really powerful
Extension Points: org.eclipse.ui.navigator.*
Excellent tutorial: “Building a Common Navigator based viewer”
►We use an internal model to define the structure (nodes only
used to group or display informations)
© Sierra Wireless inc. – Made available under EPL v1.0
17. Navigator
Navigator
• Project Explorer Model
►Result
EMF Objects
Model contribution
Navigation nodes
CDT contribution
Default display (resources)
© Sierra Wireless inc. – Made available under EPL v1.0
18. Features
Editors
Navigator
Model
© Sierra Wireless inc. – Made available under EPL v1.0
19. Model dition
Editors
• Forms editors Model
►Forms + EMF + databinding
–Create UI
private void createContent(FormToolkit toolkit, Composite parent) {
Composite composite = toolkit.createComposite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(composite);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);
toolkit.createLabel(composite, "Name:", SWT.NONE);
_textName = toolkit.createText(composite, "", SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(_textName);
}
–Bind UI to model
private void bind() {
DataBindingContext bindingContext = new EMFDataBindingContext();
// -- Bind the Name
bindingContext.bindValue(SWTObservables.observeText(_textName, SWT.FocusOut),
EMFEditObservables.observeDetailValue(Realm.getDefault(), getEditingDomain(),
_myEObject, M2MPackage.eINSTANCE.getINamedElement_Name()));
}
© Sierra Wireless inc. – Made available under EPL v1.0
20. Model edition
Editors
• Forms editors Model
►Result
Available in PDE Incubator:
EMF-Forms Editor to be used for next-generation PDE editors
© Sierra Wireless inc. – Made available under EPL v1.0
21. Model edition
Editors
• Graphical Editor: GMF Model
►Uses GMF generator to bootstrap
GMF generation
Model
Generated Customization
editor
Modified
editor
►Heavy use of GMF Runtime
© Sierra Wireless inc. – Made available under EPL v1.0
22. Model edition
Editors
• Graphical Editor: GMF Model
►Other features
–Rotation
–Automatic port creation
–HTML Tooltips
–Extensible presentation
•Custom figures can be defined using an extension point
© Sierra Wireless inc. – Made available under EPL v1.0
23. Model edition
Editors
• Graphical Editor: GMF Model
►Result
© Sierra Wireless inc. – Made available under EPL v1.0
24. Features
Editors
Validation Navigator
Model
© Sierra Wireless inc. – Made available under EPL v1.0
25. Model validation
Validation
• EMF Validation Model
►Extensible (needed for specific-target constraints)
►Constraints are registered using an extension point
Extension points: org.eclipse.emf.validation.*
►We use only the batch mode
public IStatus validate (EObject model, IProgressMonitor monitor) {
IBatchValidator batchValidator = ModelValidationService.getInstance()
.newValidator(EvaluationMode.BATCH);
batchValidator.setIncludeLiveConstraints(true);
batchValidator.setReportSuccesses(false);
return batchValidator.validate(model, monitor);
}
© Sierra Wireless inc. – Made available under EPL v1.0
26. Model validation
Validation
►Integrated in a builder Model
–Transparent and automatic (on save)
–Uses Problem Markers
–Coupled with quick fixes for a better user experience
Validation decorators are based on
markers generated by the Validation builder
© Sierra Wireless inc. – Made available under EPL v1.0
27. Features
Editors
Validation Navigator
Model
Code
© Sierra Wireless inc. – Made available under EPL v1.0
28. Code generation
Model
• Xpand Code
►Performance issue
–Workflow is too slow then use only Java API
►Example of template
«IMPORT model»
«DEFINE file FOR SourceComponentClass»
«FILE project.name.toLowerCase() + "/" + name + ".java"-»
package «project.name.toLowerCase()»;
public class «name» extends ComponentClass {
«IF methods.select(m | m.kind.toString() == "EVENT").size > 0»
public void receiveEvent(int inputEventMethod, Object value) {
«FOREACH methods.select(m | m.kind.toString() == "EVENT") AS m-»
// TODO handle Event: " + «m.name.toUpperCase()»:
«ENDFOREACH-»
}
«ENDIF»
}
«ENDFILE»
«ENDDEFINE»
© Sierra Wireless inc. – Made available under EPL v1.0
29. Code generation
Model
• Xpand Code
►Call the Xpand generator programmatically
public void generate(final EObject object, IProgressMonitor monitor) throws CoreException {
Generator generator = new Generator();
// define the metamodel used in the template
MetaModel m2mMetamodel = new EmfMetaModel(M2MPackage.eINSTANCE);
generator.addMetaModel(m2mMetamodel);
// define the template
generator.setExpand("templates::SourceComponentClass::file FOR component");
// define the output folder
Outlet outlet = new Outlet("C:/myOutput/src");
generator.addOutlet(outlet);
// configure protected regions
generator.setPrSrcPaths("C:/myOutput/src");
generator.setPrDefaultExcludes(true);
// define the EObject input
WorkflowContextDefaultImpl ctx = new WorkflowContextDefaultImpl();
ctx.set("component", object);
// run the generator
generator.invoke(ctx, new ProgressMonitorAdapter(monitor), new IssuesImpl());
}
© Sierra Wireless inc. – Made available under EPL v1.0
30. Code generation
Model
• Integrated in a builder Code
►Transparent and automatic (on save)
►Synchronization between model and code
►Incremental generation
© Sierra Wireless inc. – Made available under EPL v1.0
31. Features
Editors
Validation Navigator
Model
Editor
Code
Navigator
© Sierra Wireless inc. – Made available under EPL v1.0
32. Code editors and navigator
Editor
Code
• CDT
Navigator
►Code navigation
►Syntax highlight
►Content assist
►Refactoring
►…
• LuaEclipse
►Currently not based on DLTK but under development
© Sierra Wireless inc. – Made available under EPL v1.0
33. Code editors and navigator
Editor
Code
• CDT
Navigator
© Sierra Wireless inc. – Made available under EPL v1.0
34. Features
Editors
Validation Navigator
Model
Editor
Code
Navigator
© Sierra Wireless inc. – Made available under EPL v1.0
35. Round-tripping
Model
• Mandatory for a good user experience Code
• Be able to edit code or model indifferently
►Continuous synchronization
• First study: EMF Compare
►Good candidate but too rich for our needs
►Solution: Direct modification of existing models
© Sierra Wireless inc. – Made available under EPL v1.0
36. Round-tripping
Model
• Solution Code
►Integrated in a builder
►Synchronize Model and AST Code
►From code to model: Based on existing parser
AST
Java transformation
Model Model
(previous version) (extract from code)
Merge
Model
(new version)
© Sierra Wireless inc. – Made available under EPL v1.0
37. Features
Editors
Validation Navigator
Model
Editor
Compilation Code
Navigator
© Sierra Wireless inc. – Made available under EPL v1.0
38. Compilation
Compilation Code
• CDT - Managed Build System (MBS)
►Declarative creation of custom tool chains
–Through MBS Extension point
–Direct integration in CDT builder and preference
–A bit complex
Extension Point: org.eclipse.ui.managebuilder.core.buildDefinition
Excellent tutorial: CDT Plug-in Developer Guide
►Mechanism of scanner discovery profiles to find tools binaries
Extension Point:
org.eclipse.cdt.make.core.ScannerConfigurationDisccoveryProfile
© Sierra Wireless inc. – Made available under EPL v1.0
39. Compilation
Compilation Code
• CDT – MBS
►Result
Binaries packages for download on device
Options
Compiler and linker for the device (based on ARM GCC)
Tools
Binary post-processors to match device caracteristics
© Sierra Wireless inc. – Made available under EPL v1.0
40. Compilation
Compilation Code
• CDT - Dependencies management
►Dependencies management
–Difficult with CDT
–Configuration, build artefacts, libraries include, header include to manage
–No generic rule => have to be hand craft
–Use of CDT API to access projects description
–Managed by refactoring process
© Sierra Wireless inc. – Made available under EPL v1.0
41. Compilation
Compilation Code
• CDT - Dependencies management
public class ModifyCProjectDependenciesChange extends Change {
private final IProject project;
...
public Change perform(IProgressMonitor pm) throws CoreException {
ICProjectDescription projectDescription = CDTPropertyManager.getProjectDescription(project);
ICConfigurationDescription[] configurationDescription = projectDescription.getConfigurations();
...
}
...
}
© Sierra Wireless inc. – Made available under EPL v1.0
42. Features
Editors
Validation Navigator
Model
Editor
Compilation Code
Navigator
Target
© Sierra Wireless inc. – Made available under EPL v1.0
43. Features
Editors
Validation Navigator
Model
Editor
Compilation Code
Navigator
Communication Target
© Sierra Wireless inc. – Made available under EPL v1.0
44. Target communication
Communication Target
• Objectives:
►make device's services available
–Download
–Terminal
–…
►De-coupling of services and communication channel
►Extensible
© Sierra Wireless inc. – Made available under EPL v1.0
45. Target communication
Communication Target
• Target Communication Framework - TCF
►Embedded agent
►Asynchronous Launch Terminal
Config View
►Protocol based on
►Command, Result Download Terminal
►Event Service Service
Connection
TCF Channel
Manager
Embedded
Agent
© Sierra Wireless inc. – Made available under EPL v1.0
46. Features
Editors
Validation Navigator
Model
Editor
Compilation Code
Navigator
Communication Target Navigator
© Sierra Wireless inc. – Made available under EPL v1.0
47. Target navigator
Target Navigator
• Remote System Explorer - RSE
►GUI framework
►Tree Explorer
►Match well with TCF
© Sierra Wireless inc. – Made available under EPL v1.0
48. Target navigator
Target Navigator
• Remote System Explorer
© Sierra Wireless inc. – Made available under EPL v1.0
49. Features
Editors
Validation Navigator
Forms
EMF Validation GMF
Project Explorer + CNF
Model
Xpand AST
Editor
CDT
Compilation Code CDT + DLTK
Navigator
TCF RSE
Communication Target Navigator
© Sierra Wireless inc. – Made available under EPL v1.0
52. The benefits of a large ecosystem
• Allows to create really complex environment quickly
• Covers differents kinds of domains
• Offers reactive support with the community
• Allows to focus on real added value
© Sierra Wireless inc. – Made available under EPL v1.0
53. Questions?
Gaétan Morice
gmorice@sierrawireless.com
Benjamin Cabé
bcabe@sierrawireless.com