3      Copyright (C) Dean Camera, 2013. 
   5   dean [at] fourwalledcubicle [dot] com 
  10   Copyright 2013  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  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. 
  21   The author disclaims 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 
  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. 
  41 #include <avr/eeprom.h> 
  42 #include <avr/pgmspace.h> 
  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
[]; 
  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) 
  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
])); 
  59         /* Infinite loop once complete */