Atmel AVR5

From ErikaWiki

Revision as of 08:13, 13 July 2012 by Shiva (Talk | contribs)
Jump to: navigation, search

ERIKA Enterprise Manual for Atmel AVR5 targets

Contents

Introduction

Embedded microcontroller units are spreading in thousands of applications, ranging from single to distributed systems, control applications, multimedia, communication, medical applications and many others. Modern microcontrollers, which are growing in computational power, speed and interfacing capabilities, are more and more feeling the need of tools to make the development of complex scalable applications easier.


This manual describes the porting details of the Erika Enterprise kernel for the AVR family of microcontrollers. The AVR family produced by Atmel represents a widely used 8-bit RISC microcontroller, with a full range of interfaces available.



Erika Enterprise and RT-Druid for AVR

Embedded applications often require tight control on the temporal behavior of each single activity in the system. The research in the field of real-time systems brought the team of Evidence Srl to design a small, efficient, modular real-time kernel that can be used to easily guarantee real-time constraints in every embedded applications.

Erika Enterprise and RT-Druid represent the answer of Evidence Srl for the development of scalable real-time applications for the AVR family.


Erika Enterprise provides AVR developers the following features:

Traditional RTOS features

  • Support for four conformance classes to match different application requirements;
  • Support for preemptive and non-preemptive multitasking;
  • Support for fixed priority scheduling;
  • Support for stack sharing techniques, and one-shot task model to reduce the overall stack usage;
  • Support for shared resources;
  • Support for periodic activations using Alarms;
  • Support for centralized Error Handling;
  • Support for hook functions before and after each context switch.


RT-Druid development environment

  • Development environment based on the Eclipse IDE;
  • Support for the OIL language for the specification of the RTOS configuration;
  • Graphical configuration plugin to easily generate the OIL configuration file and to easily configure the RTOS parameters;
  • Full integration with the Cygwin development environment to provide a Unix-style scripting environment;
  • Apache ANT scripting support for code generation.


AVR integration features:

  • Installation setup which integrates the AVR gcc compiler and AVRStudio together with Evidence Erika Enterprise and RT-Druid;
  • Support for the Atmel JTAG debugger;
  • Full support for AVR microcontroller series avr5;
  • Full support for the development boards Atmel STK50X boards;
  • Full support of the RF230 RF solution from Atmel, with usage of the IEEE 802.15.4 MAC.
  • Full support for Crossbow MIB5X0 boards used to program Mica motes.



Integration with other tools for AVR

Erika Enterprise and RT-Druid aims to the best integration with the existing tools for development available from the AVR microcontrollers.

RT-Druid will be used to quickly configure the application, setting temporal parameters of real-time tasks, memory requirements, stack allocation and many other parameters.

RT-Druid generates the application template, and leaves the developer the task to implement the logic of each single task.

While programming the application, the developer can exploit the power and flexibility offered by the primitives of the Erika Enterprise real-time kernel.

Erika Enterprise also supports the compiling environments provided by Atmel, providing also direct support for the programming and JTAG solutions of Atmel.



Content of this document

The purpose of this document is to describe all the information needed to create, develop and modify an Erika Enterprise application for the AVR family of microcontrollers.

In particular, the document describes:

  • The design flow which should be used to generate an Erika Enterprise application;
  • The configuration of the development environment;
  • The options which are available to configure the system.

As a final note, all the settings which are explained in this document apply both to Erika Enterprise if not otherwise stated.

Note: If you are looking for a step-by-step / quick guide tutorial on how to use Erika Enterprise and RT-Druid with AVR,
please read the “Erika Enterprise Tutorial for the AVR microcontrollers”, available for download on the Evidence Web site.

Erika Enterprise for AVRdevices

The RT-Druid and Erika Enterprise design flow

The typical development environment provided by Atmel for the software development for the AVR microcontrollers is composed by the Atmel AVR Studio. Atmel AVR Studio is a development environment for Microsoft Windows which integrates a source code editor, an instruction set simulator and a debugger.

In addition to the traditional development flow, Evidence Srl provides a design and configuration environment named RT-Druid, based on Eclipse. Eclipse is an open framework initially developed by IBM, which allows the possibility of integrating various development tools in a common environment.

For that reason, when developing an application for Erika Enterprise the user is supposed to write the source code inside the RT-Druid IDE (see Figure 2.1).

Application compilation is also done inside the Eclipse Framework. In fact, the RTDruid code generator is able to generate the Erika Enterprise configuration files together with a set of configuration files (typically, a makefile plus a set of .c files) which are then used to compile the source code.

After that, compilation is started automatically by pressing on the “Build Project” menu item inside the “Project” menu, which automatically calls the underlying make application provided by the Cygwin environment. As an alternative, the “Build Project” command is also available by right clicking on the project name.

