Rev 361 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 361 | Rev 367 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 | 4 | ||
| 5 | Requirements |
- | |
| 6 | ~~~~~~~~~~~~ |
- | |
| 7 | - | ||
| 8 | Recent versions of avr-gcc, avr-libc and binutils-avr. A POSIX compliant shell |
- | |
| 9 | (/bin/sh), GNU make and GNU awk. Linux platforms are the safe bet, MacOS X and |
- | |
| 10 | MS Windows are untested and probably need tweaking. |
- | |
| 11 | - | ||
| 12 | Instructions |
- | |
| 13 | ~~~~~~~~~~~~ |
- | |
| 14 | - | ||
| 15 | These instructions will help you to set up AVR-bios on a new node and create |
- | |
| 16 | an application template. The template demonstrates how to use AVR-bios |
- | |
| 17 | functions to communicate on the CAN bus, and how to use AVR-lib code in your |
- | |
| 18 | own projects. It is recommended to use the template as a starting point when |
- | |
| 19 | creating a new project. The template is also neccessary even if you are going |
- | |
| 20 | to use a finished project from somewhere else, since it contains node |
- | |
| 21 | specific information on how to call AVR-bios functions. The application |
- | |
| 22 | specific files in the template can be replaced with the corresponding files |
- | |
| 23 | from the external project. |
- | |
| 24 | - | ||
| 25 | 1. Checkout or update the avr-lib tree from svn if it's not already done. |
- | |
| 26 | - | ||
| 27 | 2. Edit system.inc to fit your method of uploading via ISP. This only needs to |
- | |
| 28 | be done once. The purpose of system.inc is to keep system specific |
- | |
| 29 | parameters out of Makefile so it can be properly versioned. |
- | |
| 30 | - | ||
| 31 | 3. Edit config.inc to fit the node hardware you are setting up. Make sure you |
- | |
| 32 | pick an unused NODE_ID, from 1 to 254. At some point in the future, this |
- | |
| 33 | will probably be allocated automagically from a node database. But for now |
- | |
| 34 | set it manually. This needs to be done for each new node you are setting |
- | |
| 35 | up. |
- | |
| 36 | - | ||
| 37 | 4. Build AVR-bios. The simple way is to run `make', which will create |
- | |
| 38 | everything you need. Other useful make targets are: |
- | |
| 39 | - | ||
| 40 | `make lst' Builds bios.elf, bios.map and bios.lst but skips |
- | |
| 41 | libbios and the other template files. Good during |
- | |
| 42 | bios development. |
- | |
| 43 | `make clean' Cleans everything that can be rebuilt. Do this |
- | |
| 44 | before committing any changes in AVR-bios. |
- | |
| 45 | `make cleanintermediate' Removes all files produced during build which are |
- | |
| 46 | normally useless once the build is done. This is |
- | |
| 47 | done in the default rule. |
- | |
| 48 | `make template' Prepares the template directory. Please note that |
- | |
| 49 | the template files created are meaningless unless |
- | |
| 50 | used together with a bios built at the same time. |
- | |
| 51 | - | ||
| 52 | 5. Connect your ISP to the node and run `make install' to upload the bios to |
- | |
| 53 | the empty node. If the node already has a working AVR-bios it's possible to |
- | |
| 54 | update it to a new version without ISP. Unfortunately the PC tools to |
- | |
| 55 | automate this hasn't been written yet. Expect a future `make reinstall'. |
- | |
| 56 | - | ||
| 57 | 6. Copy the template directory to a directory of your choice. Place it in the |
- | |
| 58 | same parent directory as avr-lib if you don't want to fiddle with paths in |
- | |
| 59 | the Makefile. `cp -r template ../myapp' will do the trick, if your current |
- | |
| 60 | directory is avr-lib. |
- | |
| 61 | - | ||
| 62 | 7. Change to the application directory you created. This is now a stand-alone |
- | |
| 63 | application for the exact node you just prepared. By stand-alone i mean it |
- | |
| 64 | has all information it needs to cooperate with AVR-bios on the node. It |
- | |
| 65 | probaly still depends on the AVR-lib source tree to exist, but that tree |
- | |
| 66 | can be updated without breaking anything in the app-bios interface. Please |
- | |
| 67 | note that this directory cannot be reused for another node, not even one |
- | |
| 68 | with the same configuration, since the NODE_ID must differ. Currently it's |
- | |
| 69 | one directory - one node. This may change in the future when node info is |
- | |
| 70 | stored in a database. |
- | |
| 71 | - | ||
| 72 | The files in the application dir are |
- | |
| 73 | - | ||
| 74 | bios.h - generated file containing AVR-bios interface declarations and |
- | |
| 75 | CAN data structures |
- | |
| 76 | bios.inc - generated file containing node specific configuration |
- | |
| 77 | config.inc - application specific configuration |
- | |
| 78 | libbios.a - library archive containing the AVR-bios interface, i.e. the |
- | |
| 79 | ROM-addresses of the bios functions in the node. Does not |
- | |
| 80 | contain any actual code, since that is already in the node's |
- | |
| 81 | flash. |
- | |
| 82 | main.c - main application code |
- | |
| 83 | Makefile - application makefile, currently needs to be edited to select |
- | |
| 84 |
|
5 | Updated documentation of AVR-lib resides at |
| 85 | - | ||
| 86 | 8. Edit config.inc to suit your application. This file is used together with |
- | |
| 87 | bios.inc to generate config.h as part of the build process. config.h is in |
- | |
| 88 | turn included by all AVR-lib drivers to set parameters. |
- | |
| 89 | - | ||
| 90 | 9. Build the application with `make'. You'd better run a `make clean' first to |
- | |
| 91 | delete old object files that may lie around from other builds. Object files |
- | |
| 92 |
|
6 | http://www.arune.se/projekt/doku.php?id=homeautomation:software:embedded:avrlib |
| 93 | AVR-lib source tree, but currently they're not. |
- | |
| 94 | - | ||
| 95 | 10. Upload the application over CAN. Currently the only existing PC tool for |
- | |
| 96 | this can not be scripted so it has to be run manually. Expect a |
- | |
| 97 | `make install' to work when the canManager tool is ready. |
- | |