TWiki home TWiki > WSensornets > DancingEBugs TWiki webs:
Main | TWiki | Know | Sandbox
WSensornets . { Changes | Index | Search | Go }

Dancing E-Bugs: Real-Time Control over Wireless Links

Dancing E-Bugs: Real-Time Control over Wireless Links

This page is a collection of information about the Dancing E-Bugs project, but primarily it is a quick 'how-to' get the MicroC-OSII environment up and running on an ATMEL ATMega128 device (or any other capable ATMEL), under Windows.

Software required, and where to get it

uc-OS-II-logo.gif

uC/OS-II sourcecode and 'port' files

The uC/OS-II sourcecode is available on the CD that comes with MicroC/OS-II : the real-time kernel by Jean Labrosse (search for it at the library). I used version 2.60, which is the minimum I would recommend (the CD also has an older version, which has a few substantial differences.)

You can also try downloading the latest version from http://www.micrium.com/products/rtos/kernel/rtos.html, though I haven't tried it and do not know what the differences are.

The 'port' files customize the OS to run on a particular hardware (the book, for instance, is targeted towards desktop Intel processors). They are also available at the Micrium website, in the ports section at http://www.micrium.com/atmel/AVR.html. I used the port by Julius Luukko: you'll need one for the GNU GCC Compiler.

AVRstudio.jpg

AVR Studio 4

This is not strictly necessary, it just provides a GUI for the compiler and the programmer, as well as a (somewhat dodgy) text editor for writing C / Assembly. It is available for free from the Atmel Website, after registration, and is worth having.

winavr.jpg

WINAVR Source Files

WINAVR is a collection of libraries tools for writing ATMEL AVR software in Windows, including the GCC compiler. You can use it directly from the command line after adding some variables to the Windows PATH variable (for masochists) or you can just point AVR Studio to it's location, and let AVR Studio handle producing make files and linking to headers etc. Get it at http://winavr.sourceforge.net.

n.jpg

Notepad++

This is completely unnecessary, but at the same time essential! :D The built in text editor in AVR Studio is awful, especially for editing large text files. If you want something a little bit more upmarket, get a copy of this open source text editor, or if you've already got a favourite, use that! http://notepad-plus.sourceforge.net/.

David's eBugs Project Sources

They are here. For further details check DavidMcKechnie's thesis report.

Hardware Required

Development board

If you're reading this, I imagine you've already got a project so there isn't much to put here. A few thoughts if you're designing a PCB:

Programmer

I used an Atmel AVR-ISP mk2 programmer to program the board, but apparently you can do ISP by hacking a level shifting board together yourself (try google, if you like). You can get the programmer from a number of places, mine was from Digikey (http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=ATAVRISP2-ND). Alternatively, a JTAG interface like the AVR JTAGICE would be nice if you're feeling wealthy :D.

Installation and Folder Layout

Install the software wherever you want to. I ended up with
C:\Program Files\Atmel\AVR Tools
and C:\Program Files\Atmel\WinAVR\
... it doesn't really matter. The uC-OS2 folder structure is a little awkward, perhaps. Usually it ends up installed in something like C:\Micrium\uCOS-II\etc etc. I much prefer to keep it with the particular project it's attached to rather than a central location. That way, if I modify any of the #defines they only affect this project. So, I keep
C:\Users\David\AVRProj\ projectname \uCOS-II\SOURCE for the uC-OS2 source files and C:\Users\David\AVRProj\ projectname \uCOS-II\ATMega128 for the port files.

Creating your project!

In AVR Studio, create a new project. Choose AVR GCC (if you can't see it / use it, you haven't got Win AVR installed somewhere acceptable). Choose the ATMEGA128 from somewhere in the platform list, and click Finish.

includes.png

Find the folder, and copy all the files mentioned above into it, in some subdirectories as described. Then right click on Source Files in the project structure, and add existing source files. Add everything shown in the image above (uCTest.c is my project name/ initial file, so you won't have that). Do the same for headers. The external dependencies will appear after you compile successfully, depending on what features you use in the ATMEL device.

folders.png

Then click Project->Configuration Options. Check the device is correct, and set the frequency (it gives you a #define you can use, I think it is F_OSC). Click on Include Directories, and make sure you have all the directories in the image above. Particularly important is the .\ directory: that's the project directory! It seems stupid, but if you don't have this there, you can't refer to header files in the main directory!

Modifications required to the source files

A few minor changes are needed.

ucos_ii.c

Just change all the #include s to look like this:

#include "os_core.c"
#include "os_flag.c" etc

includes.h

Getting the demo file to run

I don't remember the complete steps, but here's a few hints on getting Julius Luukko's demo program runnning:

Documents

Topic DancingEBugs . { Edit | Attach | Ref-By | Printable | Diffs | r1.8 | > | r1.7 | > | r1.6 | More }
Revision r1.8 - 17 Mar 2009 - 03:13 GMT - AhmetSekercioglu
Parents: WebHome
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.