The choice of the Cygwin environment has been done to simplify the building process of an application: in fact, Cygwin provides a set of traditional Unix tools like make, awk, sed, which are really useful to implement a command line application building framework. Moreover, these tools are typically available for free on the Linux platform, easing in this way the porting of the application to a free development environment such as Linux.



Building an application from command line

The RT-Druid plugins provide three ways to develop an application:

  1. A graphical interface to simplify the development of an application, based on Eclipse.
  2. A scripting interface based on Apache ANT, which is the default scripting environment used in the Eclipse Framework.
  3. A standalone code generator, that does not use Eclipse.


Figure 2.1: The Eclipse workspace and the RT-Druid plugins for AVR.


Using ANT or the standalone version, the developer can automatically generate from scripts the configuration data and the makefiles which are then used to compile the application. This removes the need of opening the graphical environment to compile an application, providing a way to implement automatic compilation scripts and regression tests.

Please refer to the RT-Druid reference manual for information about ANT scripting.

Setting up the compiling environment for AVR

Writing software for AVR using Erika Enterprise

Avoid the generation of dependency files

Avoid the generation of .src files from C files

Printing the commands executed (verbose mode)

Source files composing an application

Stack handling

Interrupt handling

EE_IC_enable_external_IRQ

EE_IC_clear_pending_IRQ

AVRtimers

EE_timer_initx

EE_timer_x_start

EE_timer_x_stop

EE_timer_x_get

Configuring a particular AVR microcontroller

Configuring the EDF scheduler

Atmel STK500/1 Board

Introduction

LEDs

EE_led_1_on

EE_led_1_off

EE_led_2_on

EE_led_2_off

EE_led_3_on

EE_led_3_off

EE_led_4_on

EE_led_4_off

EE_led_5_on

EE_led_5_off

EE_led_6_on

EE_led_6_off

EE_led_7_on

EE_led_7_off

EE_led_8_on

EE_led_8_off

Crossbow MIB5X0 Board

Introduction

LEDs

EE_led_1_on

EE_led_1_off

EE_led_2_on

EE_led_2_off

EE_led_3_on

EE_led_3_off

Atmel AVR5 ATmega128 and ATmega103

Introduction

Wireless Sensor Networks are nowadays deployed in academic and industrial environments. The very limited set of resources available in the popular hardware platforms, and the diversified domains of WSN applications, require the adoption of an Operating System responding to the following pre-requisites:

- minimum footprint to fit the limited RAM capacity (of the order of few KB); - tunable scheduling algorithm to handle the execution of the tasks; - an application interface acting on the kernel layer and well decoupled from OS service implementation.

Many WSNs are deployed making use of AVR 5-based sensor boards like those commercialized by CrossBow Inc.



Erika Enterprise and RT-Druid for Atmel AVR ATmega128

Embedded applications often require tight control on the temporal behavior of each single activity in the system. The research in the field of real-time systems brought the team of Evidence Srl to design a small, efficient, modular real-time kernel that can be used to easily guarantee real-time constraints in every embedded applications.

Erika Enterprise and RT-Druid represent the answer of Evidence Srl for the development of scalable real-time applications for the Atmel AVR5 family.

The main features of ERIKA Enterprise and RT-Druid which are specific for Atmel AVR are the following:

  • Installation setup of Evidence Erika Enterprise + RT-Druid;
  • Full support for the AVR-GCC compiler distributed inside WinAVR;
  • Full support of the AVRStudio IDE;
  • Full support for the Atmel JTAG ICE MKII debugger;
  • Full support for Atmel AVR5 ATmega128 and ATmega103 (in compatibility mode) ;
  • Support for the Atmel 802.15.4 (ZigBee) wireless communication protocol;
  • Support for the Atmel STK500/501 development board;



Integration with Atmel corp. products

Erika Enterpise and RT-Druid aims to the best integration with the existing tools for development available from Atmel corp.

RT-Druid will be used to quickly configure the application, setting temporal parameters of real-time tasks, memory requirements, stack allocation and many other parameters. RT-Druid generates the application template, and leaves the developer the task to implement the logic of each single task.

While programming the application, the developer can exploit the power and flexibility offered by the primitives of the Erika Enterprise real-time kernel.

The application which are generated from RT-Druid and ERIKA Enterprise can be imported into Atmel AVRStudio and can be flashed into the microcontroller memory using the JTAG ICE MKII or the included free UISP tool.



Requirements

Erika Enterprise supports Atmel AVR5 ATmega128 and ATmega103 (setting the fuse of compatibility mode in ATmega128).

The following table lists the requirements upon external programs.

There is no guarantee our software will work if you install a different version from what is listed in the table below.

  • ERIKA Enterprise version 1.4.2.2 and 1.5.0
    • AVR Studio 4.12
    • WinAVR

Useful links

Personal tools