diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2015-12-22 21:22:11 +1100 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2015-12-22 21:22:11 +1100 |
commit | 09b6c80555bc17b1206ee688ccdfc76454b2dbd7 (patch) | |
tree | 95b105a5c5f9c8fcd7648dc01b50d81f994edfe6 /LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader | |
parent | b590350df0cb857bca8efdbd1be9c8532008aa54 (diff) | |
download | lufa-09b6c80555bc17b1206ee688ccdfc76454b2dbd7.tar.gz lufa-09b6c80555bc17b1206ee688ccdfc76454b2dbd7.tar.bz2 lufa-09b6c80555bc17b1206ee688ccdfc76454b2dbd7.zip |
Add DMBS; don't Submodule so that people can download complete ZIP/TAR archives.
Diffstat (limited to 'LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader')
m--------- | LUFA/Build/DMBS | 0 | ||||
-rw-r--r-- | LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/HID_EEPROM_Loader.c | 39 | ||||
-rw-r--r-- | LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile | 35 |
3 files changed, 74 insertions, 0 deletions
diff --git a/LUFA/Build/DMBS b/LUFA/Build/DMBS deleted file mode 160000 -Subproject 7dfe3cf63ab428690112b79ce5d5261945a9118 diff --git a/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/HID_EEPROM_Loader.c b/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/HID_EEPROM_Loader.c new file mode 100644 index 000000000..35ea2d79b --- /dev/null +++ b/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/HID_EEPROM_Loader.c @@ -0,0 +1,39 @@ +/* + DMBS Build System + Released into the public domain. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com + */ + +/** \file + * + * Special application to extract an EEPROM image stored in FLASH memory, and + * copy it to the device EEPROM. This application is designed to be used with + * the HID build system module of DMBS to program the EEPROM of a target device + * that uses the HID bootloader protocol, which does not have native EEPROM + * programming support. + */ + +#include <avr/io.h> +#include <avr/eeprom.h> +#include <avr/pgmspace.h> + +/* References to the binary EEPROM data linked in the AVR's FLASH memory space */ +extern const char _binary_InputEEData_bin_start[]; +extern const char _binary_InputEEData_bin_end[]; +extern const char _binary_InputEEData_bin_size[]; + +/* Friendly names for the embedded binary data stored in FLASH memory space */ +#define InputEEData _binary_InputEEData_bin_start +#define InputEEData_size ((int)_binary_InputEEData_bin_size) + +int main(void) +{ + /* Copy out the embedded EEPROM data from FLASH to EEPROM memory space */ + for (uint16_t i = 0; i < InputEEData_size; i++) + eeprom_update_byte((uint8_t*)i, pgm_read_byte(&InputEEData[i])); + + /* Infinite loop once complete */ + for (;;); +} diff --git a/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile b/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile new file mode 100644 index 000000000..879eda8cf --- /dev/null +++ b/LUFA/Build/DMBS/DMBS/HID_EEPROM_Loader/makefile @@ -0,0 +1,35 @@ +# +# DMBS Build System +# Released into the public domain. +# +# dean [at] fourwalledcubicle [dot] com +# www.fourwalledcubicle.com +# + +# Run "make help" for target help. + +MCU = atmega128 +ARCH = AVR8 +F_CPU = 1000000 +OPTIMIZATION = s +TARGET = HID_EEPROM_Loader +SRC = $(TARGET).c +CC_FLAGS = +LD_FLAGS = +OBJECT_FILES = InputEEData.o + +# Default target +all: + +# Determine the AVR sub-architecture of the build main application object file +FIND_AVR_SUBARCH = avr$(shell avr-objdump -f $(TARGET).o | grep architecture | cut -d':' -f3 | cut -d',' -f1) + +# Create a linkable object file with the input binary EEPROM data stored in the FLASH section +InputEEData.o: InputEEData.bin $(TARGET).o $(MAKEFILE_LIST) + @echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a object file \"$@\" + avr-objcopy -I binary -O elf32-avr -B $(call FIND_AVR_SUBARCH) --rename-section .data=.progmem.data,contents,alloc,readonly,data $< $@ + +# Include LUFA build script makefiles +include ../core.mk +include ../gcc.mk +include ../hid.mk |