De Wikidroids

Return to Aversive

This is currently more a FAQ than a devguide.


Is there a documentation for Aversive modules ?

huh... nearly. Have a look in Aversive/Modules, instead the code is also a good documentation ;)

How to create a new project using Aversive ?

  • Create a directory for your project
  • Create a Makefile
cp $(AVERSIVE_DIR)/mk/Makefile_project.template Makefile

Edit the Makefile and customize the following values :

AVERSIVE_DIR = # VALUE, absolute or relative path to the root of aversive
SRC = $(TARGET).c another_file.c another_file2.c 

You can see examples in Makefiles located in $(AVERSIVE_DIR)/modules/.../test directories. Warning : check that you don't have space chars after you variables declarations.

  • Create your sources file (*.c).

One of your file must have a main() function.

  • Configure aversive

In an aversive project, you need an .config file, that describes which options are enabled (like in the linux kernel).

Two files are generated from it : .aversive_conf and autoconf.h :

.aversive_conf is included in the project Makefile autoconf.h file is included in base/utils/utils.h

If you want to edit something by hands, you should not edit .aversive_conf or autoconf.h, but .config... Don't worry, you won't have to edit this .config file by hands since there are configure scripts. So just run :

make config

Then answer to the questions. You can answer '?' if you want some help. Note that if you have the libncurses installed, you can prefer doing :

make menuconfig

There is another way to configure :

make noconfig

This will create a .config file if it does not exists. You can edit it by hand, and run back 'make noconfig' to update your .aversive_conf and autoconf.h

  • Build your project
  • Program your target
make program

How to integrate a new module ?

For French speakers this documentation explain the process step by step : How to add a module and a project in Aversive (FR)

  • The place for a new module is in the $(AVERSIVE_DIR)/modules/dev directory
  • A module name is composed of small letters and underscore.
  • The default configuration (if any) is stored in the config directory. This file name is {modules_name}_config.h .
  • A module is documented in the "doc" directory. The documentation is preferably in a txt file, but can be in pdf or html.
  • Think of what is the best path to include your module (have a look at aversive source tree section in Aversive page)
  • Add the test project to the HEAD makefile, by modifying the PROJECT_DIRS variable.
  • update config/generate_aversive_config

There is a module list that is ordered.

  • update config/config.in (be aware of dependencies)
  • update config/Configure.help, according to config.in

This file contain an help text paragraph for each aversive option. The syntax of the file is briefly described at the beginning of this file.

  • update .config in config

This file propose a default choice for a project that runs a "make *config" without a .config file in the project dir. It should contain a line for each CONFIG_* that exists in config.in

CVS informations

If you want to develop in Aversive, you can submit your patchs to avr-list@droids-corp.org. The preferred way to generate a patch is:

diff -Nrup aversive_orig aversive_patched > aversive_add_small_description_here.diff

Be sure that you don't include garbage in your patch. You can use the diffstat tool to check it:

diffstat aversive_pouet.diff

Some people also maintain a specific branch of Aversive for specific developments. You can ask for it on the mailing list if you think you need it.

There is no anonymous login for CVS.


making a diff with another branch :

cvs -q diff -up -r microb | diffstat

merging head modifications into tof :


How to add the support for a new AVR device ?

Edit the $(AVERSIVE_DIR)/config/config.in, you should add the new device folowing this syntax :

AT90s2313      CONFIG_MCU_AT90S2313  \

Take care of don't let any space after the '\'. Take care of be up to date for gcc-avr, avr-libc and binutils.

Some coding convention

We try to respect these convention, as much as possible.

  • each file begin with the licence.
  • a header file starts (after the licence) with :
#ifndef _FOO_BAR_H_
#define _FOO_BAR_H_

The convention is replace each special char by '_', and put one '_' on the left and on the right of the word. Some examples :

foo.x.h -> _FOO_X_H_
utils-irq_config.h -> _UTILS_IRQ_CONFIG_H_
  • variable names are in small letters, and words can be separated by underscores ('_'). Examples :
  • global variables names begin with "g_". Example
  • global functions/variables must be static if they are not used in another file.
  • don't forget to specify the keyword volatile for a variable, if it need to.

How to install avr-libc ?

Go here if you have trouble to install AVR-libc

How can I debug an AVR with JTAG ?

See our HW tutorial for JTAG

Boîte à outils