Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Xml Editor and Checker for CMSIS-Pack in Eclipse

DZone's Guide to

Xml Editor and Checker for CMSIS-Pack in Eclipse

Eclipse ships as different distributions, but the plugin architecture means cross-over capabilities, like XML editing in C++. This tutorial shows how to configure the details.

· IoT Zone
Free Resource

Discover why Bluetooth mesh is the next evolution of IoT solutions. Download the mesh overview.

So far, the XML files I had to work on were very simple ones, so a normal text editor was fine. Now I’m tapping into the world of CMSIS-Packs (see “ Are ARM CMSIS-Pack the Future of Software Components?“). And definitely this adds a complexity for which I better use some XML editing and checking tools. The ARM tutorial for CMSIS recommends either Notepad++ or Visual C++ (see http://www.keil.com/pack/doc/CMSIS/Pack/html/_create_pack_util.html). But hey, Eclipse should be able to do that maybe even better right? So this is about adding an XML editor and XML checker to Eclipse.
Editing CMSIS-Pack .pdsc File in Eclipse

Editing CMSIS-Pack .pdsc File in Eclipse

Outline

In this post I describe how to add an editor to edit and verify XML files. I use that for ARM CMSIS-Pack XML files with NXP Kinetis Design Studio, but the steps are applicable to any Eclipse or any kind of XML editing.

Adding XML Editor to Eclipse

I’m using Eclipse Mars and Luna. The easiest way to get XML capabilities is to to install the “Eclipse XML Editors and Tools“. Use the standard Eclipse update site (e.g. luna or mars) for your Eclipse distribution. The XML editor is under ‘Programming Languages’. Screenshot shown for NXP Kinetis Design Studio (Luna based):

:idea: You can filter the entries for ‘xml’ as I did in the screenshot below.

Eclipse XML Editors and Tools

Eclipse XML Editors and Tools

Then go through the installation process with ‘Next >’.

CMSIS-Packs

Make sure you have the PACK.xsd (XML Schema Definition) file present in the root of the pack:

CMSIS-Pack XML Schema Definition File

CMSIS-Pack XML Schema Definition File

The PACK.xsd file is part of ‘CMSIS’ Pack and e.g. can be found here (using version 4.5.0 inside the Keil installation:

<Keil MDK>\ARM\Pack\ARM\CMSIS\4.5.0\CMSIS\Utilities

Or the place where you have installed the packs with the GNU ARM Eclipse Pack manager:

CMSIS Core Pack Installed

CMSIS Core Pack Installed

With the XML editor installed I can double-click on that .xsd file and get a nice schema definition viewer:

XSD Viewer in Eclipse

XSD Viewer in Eclipse

Trying to do the same with the .pdsc gives me this dialog as the extension is not a usual XML file extension:

pdsc is not a supported XML extension

pdsc is not a supported XML extension

Clicking on that link in the dialog gives me a dialog where I can add the *.pdsc extension to be handled as XML:

Adding extension

Adding extension

Next I have to add a file association:

Added File Association

Added File Association

Now I can directly use the XML editor for CMSIS-Pack .pdsc files:

Added File Association

Added File Association

Now I have a graphical editor for my file: I can switch between the ‘Design’ and ‘Source’ view:

Editing CMSIS Pack File with Eclipse XML Editor

Editing CMSIS Pack File with Eclipse XML Editor

And best of all: I can now validate my XML files with the Schema Definition File (*.xsd):

Validating XML File

Validating XML File

And it shows me that I have a problem with my XML file (ups!):

Identified Schema Error

Identified Schema Error

So now I have to fix that issue…

Summary

Eclipse is a very versatile IDE and environment: for pretty much everything you can imagine there is a plugin. Of course as well for something for XML editing. The XML support is not included in the normal Eclipse CDT distribution for C/C++ development, but can be easily added. That way I can now produce better CMSIS-Pack files :-).

Happy XMLing :-)

Take a deep dive into Bluetooth mesh. Read the tech overview and discover new IoT innovations.

Topics:
eclipse ,xml

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}