Tutorial: PIC30 - Installing ERIKA and RT-Druid, and compile your first application
This small tutorial describes a set of steps needed to compile a simple application that shows the main features of ERIKA Enterprise and RT-Druid for the Microchip dsPIC DSC platform. The information covered here should be quite basic, and applicable to most of the other platforms.
This tutorial has been tested on a FLEX board produced by Evidence and Embedded Solutions and on a Microchip Explorer 16 development board from Microchip.
We presume that the reader is familiar with the MPLAB IDE debug environment provided by Microchip.
Note for Windows XP and Windows Vista users
If you are using Windows, and especially if you are using Windows Vista, please look carefully at the following warnings:
- The Evidence package installation path should NOT contain directory name with spaces. For e.g. use
- The Scilab package installation path should NOT contain directory name with spaces. For e.g. use c:/Evidence/scicoslab-4.4b7
- If using Vista, be aware that directories like c:/Programmi, c:/Users/Documenti are not REAL directories but are aliases. DO NOT USE THEM. Put your RT-Druid workspace under c:/Users/yourusername/workspace.
- Please install cygwin into its default directory, c:/cygwin.
- Also if from the Windows Vista Explorer your Microchip compiler seems to be installed under c:/Programmi/Microchip/..., please remember to specify the REAL pathname. In particular, c:/Programmi DOES NOT EXISTS, whereas the correct name is c:/Program Files.
- IMPORTANT: Always create directories under your User home directory. DO NOT USE other directories (such as C:\xxx), strange problems may happen. Note: If you are using Windows Vista, then the workspace directory c:/Users/<username>/workspace works.
Installing ERIKA Enterprise and RT-Druid on Microsoft Windows
This chapter will guide the developer on the installation procedure of ERIKA Enterprise and RT-Druid for the Microchip dsPIC DSC platform.
The installation of ERIKA Enterprise and RT-Druid is composed of following packages:
- The Eclipse development environment, which is used by RT-Druid to provide the basic development environment for ERIKA Enterprise applications.
- The Eclipse environment is based on the Java platform, so that a working Java Runtime Environment must be present for using RT-Druid.
- The RT-Druid plugins, which provide the code generation for ERIKA Enterprise for Eclipse.
- The ERIKA Enterprise source code, packaged as a set of eclipse Plugins.
- The Microchip MPLAB IDE.
- The Microchip C30 Compiler. Please install the COMBO version, not the Lite version. For example, MPLABC30ComboAcad_v3_12 works.
- A set of examples packaged as Eclipse plugins, which can be used to compile a first set of running examples for the FLEX boards, the Microchip Explorer 16 board, and others. These applications are organized in templates, available at project creation.
- A subset of the Cygwin environment, including a set of utilities like make, gawk, and few others, which are used during the compilation process of an ERIKA Enterprise application.
To install the software, execute the following steps:
- If you are using an old version see also: #Old installer (before 1.6), otherwise download from [Erika download page] the RT-Druid zip file for your OS and decompress it where you want (we suggest to avoid paths with white spaces and this tutorial assumes you choose C:\Evidence\RT-Druid)
- Install your favourite Java runtime environment, which is needed to run RT-Druid; as RT-Druid is a plugin of the Eclipse editor, which requires Java to be executed. We recommend to install the Oracle (previously SUN) Java Runtime Environment version 6 AT LEAST (not update 21: see )
- Install the latest version of the Microchip MPLAB IDE; you can use the default install directory. At the end of the install process, accept the system reboot.
- Install the Microchip C30 Compiler, available from the Microchip web site. Even in this case, you can use the default install directory. When it is asked to change the default environment, please do accept.
The rest of this tutorial assumes that the Microchip MPLAB IDE is installed within the C:\Programmi\Microchip directory and that, consequently, the GNU Assembler for Microchip dsPIC DSC is installed within C:\Programmi\Microchip\MPLAB ASM30 Suite\bin. Please note that these values may be different from the settings you have chosen on your machine. Please also read the chapter with the Windows Vista recommendations.
Old installer (before 1.6)
- Run the ERIKA Enterprise and RT-Druid installer.
- The installer will prompt a list of packages which can be installed. Select all the packages you wish to install and continue the installation procedure.
- The installer will ask for a destination directory. If possible, please use c:/Evidence
- If you are using an old version of RT-Druid installer, you should check the first line of the file evidencedir\bin\mymake_cygwin.bat (where evidencedir is the directory you chose during the installation). For example, if Cygwin is installed inside C:\cygwin, then the first line of the file should look like the following one:
...that is, the line contains the correct path to the bash.exe file in your Cygwin installation. If you accepted the default settings, the correct pathname should be C:\cygwin\bin\bash as specified in the example before.
- Note: This check can be ignored if you are planning to use RT-Druid 1.5 or newer, otherwise it is useful to perform this check because it seems that on some Windows machines the Cygwin installer does not correctly set the registry keys used by the ERIKA Enterprise installer.
First RT-Druid startup and configuration
After all the required packages have been installed, you are ready to start RT-Druid for the first time.
Please follow the next steps:
- As the first step, run the Eclipse IDE from the path you choose during the install procedure, as example C:\Evidence\RT-Druid\eclipse.exe.
- A dialog box will appear, prompting to choose the right workspace
- Warning: The workspace pathname MUST NOT contain any blank space, otherwise ERIKA Enterprise and RT-Druid may not work properly.
- Note: If you are using Windows Vista, then the workspace directory c:/Users/<username>/workspace works.
- The Eclipse Welcome screen appears. To go ahead you can click the Go to the workbench icon.
- At this point can be useful to check for updates. See Tutorial: Update ERIKA and RT-Druid
- Before being able to correctly build your application, you should set the path to the Microchip C30 compiler and the MPLAB ASM30 assembler programs. For doing so:
- please go to the ``Preference menu.
- find the RT-Druid/Oil/PIC30 Configurator form as depicted in Figure.
- The first textbox, labeled Gcc path, refers to the installation directory of the Microchip C30 compiler. The second textbox, labeled Asm path, refers to the installation directory of the ASM30 assembler provided with the MPLAB IDE.
- Note: The install directories specified in the two textboxes does not include the bin directory!
- Note: That is, c:\Programmi\Microchip\MPLAB C30 is correct, whereas c:\Programmi\Microchip\MPLAB C30\bin is not.
- Note: "Use EE .." options will be removed in RT-Druid 1.6 and should be disabled on all versions after RT-Druid and Erika 1.5.1
- Before creating and building your application, please deselect the Build Automatically flag inside the Project menu.
Compiling your first ERIKA Enterprise demo
You are now ready to compile your first ERIKA Enterprise demo. Please execute the following steps:
- Please select New Project, then RT-Druid Oil and c/c++ Project from the File menu.
- A Dialog box appear. Please select a template for the new project.
- Press Next.
- Insert the name of the new project. Please type taskdemo (you can choose other names of course). Then press the Finish button.
- We are now ready to build the demo. Right click on the project name in the Eclipse navigation bar, and choose Build Project
- Note: Build Project only appears if the Build Automatically flag is not selected in the ``Project menu.
- Then, the compilation process starts. Please note the message that appears when the compilation is successfull.
- If the error depicted in Figure appears (meaning that mymake_cygwin.bat is unable to find a file), then please follow the instructions on the Cygwin installation.
Programming the board and running the example
- At the end of the compiling process you will be able to find a file named pic30.cof inside the Debug directory inside the project.
- You are now ready to import the produced COFF file inside Microchip MPLAB IDE. To do that, open MPLAB IDE.
- Choose Import... from the File menu.
- A dialog box appear. Please select the pic30.cof file that has been produced by the compilation process in Eclipse, as shown in Figure.
- You have now imported the COFF file inside MPLAB IDE. There is no need to create a MPLAB IDE Project, because the compilation process is handled by Eclipse. The Figure shows the Disassembly Listing and the Program Memory window. Please note that MPLAB IDE correctly recognizes the debug symbols of the source code produced inside Eclipse.
- You can now start debugging the demo application using MPLAB IDE.
Note: If you get an MPLAB IDE error like the following:
ICDWarn0015: Program memory has changed since last program operation? Continue with Debug operation? Running Target ICD0083: Debug: Unable to enter debug mode. Please double click this message for more information.
Please make sure that you have entered the debug mode and programmed the device from the Debugger Mode and not from the Programmer Mode.
Note: If you are using a FLEX board, please remember to set the device correctly uinder the Configure / Select device... menu of MPLABIDE.
It is possible to use the latest version of ERIKA by downloading the source code from the repository. See ERIKA Enterprise and RT-Druid SVN Access for instructions on how to download the code. For many architectures, you can use the code from the repository by defining the environment variable ERIKA_FILES, which should point to the local copy of the ee directory (the one in trunk) in the repository. Please note that ERIKA_FILES is defined using the host style, then on Windows must be specified as a windows-style path (e.g.,
c:\erika\trunk\ee or also
c:/erika/trunk/ee on new windows versions). Almost all the architectures currently support the redefinition of ERIKA_FILES.
See also Erika path in RT-Druid