Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed
#================#| AVR-lib readme |#================#Requirements~~~~~~~~~~~~Recent versions of avr-gcc, avr-libc and binutils-avr. A POSIX compliant shell(/bin/sh), GNU make and GNU awk. Linux platforms are the safe bet, MacOS X andMS Windows are untested and probably need tweaking.Instructions~~~~~~~~~~~~These instructions will help you to set up AVR-bios on a new node and createan application template. The template demonstrates how to use AVR-biosfunctions to communicate on the CAN bus, and how to use AVR-lib code in yourown projects. It is recommended to use the template as a starting point whencreating a new project. The template is also neccessary even if you are goingto use a finished project from somewhere else, since it contains nodespecific information on how to call AVR-bios functions. The applicationspecific files in the template can be replaced with the corresponding filesfrom the external project.1. Checkout or update the avr-lib tree from svn if it's not already done.2. Edit system.inc to fit your method of uploading via ISP. This only needs tobe done once. The purpose of system.inc is to keep system specificparameters out of Makefile so it can be properly versioned.3. Edit config.inc to fit the node hardware you are setting up. Make sure youpick an unused NODE_ID, from 1 to 254. At some point in the future, thiswill probably be allocated automagically from a node database. But for nowset it manually. This needs to be done for each new node you are settingup.4. Build AVR-bios. The simple way is to run `make', which will createeverything you need. Other useful make targets are:`make lst' Builds bios.elf, bios.map and bios.lst but skipslibbios and the other template files. Good duringbios development.`make clean' Cleans everything that can be rebuilt. Do thisbefore committing any changes in AVR-bios.`make cleanintermediate' Removes all files produced during build which arenormally useless once the build is done. This isdone in the default rule.`make template' Prepares the template directory. Please note thatthe template files created are meaningless unlessused together with a bios built at the same time.5. Connect your ISP to the node and run `make install' to upload the bios tothe empty node. If the node already has a working AVR-bios it's possible toupdate it to a new version without ISP. Unfortunately the PC tools toautomate this hasn't been written yet. Expect a future `make reinstall'.6. Copy the template directory to a directory of your choice. Place it in thesame parent directory as avr-lib if you don't want to fiddle with paths inthe Makefile. `cp -r template ../myapp' will do the trick, if your currentdirectory is avr-lib.7. Change to the application directory you created. This is now a stand-aloneapplication for the exact node you just prepared. By stand-alone i mean ithas all information it needs to cooperate with AVR-bios on the node. Itprobaly still depends on the AVR-lib source tree to exist, but that treecan be updated without breaking anything in the app-bios interface. Pleasenote that this directory cannot be reused for another node, not even onewith the same configuration, since the NODE_ID must differ. Currently it'sone directory - one node. This may change in the future when node info isstored in a database.The files in the application dir arebios.h - generated file containing AVR-bios interface declarations andCAN data structuresbios.inc - generated file containing node specific configurationconfig.inc - application specific configurationlibbios.a - library archive containing the AVR-bios interface, i.e. theROM-addresses of the bios functions in the node. Does notcontain any actual code, since that is already in the node'sflash.main.c - main application codeMakefile - application makefile, currently needs to be edited to selectwhich AVR-lib drivers to compile8. Edit config.inc to suit your application. This file is used together withbios.inc to generate config.h as part of the build process. config.h is inturn included by all AVR-lib drivers to set parameters.9. Build the application with `make'. You'd better run a `make clean' first todelete old object files that may lie around from other builds. Object filesfrom AVR-lib code should be built in the application dir instead of in theAVR-lib source tree, but currently they're not.10. Upload the application over CAN. Currently the only existing PC tool forthis can not be scripted so it has to be run manually. Expect a`make install' to work when the canManager tool is ready.