upload
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

HID_EEPROM_Loader.c 2.2KB

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