Ohnitsch Cartoons Cartoons, Electronics, Acrobatics and other things.

16Jun/151

Using Eclipse instead of Keil C51 uVision for EnOcean firmware development

This article describes how to develop Firmwares for EnOcean EO3000I based modules with Eclipse.

After using the rather mediocre Keil uVision for too long for developing Firmwares for the STM3xy modules I thought that there must be a better solution, and voila, a day of work later I managed to get everything up and running with Eclipse! Finally autocomplete, indexing and all the amenities of Eclipse.

Here's how to do it:

In this example, I used the STM31x firmware sources which are available on the EnOcean website.

1. Creating the Project

Create a new C project in Eclipse (CDT must obviously be installed) and choose the STM31x project folder as existing location.

Create a new C project in Eclipse (CDT must obviously be installed) and choose the STM31x project folder as existing location

Now the project is imported, but there is a lot of work to be done.

2. Using the uVision builder

First, we need to use the uVision builder. Instead of doing everything manually, we can just tell uVision to build the whole project via command line (this has the disadvantage that you have to add files to the project in uVision, but saves a lot of hassle otherwise)
Simply create a file called build.bat in the project folder and add this:

Add build.bat as build command
3. Including the libraries

We need to include both the C51 library as well at the EO3000I API. Simply add the paths for the C51 include folder (usually C:\KEIL\C51\INC) and the EO3000I API folder under Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C.

Add the include folders

4. Adding Symbols

Since the Keil C51 compiler has a few extra keywords, we need to add those too. Also the EO3000I API contains some typedefs that we can also add to Eclipse.

pic4

_at_(A), xdata, data, idata and code are from the C51 compiler, the other ones are typedefs from the EO3000I API. To save typing, you can import this XML file here.

Important: the _at_ directive only works without a whitespace and with the brackets, so for example the line

has to be modified to

5. Handling compiler messages

For handling the error messages and integrating them into Eclipse, we need a custom Error Parser.
Go to Window –> Preferences –> C/C++ Build –> Settings and add a new Error Parser, then  add these rules:

Error Parsing Rules

Make sure to activate the parser under Properties –> C/C++ Build –> Settings for the specific project.

6. Hiding unnecessary files

Since the Project explorer now displays all the files from uVision, we can simply hide them with a few rules. Go to Properties -> Resource -> Resource Filters and add these rules under "Exclude all".

File filter rules

7. Extra Build & Upload configuration

As an added convenience, we can add another build configuration (under Properties –> C/C++ Build -> Manage Configurations). Name it for example "Build and Upload" and copy all settings from the default configuration. Change the default build command from build.bat to build_upload.bat and create the new file with the same contents as build.bat
Then create the command line for uploading your program in DolphinStudio and add that line to the batch file, for example:

Voila, your project should now compile and upload, all from within Eclipse!

Successful build!

Comments (1) Trackbacks (0)
  1. Servus Thomas.
    Coole Anleitung. Wenn ich das richtig sehe, muss man aber immer noch eine Lizenz für den Keil-Compiler installiert haben. Oder?


Leave a comment

No trackbacks yet.