AVR Libc Home Page AVRs AVR Libc Development Pages
Main Page User Manual Library Reference FAQ Alphabetical Index Example Projects

signature.h

Go to the documentation of this file.
00001 /* Copyright (c) 2009, Atmel Corporation
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions are met:
00006 
00007    * Redistributions of source code must retain the above copyright
00008      notice, this list of conditions and the following disclaimer.
00009 
00010    * Redistributions in binary form must reproduce the above copyright
00011      notice, this list of conditions and the following disclaimer in
00012      the documentation and/or other materials provided with the
00013      distribution.
00014 
00015    * Neither the name of the copyright holders nor the names of
00016      contributors may be used to endorse or promote products derived
00017      from this software without specific prior written permission.
00018 
00019   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00023   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029   POSSIBILITY OF SUCH DAMAGE. */
00030 
00031 /* $Id: signature.h 2102 2010-03-16 22:52:39Z joerg_wunsch $ */
00032 
00033 /* avr/signature.h - Signature API */
00034 
00035 #ifndef _AVR_SIGNATURE_H_
00036 #define _AVR_SIGNATURE_H_ 1
00037 
00038 /** \file */
00039 /** \defgroup avr_signature <avr/signature.h>: Signature Support
00040 
00041     \par Introduction
00042 
00043     The <avr/signature.h> header file allows the user to automatically
00044     and easily include the device's signature data in a special section of
00045     the final linked ELF file.
00046     
00047     This value can then be used by programming software to compare the on-device
00048     signature with the signature recorded in the ELF file to look for a match
00049     before programming the device.
00050     
00051     \par API Usage Example
00052 
00053     Usage is very simple; just include the header file:
00054     
00055     \code
00056     #include <avr/signature.h>
00057     \endcode
00058     
00059     This will declare a constant unsigned char array and it is initialized with
00060     the three signature bytes, MSB first, that are defined in the device I/O
00061     header file. This array is then placed in the .signature section in the
00062     resulting linked ELF file.
00063     
00064     The three signature bytes that are used to initialize the array are 
00065     these defined macros in the device I/O header file, from MSB to LSB:
00066     SIGNATURE_2, SIGNATURE_1, SIGNATURE_0.
00067     
00068     This header file should only be included once in an application.
00069 */
00070 
00071 #ifndef __ASSEMBLER__
00072 
00073 #include <avr/io.h>
00074 
00075 #if defined(SIGNATURE_0) && defined(SIGNATURE_1) && defined(SIGNATURE_2)
00076 
00077 const unsigned char __signature[3] __attribute__((section (".signature"))) =
00078         { SIGNATURE_2, SIGNATURE_1, SIGNATURE_0 };
00079 
00080 #endif  /* defined(SIGNATURE_0) && defined(SIGNATURE_1) && defined(SIGNATURE_2) */
00081 
00082 #endif  /* __ASSEMBLER__ */
00083 
00084 #endif  /* _AVR_SIGNATURE_H_ */

Automatically generated by Doxygen 1.7.3 on Thu May 19 2011.