Tutorial: Avr5 - First installation and application compilation on Windows

From ErikaWiki

Jump to: navigation, search


RT-Druid and Erika Enterprise tutorial for AVR5 4

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 AVR platform.

This tutorial has been tested on a STK50X board produced by Atmel and on a Crossbow Mib520 board.

Installing Erika Enterprise and RT-Druid on Microsoft Windows 5

This chapter will guide the developer to the installation procedure of Erika Enterprise and RT-Druid for the AVR platform.

The Cygwin install pathname, the Erika Enterprise install pathname, and the pathname of RT-Druid workspaces
where the user projects reside, MUST NOT contain any blank space, otherwise Erika Enterprise may not work properly.

E.g., C:\MyApplications\Evidence\ and C:\MyApplications\Cygwin\ are acceptable,
while C:\My Applications\Evidence\ or C:\My Applications\Cygwin\ MUST be avoided.

This is a known issue that will soon be fixed.

The installation of Erika Enterprise and RT-Druid is composed by the 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 and Erika Enterprise for Eclipse.
  • The Erika Enterprise source code.
  • 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.
  • A set of examples for the AVR Platform, which can be used to compile a first set of running examples for the Atmel STK50X board, the Crossbow MIB5X0 board. These applications are organized in “templates”, available at project creation.

To install the software, execute the following steps:

  • Install your favourite Java runtime environment, which is needed to run RT-Druid; in fact, RT-Druid is a plugin of the Eclipse editor, which requires Java to be executed.
  • Install the AVR-Gcc Compiler, available from theWinAVR sourceforge.net project at the website http://winavr.sourceforge.net/. Even in this case, you can use the default install directory. When it is asked to change the default environment, please do accept.
  • 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 (see Figure 2.1).
Figure 2.1: This screenshot shows the dialog box with the available install packages.
  • At this point, please 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:
@set EE_BASH_PATH=C:\ cygwin \ bin\ bash
...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.
We ask 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.
  • If you are going to use the Atmel stk50x or the Crossbow Mib5x0 boards, you can use the UISP programmer to program the AVR microcontroller. To Install the UISP software, which is an AVR In-system Programmer using the USB connection provided by the boards cited above, please follow the instructions below:

The rest of this tutorial supposes that the AVR-Gcc Compiler and binutils is installed within the C:\WinAVR-20071221\bin directory. Please note that these values may be different from the settings you have chosen on your machine.

First RT-Druid startup and configuration 8

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 Evidence menu inside the Start menu of your Windows machine, choosing Start/Programs/Evidence/RT-Druid.
  • A dialog box will appear, asking to choose the right workspace (see Figure 3.1). Leave the default workpackage directory as it is, and proceed by pressing “OK”.
Figure 3.1: This screenshot shows the dialog box for the choice of the current workspace directory.
The workspace pathname MUST NOT contain any blank space, otherwise Erika Enterprise and RT-Druid may not work properly.
  • The Eclipse Welcome screen appears, like in Figure 3.2.
Figure 3.2: The Eclipse Welcome screen.
  • Before being able to correctly build your application, you should set the path to the AVR-Gcc compiler. For doing so, please go to the “Preference” menu, as shown in Figure 3.3, and find the “RT-Druid/Oil/Avr5 Configurator” form as depicted in Figure 3.4. The first textbox, labeled Gcc path, refers to the installation directory of the AVR-Gcc compiler. The second and third textboxes are useful if you are using a development environment based on the Crossbow Mib5x0 board. In particular, the second textbox, labeled Uisp path, refers to the installation directory of the uisp programmer for Crossbow Mib5x0 board, and the third textbox, labeled Serial port device, refers to the COM serial port where the board is attached.
Figure 3.3: Go to the “Preference” menu.
The install directories specified for the AVR-Gcc Compiler in the textboxes of Figure 3.4 does not include the bin directory!
That is, c:\WinAVR-20071221 is correct, wheras c:\WinAVR-20071221\bin is not.
Figure 3.4: Select paths for compiler and assembler.
  • Before creating and building your application, please deselect the “Build Automatically” flag inside the “Project” menu, as shown in Figure 3.5.
Figure 3.5: Deselect the “Build Automatically” flag in the “Project” menu.

Compiling your first Erika Enterprise demo for AVR5

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”, as in Figure 4.1.
Figure 4.1: Select “New project” from the “File” menu.
  • A Dialog box appear. Please select a template for the new project, as in Figure 4.2.
Figure 4.2: Select a template for your project.
  • Press “Next”.
  • Insert the name of the new project. Please type myProject (you can choose other names of course). Please see Figure 4.3. Press the “Finish” button.
Figure 4.3: Type a name for the new project
  • We are now ready to build the demo. Right click on the project name in the Eclipse navigation bar, and choose “Build Project” (see Figure 4.4).
Figure 4.4: We are now able to build the project.
“Build Project” only appears if the “Build Automatically” flag is not selected in the “Project” menu.
  • Then, the compilation process starts as depicted in Figure 4.5. Please note the message that appears when the compilation is successfull.
Figure 4.5: The compilation process.
If the error depicted in Figure 4.6 appears (meaning that mymake_cygwin.bat is unable to find a file),
then please follow the instructions at the last point of Chapter 2.
Figure 4.6: An error that shows up on some Windows machines. Please check the mymake_cygwin.bat file as explained in the last point of Chapter 2.
  • At the end of the compiling process you will be able to find a file named avr.elf and a file named avr.srec inside the Debug directory inside the project, as shown in Figure 4.7 and in the figure 4.8.
Figure 4.7: The output file is ready to be programmed on the target board.
Figure 4.8: The output file is ready to be programmed on the target board.
  • You can now program the device using avr5 programmer as shown in Figure 4.9 and in Figure 4.10. Please remember that you have to connect ISP6PIN plug of the STK500 with the SPROG plug of the STK501 through 6-wires cable.
Figure 4.9: Program the Flash memory of the device.
Figure 4.10: Program the Flash memory process.
Personal tools