Project:HUGnet Endpoint Firmware
From HUG Wiki
Contents |
The endpoint firware project encompases all of the AVR based circuit boards that we have created. This include the controller board, and all versions of the endpoints. This is all encompassed into one project because a significant portion of the code is reused between the platforms.
Code Documentation
The code is documented here
Building Executables
Required Toolchain
- binutils Assembler, Linker, Et al
- gcc C compiler
- AVR Libc C library
- GNU Make This is a building aid
- AVRDude Device Programmer
Binutils and gcc should be compiled for the AVR target. The final executables should be called avr-gcc for the C compiler, avr-as for the assembler, and avr-ld for the linker. There will be other programs as well, but those are the main ones. The only other manditory one is avr-objcopy. That changes the raw binary executable that is created into a Motorola s-record file that the programmer can use. For Win32 these will have to be built using cygwin.
GNU Make comes with most posix compliant systems. This includes cygwin and Linux. Freebsd has its own version of make. I have not tested to see if it is compatible or not. GNU Make is available in the ports collection of FreeBSD. If you use this just substitute 'gmake' for 'make' in all the examples.
AVRDude is available for Linux, FreeBSD and Win32.
I have not tried to use WinAVR, but it does use the correct compiler, assembler, and libraries.
Commands to build the firmware
This is a sample session for building and installing the firmware (your device should be attached to the programmer):
# cd 01_003921 # make <Lots of output> # make install <More output>
That is all.
Targets
The directories in the endpoint firmware project are put together from an incrementing number (the first two digits) and the first 6 digits of the hardware part number that they are for. So 01_003921 is the first firmware project and it is for the 0039-21 Controller Board.
- 01_003921 Controller Board Main program.
- 02_003912 Moisture sensor
- 03_003912 Temperature sensor
- 04_003912 Fan controller
- 05_003912 No longer used
- 06_003921 Controller Board Boot program.
- 07_003912 Capacitive sensor
- 08_003912 No longer used
- 09_003912 No longer used
- 10_003928 Display Endpoint
- 11_003912 No longer used
- 12_003928 Pulse Counter
- 13_003928 Generic Sensor Board
Common
This folder contains all of the generic stuff that is used by many of the different pieces of firmware.
The following must be done to put any of these files into your project:
- Put the filename of the .S or .c file into the OBJECT_FILES variable in your Makefile. Replace the .S or .c of the filename with .o
- Put the filename of the corresponding .h file into HEADER_FILES. This filename should not be altered.
- Put the line "#include 'filename.h'" into your C files that will need to call anything from the files.
Required Modules
Some of the things in this folder MUST be included in any project. They are:
- endpoint.h
- The EEProm module
- One of the HUGnet modules (min or multi)
- One of the Packet modules (min, norm, or multi)
- packetcomm.h
- The output module
EEProm
- eepromcommon.S
- Defines the E2 memory that is common among all endpoints.
- eepromcommon.h
- Header file for the EEProm module.
Boot Loader
- bootloader.c
- The generic bootloader code. This goes into any program that wants to be a bootloader.
- bootloader.h
- Header file for the bootloader code.
HUGnet
- hugnet_min.c
- Minimum HUGnet. This is everything HUGnet needs to be to talk out one interface. This is the default
- hugnet_min.h
- header file for the minimum HUGnet
- hugnet_multi.c
- Multiple interface HUGnet. This is for HUGnet on multiple interfaces. This is used on the controller board firmware.
- hugnet_multi.h
- header file for the multiple interface HUGnet.
Output
- output_norm.c
- This module is for writing to the output array that will get sent to the data collector when a 'read sensors' command is received.
- output_norm.h
- Header file for the output module.
Packet Structure
- packet_min.c
- Absolute minimum packet structure. This is to be used when space is at a premium. This is the default for 0039-12 endpoints This will talk out only a single hugnet_min interface. hugnet_min is required to be used with this one.
- packet_min.h
- header file for the minimum HUGnet module
- packet_multi.c
- Packet structure for use with multiple interfaces. It is will act as a gateway between interfaces. This is used for the controller board.
- packet_multi.h
- header file for the multiple interface packet structure.
- packet_norm.c
- This is the normal packet structure. It is full featured and takes up more space than the minimum one. It should also be used with the minimum HUGnet. This is the default for 0039-28 endpoints
- packet_norm.h
- The header file for the normal packet structure.
- packetcom.h
- This is required and will be included by all of the above packet structures.
Serial Ports
- serial_min.c
- Serial port module. I think this is only for the mega16. I will have to check.
- serial_min.h
- header file for the serial port module.
Serial Number
- sn.S
- This is only used for writing a serial number to a device. It should never be used in any project.
- sn.h
- The serial number goes here. 'make serialize' will put this serial number into whatever endpoint is attached to the programmer.
- endpoint.h
- Header file that defines some things that are common for all endpoints
SVN Access
The svn file path for this is:
See SVN Code Repository for more information

