]> git.gir.st - tmk_keyboard.git/blob - protocol/lufa/LUFA-120730/LUFA/Build/HID_EEPROM_Loader/HID_EEPROM_Loader.c
Squashed 'tmk_core/' content from commit 05caacc
[tmk_keyboard.git] / protocol / lufa / LUFA-120730 / LUFA / Build / HID_EEPROM_Loader / HID_EEPROM_Loader.c
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2012.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7 */
8
9 /*
10 Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \file
32 *
33 * Special application to extract an EEPROM image stored in FLASH memory, and
34 * copy it to the device EEPROM. This application is designed to be used with
35 * the HID build system module of LUFA to program the EEPROM of a target device
36 * that uses the HID bootloader protocol, which does not have native EEPROM
37 * programming support.
38 */
39
40 #include <avr/io.h>
41 #include <avr/eeprom.h>
42 #include <avr/pgmspace.h>
43
44 /* References to the binary EEPROM data linked in the AVR's FLASH memory space */
45 extern const char _binary_InputEEData_bin_start[];
46 extern const char _binary_InputEEData_bin_end[];
47 extern const char _binary_InputEEData_bin_size[];
48
49 /* Friendly names for the embedded binary data stored in FLASH memory space */
50 #define InputEEData _binary_InputEEData_bin_start
51 #define InputEEData_size ((int)_binary_InputEEData_bin_size)
52
53 int main(void)
54 {
55 /* Copy out the embedded EEPROM data from FLASH to EEPROM memory space */
56 for (uint16_t i = 0; i < InputEEData_size; i++)
57 eeprom_update_byte((uint8_t*)i, pgm_read_byte(&InputEEData[i]));
58
59 /* Infinite loop once complete */
60 for (;;);
61 }
Imprint / Impressum