AVR-LibC  2.3.0git
Standard C library for AVR-GCC
 

AVR-LibC Documen­tation

AVR-LibC Development Pages

Main Page

User Manual

Library Refe­rence

FAQ

Example Projects

File List

Index

Loading...
Searching...
No Matches
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/* avr/signature.h - Signature API */
32
33#ifndef _AVR_SIGNATURE_H_
34#define _AVR_SIGNATURE_H_ 1
35
36/** \file */
37/** \defgroup avr_signature <avr/signature.h>: Signature Support
38
39 \par Introduction
40
41 The <avr/signature.h> header file allows the user to automatically
42 and easily include the device's signature data in a special section of
43 the final linked ELF file.
44
45 This value can then be used by programming software to compare the on-device
46 signature with the signature recorded in the ELF file to look for a match
47 before programming the device.
48
49 \par API Usage Example
50
51 Usage is very simple; just include the header file:
52
53 \code
54 #include <avr/signature.h>
55 \endcode
56
57 This will declare a constant unsigned char array and it is initialized with
58 the three signature bytes, MSB first, that are defined in the device I/O
59 header file. This array is then placed in the .signature section in the
60 resulting linked ELF file.
61
62 The three signature bytes that are used to initialize the array are
63 these defined macros in the device I/O header file, from MSB to LSB:
64 SIGNATURE_2, SIGNATURE_1, SIGNATURE_0.
65
66 This header file should only be included once in an application.
67*/
68
69#ifndef __ASSEMBLER__
70
71#include <avr/io.h>
72
73#if defined(SIGNATURE_0) && defined(SIGNATURE_1) && defined(SIGNATURE_2)
74
75const unsigned char __signature[3]
76__attribute__((__used__, __section__(".signature"))) =
77 { SIGNATURE_2, SIGNATURE_1, SIGNATURE_0 };
78
79#endif /* defined(SIGNATURE_0) && defined(SIGNATURE_1) && defined(SIGNATURE_2) */
80
81#endif /* __ASSEMBLER__ */
82
83#endif /* _AVR_SIGNATURE_H_ */