Tutorial: Installing ERIKA and RT-Druid on a Linux host
From ErikaWiki
Introduction
This small tutorial describes the steps needed to download, compile and run a simple application showing the main features of Erika Enterprise and RT-Druid for the Microchip dsPIC DSC platform.
This tutorial has been tested on a FLEX board produced by Evidence and Embedded Solutions. Moreover, the needed software has been installed and tested on an Ubuntu 11.04 Natty Narwhal but the installation process should be adapted to almost all the other releases.
Even if all the steps needed to run an application will be depicted, a preliminary knowledge on the Microchip MPLAB X IDE and its debug environment should be useful to the reader.
Note for Linux Users
If you are using a Linux distribution please look carefully at the following warnings:
- The Evidence package installation path should NOT contain directory name with spaces. e.g. use ~/Evidence.
- The Scilab package installation path should NOT contain directory name with spaces: e.g. use ~/Evidence/scicoslab-4.4b7.
- It is strongly encouraged the adoption of the real path instead of using symbolic links and aliases.
- Please install all the Microchip compilers into their default directory (/opt/XXXX).
Prerequisites
Before proceeding with the installation process it should be useful to completely update the packages installed in you system to the latest version. To update all the packages open a Terminal window and execute the following commands:
sudo apt-get update sudo apt-get upgrade
To execute the MPLAB X IDE a 32bit JRE have to be installed. Before to proceed with the JRE installation you need to check the multiverse repository enabled. You can perform this step from the Ubuntu Software Center and select "Edit -> Software Sources...", after inserting you password you must check the "Software restricetd by copiright or legal issues (multiverse)" option; otherwise you can enable this repository by editing the source.list, to do that in a Terminal window execute:
sudo gedit /etc/apt/sources.list
Then on the gedit window uncomment the line:
deb http://archive.canonical.com/ubuntu maverick partner
by removing the "#" character, then save the file and close gedit.
Finally to install the JRE on a Terminal window insert:
sudo apt-get update sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
Please notice that by installing a 64bit JRE RT-Druid will not work properly.
Installing MPLAB X IDE
To download the the MPLAB X IDE in a Terminal window execute:
cd ~ mkdir mplab_temp cd mplab_temp wget http://ww1.microchip.com/downloads/mplab/X_Beta/mplabxidebeta32.bin wget http://ww1.microchip.com/downloads/mplab/X_Beta/mplabc18.bin wget http://ww1.microchip.com/downloads/mplab/X_Beta/mplabc30.bin wget http://ww1.microchip.com/downloads/mplab/X_Beta/mplabc32.bin chmod a+x *.bin sudo ./mplabxidebeta32.bin sudo ./mplabc32.bin sudo ./mplabc30.bin sudo ./mplabc18.bin
Please notice that this step can require few minutes depending on the downloading speed.
You can speedup this process by downloading and installing only the compiles needed by your platform.
Please remember to reboot you system after the installation of the last compiler.
At the end of the installation process either the directory and the bin files can be removed:
cd ~ rm -r mplab_temp
To enable the correct execution of the MPLAB X IDE you have to assign the correct owner to the Desktop shortcut. In a Terminal window insert:
sudo chown user:user ~/Desktop/MPLAB\ X\ IDE\ beta4.desktop
please notice that "user" must be substitued with your username on the Linux host. Moreover, the location of the file depends on the language of your installed OS, e.g. for italian people the file could be located on ~/Scrivania/MPLAB\ X\ IDE\ beta4.desktop.
Moreover, to enable MPLAB X IDE to connect with the supported programmers you must set the execution flag to the file dorun.sh
sudo chmod +x /opt/microchip/mplab_ide/ide/bin/nativeexecution/dorun.sh
For furter information on MPLAB X IDE and its supported programmers please visit
http://ww1.microchip.com/downloads/mplab/X_Beta
and/or download
http://ww1.microchip.com/downloads/mplab/X_Beta/Getting_Started_with_MPLAB-X.pdf
Installing ERIKA Enterprise and RT-Druid on Linux
To download RT-Druid you can select the correct file from the webpage:
http://erika.tuxfamily.org/erika-for-multiple-devices/betaversionerikaenterprisertdruid160.html
or simply insert in a Terminal window
cd ~ mkdir eclipse_temp cd eclipse_temp wget http://download.tuxfamily.org/erika/webdownload/rtdruid_eclipse37/eclipse_3_7_ready_to_use_LINUX.zip unzip eclipse_3_7_ready_to_use_LINUX.zip mkdir ../Evidence/ mv eclipse ../Evidence
Please notice that the download process can require few minutes depending on the downloading speed.
You can now remove the downloaded file by
cd ~ rm -r eclipse_temp
To enable a desktop shortcut to the ~/Evidence/eclipse/eclipse file you can insert in a Terminal window
ln -s ~/Evidence/eclipse/eclipse eclipse
First RT-Druid startup and configuration
By opening Eclipse you will be prompted with a window asking for the directory containing your workspace.
It should be noticed that instead of "user" your username on the linux box will be displayed. You can simply click on "Ok" and the directory "workspace" will be created in your home.
After rew seconds you will be prompted with a "Welcome" screen
To enable the updates of RT-Druid and its related distribution of Erika Enterprise select "Help -> Install New Software"
In the "Install" window
select add and enter a reference name for the file repository (e.g. RT-Druid) and the link
http://download.tuxfamily.org/erika/webdownload/rtdruid_beta
by selecting "Ok" you will be prompted with a new screen. You have to select all RT-Druid sources.
To speedup the update process you can unselect the option "Contact all site during install to find required software".
Along the update process you may be prompted for a "Security Warning" simply click on "Ok" to continue with the process. Finally please restart Eclipse when asked by the installer.
Before to be able to compile you first application you have to select the correct compiler path. As this tutorial is devoted to enable programming a Flex Demo application, the correct compiler for C24 and dsPIC must be selected. Select "Window -> Preferences"
On the "preference" window you have to select "RT-Druid -> Oil -> dsPIC" and then insert the path of the C and ASM compilers (/opt/microchip/mplabc30/v3.24/)
You can now close the "Welcome" screen by selecting "Workbench" icon
then to remove the autobuild you can uncheck "Project -> Build Automatically"Create and Compiling your first ERIKA Enterprise demo
By opening Eclipse you will be now prompted with an empty screen
to create your fist project select "File -> New -> Rt-Druid Oil and C/C++ Project"
then on the "C Project" window, insert the name of you project, e.g. my_first_project.
then click on "Next". After checking "Create a project using one of these template", select "pic30-> FLEX Demo Board -> OO examples -> Task Demo" and click on "Finish".
You will now be prompted with a screen containing all the existing project in the workspace
To build the project you can right-click on the project name and select "Build Project" from the context menu
at the end of the building process Eclipse will signal the creation of the executable file and on the left panel a "Debug" subfolder contining all the files generated will be prompted
Running your first ERIKA Enterprise demo
MPLAB X IDE is used in this tutorial to run and debug the application on the FLEX DEMO board.
By opening MPLAB X IDE you will be prompted by a "Welcome" screen
To open a new project select "File -> New Project"
in the "New Project" window you have to select "Microchip Embedded" and "Prebuilt (Loadable Image) Project", and click "Next".
on the "Import Image File" you have to select the file produced by the compiling process previously executed, in this case it is located in ~/wokspace/my_first_project/Debug_pic30.cof, by clicking on "Next"
you joint the "Select Device" window, where you have to select the correct Family and Device to be programmed. For the FLEX Demo board you have to select "DSPIC33" and "dsPIC33FJ256MC710".
To retrieve those informations you can open Eclipse, in the main project folder you can open the conf.oil. In this file you have to find the MODEL field on the MCU_DATA section.
The same information can be retrieved from the board by looking at the installed micro.
On the "Select Tool" you have to select the programmer you will use lather.
Even if we are selecting the ICD3, you have to select the programmer you are equipped with.
It should be noticed that we have correctly tested the ICD2, ICD3, and PICkit3.
In the next screen you will be asked for using a link to the loadable image or keeping the original file. As we are using a cof file, we have to select "Copy files" and clic "Next".
Finally we have to select the project name and folder, in this case we are using the default values, and click on "Next".
Please notice that the default "Project Location" and "Project Folder" are in the Debug directory of Eclipse. If you use the default values the MPLAB X IDE will be deleted if you select "Clean Project" in Eclipse.
Finally bu clicking on "Finish" the project will be created.
The project creation process can take a very long time depending on your PC and loadable image file type. We have experienced more than 20 minutes while loading the pic30.cof proposed in the tutorial in a PC with a 2.8 GHz Pentium IV and 512 MB of RAM.
At the end of the project creation process you can find the pic30 project loaded in the MPLAB X IDE main window.
To be able to program the board you must connect the programmer to the Linux host and to the board, that have to be powered by an external supply, you can then right click on the pic30 project and select "Properties",
in the "Project Properties" window you can now select the "default" category. On the right side of the window the installed programmer and its serial number will by displayed, you have to select the serial number of the programmer you are using and click on "Ok".
You have now imported the COF file inside MPLAB X IDE and select the right programmer; by right clicking on the project and select "Run" in order to program the application on the board
After few minute, depending on your Pc and on the type of the loadable image file type (cof, hex etc.), you will be prompted by a screen reporting the correct execution of the programming process.
How to use ERIKA sources from svn
In progress