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.
1 /* Copyright (c) 2009, Atmel Corporation
2  All rights reserved.
3 
4  Redistribution and use in source and binary forms, with or without
5  modification, are permitted provided that the following conditions are met:
6 
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9 
10  * Redistributions in binary form must reproduce the above copyright
11  notice, this list of conditions and the following disclaimer in
12  the documentation and/or other materials provided with the
13  distribution.
14 
15  * Neither the name of the copyright holders nor the names of
16  contributors may be used to endorse or promote products derived
17  from this software without specific prior written permission.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  POSSIBILITY OF SUCH DAMAGE. */
30 
31 /* $Id: signature.h 2296 2012-06-19 06:52:59Z joerg_wunsch $ */
32 
33 /* avr/signature.h - Signature API */
34 
35 #ifndef _AVR_SIGNATURE_H_
36 #define _AVR_SIGNATURE_H_ 1
37 
38 /** \file */
39 /** \defgroup avr_signature <avr/signature.h>: Signature Support
40 
41  \par Introduction
42 
43  The <avr/signature.h> header file allows the user to automatically
44  and easily include the device's signature data in a special section of
45  the final linked ELF file.
46 
47  This value can then be used by programming software to compare the on-device
48  signature with the signature recorded in the ELF file to look for a match
49  before programming the device.
50 
51  \par API Usage Example
52 
53  Usage is very simple; just include the header file:
54 
55  \code
56  #include <avr/signature.h>
57  \endcode
58 
59  This will declare a constant unsigned char array and it is initialized with
60  the three signature bytes, MSB first, that are defined in the device I/O
61  header file. This array is then placed in the .signature section in the
62  resulting linked ELF file.
63 
64  The three signature bytes that are used to initialize the array are
65  these defined macros in the device I/O header file, from MSB to LSB:
66  SIGNATURE_2, SIGNATURE_1, SIGNATURE_0.
67 
68  This header file should only be included once in an application.
69 */
70 
71 #ifndef __ASSEMBLER__
72 
73 #include <avr/io.h>
74 
75 #if defined(SIGNATURE_0) && defined(SIGNATURE_1) && defined(SIGNATURE_2)
76 
77 const unsigned char __signature[3]
78 __attribute__((__used__, __section__(".signature"))) =
79  { SIGNATURE_2, SIGNATURE_1, SIGNATURE_0 };
80 
81 #endif /* defined(SIGNATURE_0) && defined(SIGNATURE_1) && defined(SIGNATURE_2) */
82 
83 #endif /* __ASSEMBLER__ */
84 
85 #endif /* _AVR_SIGNATURE_H_ */

Automatically generated by Doxygen 1.8.7 on Tue Aug 12 2014.