Use Eclipse Technologies to build a modern embedded development IDE

3,377 views

Published on

This talk aims at presenting how we combined several Eclipse technologies to create a new generation tooling for embedded development. This new tool allows developers to use a component oriented approach to design the embedded code. We explain how the following Eclipse technologies can be used to create a complete tooling:

* EMF as a central component to define the data model of the tool
* The Common Navigator Framework to integrate a logical view in the Project Explorer
* GMF to edit graphically some parts of the model
* Xpand to implement code generators
* EMF Compare to allow round tripping between model and code
* DLTK to add support of a new scripting language (Lua)
* Eclipse Builders to implement the compilation toolchain
* RSE (Remote System Explorer) to interact with the target
* TCF (Target Communication Framework) to download, execute, debug on the target

Published in: Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,377
On SlideShare
0
From Embeds
0
Number of Embeds
575
Actions
Shares
0
Downloads
188
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Use Eclipse Technologies to build a modern embedded development IDE

  1. 1. Use Eclipse Technologies to build a modern embedded development IDE. Gaétan Morice – Benjamin Cabé October 28th, 2009
  2. 2. Embedded Modeling IDE Requirements
  3. 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. 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. 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. 6. Requirements • Users profiles ►Newbies ►Solution providers • Multiple targets ►Sierra Wireless devices ►Embedded Linux ►… © Sierra Wireless inc. – Made available under EPL v1.0
  7. 7. Embedded Modeling IDE Technical Solution
  8. 8. Features Editors Validation Navigator Model Editor Compilation Code Navigator Communication Target Navigator © Sierra Wireless inc. – Made available under EPL v1.0
  9. 9. Features Model © Sierra Wireless inc. – Made available under EPL v1.0
  10. 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. 11. Modeling Model © Sierra Wireless inc. – Made available under EPL v1.0
  12. 12. Features Navigator Model © Sierra Wireless inc. – Made available under EPL v1.0
  13. 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. 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. 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. 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. 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. 18. Features Editors Navigator Model © Sierra Wireless inc. – Made available under EPL v1.0
  19. 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. 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. 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. 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. 23. Model edition Editors • Graphical Editor: GMF Model ►Result © Sierra Wireless inc. – Made available under EPL v1.0
  24. 24. Features Editors Validation Navigator Model © Sierra Wireless inc. – Made available under EPL v1.0
  25. 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. 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. 27. Features Editors Validation Navigator Model Code © Sierra Wireless inc. – Made available under EPL v1.0
  28. 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. 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. 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. 31. Features Editors Validation Navigator Model Editor Code Navigator © Sierra Wireless inc. – Made available under EPL v1.0
  32. 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. 33. Code editors and navigator Editor Code • CDT Navigator © Sierra Wireless inc. – Made available under EPL v1.0
  34. 34. Features Editors Validation Navigator Model Editor Code Navigator © Sierra Wireless inc. – Made available under EPL v1.0
  35. 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. 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. 37. Features Editors Validation Navigator Model Editor Compilation Code Navigator © Sierra Wireless inc. – Made available under EPL v1.0
  38. 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. 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. 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. 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. 42. Features Editors Validation Navigator Model Editor Compilation Code Navigator Target © Sierra Wireless inc. – Made available under EPL v1.0
  43. 43. Features Editors Validation Navigator Model Editor Compilation Code Navigator Communication Target © Sierra Wireless inc. – Made available under EPL v1.0
  44. 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. 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. 46. Features Editors Validation Navigator Model Editor Compilation Code Navigator Communication Target Navigator © Sierra Wireless inc. – Made available under EPL v1.0
  47. 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. 48. Target navigator Target Navigator • Remote System Explorer © Sierra Wireless inc. – Made available under EPL v1.0
  49. 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
  50. 50. Embedded Modeling IDE Demonstration
  51. 51. Embedded Modeling IDE Conclusion
  52. 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. 53. Questions? Gaétan Morice gmorice@sierrawireless.com Benjamin Cabé bcabe@sierrawireless.com

×