Skip to content

Commit 0806f1f

Browse files
committed
brakujące pliki
1 parent 7972919 commit 0806f1f

File tree

12 files changed

+1335
-1
lines changed

12 files changed

+1335
-1
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ Desktop.ini
147147
*.egg
148148
*.egg-info
149149
dist
150-
build
151150
eggs
152151
parts
153152
bin
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
LUFA Library
3+
Copyright (C) Dean Camera, 2013.
4+
5+
dean [at] fourwalledcubicle [dot] com
6+
www.lufa-lib.org
7+
*/
8+
9+
/*
10+
Copyright 2013 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 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
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+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# LUFA Library
3+
# Copyright (C) Dean Camera, 2013.
4+
#
5+
# dean [at] fourwalledcubicle [dot] com
6+
# www.lufa-lib.org
7+
#
8+
# --------------------------------------
9+
# LUFA Project Makefile.
10+
# --------------------------------------
11+
12+
# Run "make help" for target help.
13+
14+
MCU = at90usb1287
15+
ARCH = AVR8
16+
F_CPU = 1000000
17+
F_USB = $(F_CPU)
18+
OPTIMIZATION = s
19+
TARGET = HID_EEPROM_Loader
20+
SRC = $(TARGET).c
21+
LUFA_PATH = ../../../LUFA
22+
CC_FLAGS =
23+
LD_FLAGS =
24+
OBJECT_FILES = InputEEData.o
25+
26+
# Default target
27+
all:
28+
29+
# Determine the AVR sub-architecture of the build main application object file
30+
FIND_AVR_SUBARCH = avr$(shell avr-objdump -f $(TARGET).o | grep architecture | cut -d':' -f3 | cut -d',' -f1)
31+
32+
# Create a linkable object file with the input binary EEPROM data stored in the FLASH section
33+
InputEEData.o: InputEEData.bin $(TARGET).o $(MAKEFILE_LIST)
34+
@echo $(MSG_OBJCPY_CMD) Converting \"$<\" to a object file \"$@\"
35+
avr-objcopy -I binary -O elf32-avr -B $(call FIND_AVR_SUBARCH) --rename-section .data=.progmem.data,contents,alloc,readonly,data $< $@
36+
37+
# Include LUFA build script makefiles
38+
include $(LUFA_PATH)/Build/lufa_core.mk
39+
include $(LUFA_PATH)/Build/lufa_build.mk
40+
include $(LUFA_PATH)/Build/lufa_cppcheck.mk
41+
include $(LUFA_PATH)/Build/lufa_doxygen.mk
42+
include $(LUFA_PATH)/Build/lufa_hid.mk
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#
2+
# LUFA Library
3+
# Copyright (C) Dean Camera, 2013.
4+
#
5+
# dean [at] fourwalledcubicle [dot] com
6+
# www.lufa-lib.org
7+
#
8+
9+
LUFA_BUILD_MODULES += ATPROGRAM
10+
LUFA_BUILD_TARGETS += atprogram atprogram-ee
11+
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
12+
LUFA_BUILD_OPTIONAL_VARS += ATPROGRAM_PROGRAMMER ATPROGRAM_INTERFACE ATPROGRAM_PORT
13+
LUFA_BUILD_PROVIDED_VARS +=
14+
LUFA_BUILD_PROVIDED_MACROS +=
15+
16+
# -----------------------------------------------------------------------------
17+
# LUFA ATPROGRAM Programmer Buildsystem Makefile Module.
18+
# -----------------------------------------------------------------------------
19+
# DESCRIPTION:
20+
# Provides a set of targets to re-program a device using the Atmel atprogram
21+
# utility in AVR Studio 5.x and Atmel Studio 6.0 onwards.
22+
# -----------------------------------------------------------------------------
23+
# TARGETS:
24+
#
25+
# atprogram - Program target FLASH with application using
26+
# atprogram
27+
# atprogram-ee - Program target EEPROM with application data
28+
# using atprogram
29+
#
30+
# MANDATORY PARAMETERS:
31+
#
32+
# MCU - Microcontroller device model name
33+
# TARGET - Application name
34+
#
35+
# OPTIONAL PARAMETERS:
36+
#
37+
# ATPROGRAM_PROGRAMMER - Name of programming hardware to use
38+
# ATPROGRAM_INTERFACE - Name of programming interface to use
39+
# ATPROGRAM_PORT - Name of communication port to use
40+
#
41+
# PROVIDED VARIABLES:
42+
#
43+
# (None)
44+
#
45+
# PROVIDED MACROS:
46+
#
47+
# (None)
48+
#
49+
# -----------------------------------------------------------------------------
50+
51+
SHELL = /bin/sh
52+
53+
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
54+
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
55+
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
56+
57+
# Default values of optionally user-supplied variables
58+
ATPROGRAM_PROGRAMMER ?= jtagice3
59+
ATPROGRAM_INTERFACE ?= jtag
60+
ATPROGRAM_PORT ?=
61+
62+
# Sanity check user supplied values
63+
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
64+
$(call ERROR_IF_EMPTY, MCU)
65+
$(call ERROR_IF_EMPTY, TARGET)
66+
$(call ERROR_IF_EMPTY, ATPROGRAM_PROGRAMMER)
67+
$(call ERROR_IF_EMPTY, ATPROGRAM_INTERFACE)
68+
69+
# Output Messages
70+
MSG_ATPROGRAM_CMD := ' [ATPRGRM] :'
71+
72+
# Construct base atprogram command flags
73+
BASE_ATPROGRAM_FLAGS := --tool $(ATPROGRAM_PROGRAMMER) --interface $(ATPROGRAM_INTERFACE) --device $(MCU)
74+
ifneq ($(ATPROGRAM_PORT),)
75+
BASE_ATPROGRAM_FLAGS += --port $(ATPROGRAM_PORT)
76+
endif
77+
78+
# Construct the flags to use for the various memory spaces
79+
ifeq ($(ARCH), AVR8)
80+
ATPROGRAM_FLASH_FLAGS := --chiperase --flash
81+
ATPROGRAM_EEPROM_FLAGS := --eeprom
82+
else ifeq ($(ARCH), XMEGA)
83+
ATPROGRAM_FLASH_FLAGS := --erase --flash
84+
ATPROGRAM_EEPROM_FLAGS := --eeprom
85+
else ifeq ($(ARCH), UC3)
86+
ATPROGRAM_FLASH_FLAGS := --erase
87+
ATPROGRAM_EEPROM_FLAGS := --eeprom
88+
else
89+
$(error Unsupported architecture "$(ARCH)")
90+
endif
91+
92+
# Programs in the target FLASH memory using ATPROGRAM
93+
atprogram: $(TARGET).elf $(MAKEFILE_LIST)
94+
@echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" FLASH using \"$(ATPROGRAM_PROGRAMMER)\"
95+
atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_FLASH_FLAGS) --file $<
96+
97+
# Programs in the target EEPROM memory using ATPROGRAM
98+
atprogram-ee: $(TARGET).elf $(MAKEFILE_LIST)
99+
@echo $(MSG_ATPROGRAM_CMD) Programming device \"$(MCU)\" EEPROM using \"$(ATPROGRAM_PROGRAMMER)\"
100+
atprogram $(BASE_ATPROGRAM_FLAGS) program $(ATPROGRAM_EEPROM_FLAGS) --file $<
101+
102+
# Phony build targets for this module
103+
.PHONY: atprogram atprogram-ee
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#
2+
# LUFA Library
3+
# Copyright (C) Dean Camera, 2013.
4+
#
5+
# dean [at] fourwalledcubicle [dot] com
6+
# www.lufa-lib.org
7+
#
8+
9+
LUFA_BUILD_MODULES += AVRDUDE
10+
LUFA_BUILD_TARGETS += avrdude avrdude-ee
11+
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
12+
LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS
13+
LUFA_BUILD_PROVIDED_VARS +=
14+
LUFA_BUILD_PROVIDED_MACROS +=
15+
16+
# -----------------------------------------------------------------------------
17+
# LUFA AVRDUDE Programmer Buildsystem Makefile Module.
18+
# -----------------------------------------------------------------------------
19+
# DESCRIPTION:
20+
# Provides a set of targets to re-program a device using the open source
21+
# avr-dude utility.
22+
# -----------------------------------------------------------------------------
23+
# TARGETS:
24+
#
25+
# avrdude - Program target FLASH with application using
26+
# avrdude
27+
# avrdude-ee - Program target EEPROM with application data
28+
# using avrdude
29+
#
30+
# MANDATORY PARAMETERS:
31+
#
32+
# MCU - Microcontroller device model name
33+
# TARGET - Application name
34+
#
35+
# OPTIONAL PARAMETERS:
36+
#
37+
# AVRDUDE_PROGRAMMER - Name of programming hardware to use
38+
# AVRDUDE_PORT - Name of communication port to use
39+
# AVRDUDE_FLAGS - Flags to pass to avr-dude
40+
#
41+
# PROVIDED VARIABLES:
42+
#
43+
# (None)
44+
#
45+
# PROVIDED MACROS:
46+
#
47+
# (None)
48+
#
49+
# -----------------------------------------------------------------------------
50+
51+
SHELL = /bin/sh
52+
53+
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set))
54+
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank))
55+
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N))
56+
57+
# Default values of optionally user-supplied variables
58+
AVRDUDE_PROGRAMMER ?= jtagicemkii
59+
AVRDUDE_PORT ?= usb
60+
AVRDUDE_FLAGS ?=
61+
62+
# Sanity check user supplied values
63+
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))
64+
$(call ERROR_IF_EMPTY, MCU)
65+
$(call ERROR_IF_EMPTY, TARGET)
66+
$(call ERROR_IF_EMPTY, AVRDUDE_PROGRAMMER)
67+
$(call ERROR_IF_EMPTY, AVRDUDE_PORT)
68+
69+
# Output Messages
70+
MSG_AVRDUDE_CMD := ' [AVRDUDE] :'
71+
72+
# Construct base avrdude command flags
73+
BASE_AVRDUDE_FLAGS := -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
74+
75+
# Programs in the target FLASH memory using AVRDUDE
76+
avrdude: $(TARGET).hex $(MAKEFILE_LIST)
77+
@echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" FLASH using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
78+
avrdude $(BASE_AVRDUDE_FLAGS) -U flash:w:$< $(AVRDUDE_FLAGS)
79+
80+
# Programs in the target EEPROM memory using AVRDUDE
81+
avrdude-ee: $(TARGET).eep $(MAKEFILE_LIST)
82+
@echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" EEPROM using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
83+
avrdude $(BASE_AVRDUDE_FLAGS) -U eeprom:w:$< $(AVRDUDE_FLAGS)
84+
85+
# Phony build targets for this module
86+
.PHONY: avrdude avrdude-ee

0 commit comments

Comments
 (0)