aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/demos/AVR/RT-MT-DB-X4/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/demos/AVR/RT-MT-DB-X4/Makefile')
-rw-r--r--lib/chibios/demos/AVR/RT-MT-DB-X4/Makefile314
1 files changed, 314 insertions, 0 deletions
diff --git a/lib/chibios/demos/AVR/RT-MT-DB-X4/Makefile b/lib/chibios/demos/AVR/RT-MT-DB-X4/Makefile
new file mode 100644
index 000000000..746a1a1cd
--- /dev/null
+++ b/lib/chibios/demos/AVR/RT-MT-DB-X4/Makefile
@@ -0,0 +1,314 @@
1
2##############################################################################
3#
4# @file Makefile.
5#
6# @brief AVR Make file, it can be use to build, and program an application to
7# an AVR MCU like atmega328p, atmega2560 and so on.
8#
9# @author Theodore Ateba, [email protected]
10#
11##############################################################################
12
13##############################################################################
14# Building and programming global options.
15# NOTE: Can be overridden externally.
16#
17
18# Compiler options here.
19ifeq ($(USE_OPT),)
20 USE_OPT = -O2
21endif
22
23# C specific options here (added to USE_OPT).
24ifeq ($(USE_COPT),)
25 USE_COPT =
26endif
27
28# C++ specific options here (added to USE_OPT).
29ifeq ($(USE_CPPOPT),)
30 USE_CPPOPT =
31endif
32
33# Enable this if you want to see the full log while compiling.
34ifeq ($(USE_VERBOSE_COMPILE),)
35 USE_VERBOSE_COMPILE = no
36endif
37
38# If enabled, this option makes the build process faster by not compiling
39# modules not used in the current configuration.
40ifeq ($(USE_SMART_BUILD),)
41 USE_SMART_BUILD = yes
42endif
43
44# If enable, this option arase the counter cycle after device programming.
45ifeq ($(USE_AVRDUDE_ERASE_COUNTER),)
46 USE_AVRDUDE_ERASE_COUNTER = no
47endif
48
49# If enable, this option perform a verification after device programming.
50ifeq ($(USE_AVRDUDE_NO_VERIFY),)
51 USE_AVRDUDE_NO_VERIFY = no
52endif
53
54# If enabled, this option increase the programming verbosity level.
55ifeq ($(USE_VERBOSE_PROGRAMMATION),)
56 USE_VERBOSE_PROGRAMMATION = no
57endif
58
59# Enable this if you want to use AVRDUDE programmer.
60ifeq ($(USE_AVRDUDE_PROGRAMMER),)
61 USE_AVRDUDE_PROGRAMMER = no
62endif
63
64# Enable this if you want to use DFU programmer.
65ifeq ($(USE_DFU_PROGRAMMER),)
66 USE_DFU_PROGRAMMER = yes
67endif
68
69# Enable this if you want to use MICRONUCLEUS programmer.
70ifeq ($(USE_MICRONUCLEUS_PROGRAMMER),)
71 USE_MICRONUCLEUS_PROGRAMMER = no
72endif
73
74#
75# Building and programming global options.
76##############################################################################
77
78##############################################################################
79# Project, sources and paths.
80#
81
82# Define project name here.
83PROJECT = ch
84
85# Imported source files and paths
86CHIBIOS := ../../..
87CONFDIR := ./cfg
88BUILDDIR := ./build
89DEPDIR := ./.dep
90
91# Licensing files.
92include $(CHIBIOS)/os/license/license.mk
93
94# HAL-OSAL files (optional).
95include $(CHIBIOS)/os/hal/hal.mk
96include $(CHIBIOS)/os/hal/boards/MT-DB-X4/board.mk
97include $(CHIBIOS)/os/hal/ports/AVR/XMEGA/ATXMEGAxxxA4U/platform.mk
98include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
99
100# RTOS files (optional).
101include $(CHIBIOS)/os/rt/rt.mk
102include $(CHIBIOS)/os/common/ports/AVR/compilers/GCC/mk/port.mk
103
104# List C source files here. (C dependencies are automatically generated.)
105CSRC = $(ALLCSRC) \
106 main.c
107
108# List C++ sources file here.
109CPPSRC = $(ALLCPPSRC)
110
111# Header files here.
112INCDIR = $(CONFDIR) $(ALLINC)
113
114#
115# Project, sources and paths.
116##############################################################################
117
118##############################################################################
119# Compiler settings.
120#
121
122# Micro-Controller Unit.
123MCU = atxmega128a4u
124
125# MCU frequency (Hz).
126F_CPU = 32000000
127
128# Output format. (can be srec, ihex, binary)
129FORMAT = ihex
130
131# C and C++ Compiler name.
132TRGT = avr-
133CC = $(TRGT)gcc
134CPPC = $(TRGT)g++
135
136# Enable loading with g++ only if you need C++ runtime support.
137# NOTE: You can use C++ even without C++ support if you are careful. C++
138# runtime support makes code size explode.
139LD = $(TRGT)gcc
140CP = $(TRGT)objcopy
141AR = $(TRGT)ar rcs
142OD = $(TRGT)objdump
143NM = $(TRGT)nm
144SZ = $(TRGT)size
145HEX = $(CP) -O ihex
146BIN = $(CP) -O binary
147
148# Size of the elf binary file.
149ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
150
151# MCU specific options here.
152MOPT =
153
154# Define C warning options here.
155CWARN = -Wall -Wstrict-prototypes
156
157# Define C++ warning options here.
158CPPWARN =
159
160#
161# Compiler settings.
162##############################################################################
163
164##############################################################################
165# Start of user section.
166#
167
168# List all user C define here, like -D_DEBUG=1.
169UDEFS =
170
171# Define ASM defines here.
172UADEFS =
173
174# List all user directories here.
175UINCDIR =
176
177# List the user directory to look for the libraries here.
178ULIBDIR =
179
180# List all user libraries here.
181ULIBS =
182
183#
184# End of user defines.
185##############################################################################
186
187##############################################################################
188# Start of programming Options.
189#
190
191# List of available AVR programmer.
192AVRDUDE_PROGRAMMER = avrdude
193AVRDUDE_PROGRAMMER_ID = wiring
194DFU_PROGRAMMER = dfu-programmer
195MICRONUCLEUS = micronucleus
196
197# Set the AVR programmer according to the selection..
198ifeq ($(USE_AVRDUDE_PROGRAMMER),yes)
199 AVR_PROGRAMMER = $(AVRDUDE_PROGRAMMER)
200else ifeq ($(USE_DFU_PROGRAMMER),yes)
201 AVR_PROGRAMMER = $(DFU_PROGRAMMER)
202else ifeq ($(USE_MICRONUCLEUS_PROGRAMMER),yes)
203 AVR_PROGRAMMER = $(MICRONUCLEUS_PROGRAMMER)
204else
205 $(error ERROR: Please you need to configure the AVR programmer!)
206endif
207
208# AVR serial port.
209AVRDUDE_PORT = /dev/ttyUSB0
210
211AVRDUDE_WRITE_FLASH = -D -U flash:w:$(BUILDDIR)/$(PROJECT).hex
212
213# Check if the counter cycle erase must be performed after device programming.
214ifeq ($(USE_AVRDUDE_ERASE_COUNTER),yes)
215 AVRDUDE_ERASE_COUNTER = -y
216endif
217
218# Check if a verification must be performed after device programming.
219ifeq ($(USE_AVRDUDE_NO_VERIFY),no)
220 AVRDUDE_NO_VERIFY = -V
221endif
222
223# Check verbosity level activation.
224ifeq ($(USE_VERBOSE_PROGRAMMATION),yes)
225 AVRDUDE_VERBOSE = -v -v
226endif
227
228# AVR programmer flags for AVRDUDE programmer.
229ifeq ($(AVR_PROGRAMMER),$(AVRDUDE_PROGRAMMER))
230AVRDUDE_FLAGS = -p $(MCU)
231AVRDUDE_FLAGS += -P $(AVRDUDE_PORT)
232AVRDUDE_FLAGS += -b 115200
233AVRDUDE_FLAGS += -c $(AVRDUDE_PROGRAMMER_ID)
234AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
235AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
236AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
237endif
238
239# AVR programmer flags for DFU programmer.
240ifeq ($(AVR_PROGRAMMER),$(DFU_PROGRAMMER))
241DFU_WRITE_FLASH = flash --force
242DFU_ERASE_FLASH = erase
243DFU_RESET=reset
244endif
245
246# AVR programmer flags for MICRONUCLEUS programmer.
247ifeq ($(AVR_PROGRAMMER),$(MICRONUCLEUS_PROGRAMMER))
248MICRONUCLEUS_TIMEOUT_ARG = --timeout 60
249MICRONUCLEUS_RUN_ARG = --run
250MICRONUCLEUS_TYPE_ARG = --type raw
251MICRONUCLEUS_DUMP_PROGRESS = --dump-progress
252MICRONUCLEUS_FLAGS=$(MICRONUCLEUS_TYPE_ARG)
253MICRONUCLEUS_FLAGS+=$(MICRONUCLEUS_TIMEOUT_ARG)
254MICRONUCLEUS_FLAGS+=$(MICRONUCLEUS_RUN_ARG)
255endif
256
257#
258# End of Programming Options.
259##############################################################################
260
261##############################################################################
262# Include file.
263#
264
265RULESPATH = $(CHIBIOS)/os/common/ports/AVR/compilers/GCC
266include $(RULESPATH)/rules.mk
267
268#
269# End of include file.
270##############################################################################
271
272##############################################################################
273# Programming rules
274#
275
276# AVRDUDE programming rules.
277ifeq ($(AVR_PROGRAMMER),$(AVRDUDE_PROGRAMMER))
278program: $(BUILDDIR)/$(PROJECT).hex
279 @echo
280 @echo Programming $(MCU) device.
281 $(AVR_PROGRAMMER) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $<
282 @echo Done.
283endif
284
285# DFU programming rules.
286ifeq ($(AVR_PROGRAMMER),$(DFU_PROGRAMMER))
287program: $(BUILDDIR)/$(PROJECT).hex
288 @echo
289 @echo Programming $(MCU) device.
290 $(AVR_PROGRAMMER) $(MCU) $(DFU_WRITE_FLASH) $<
291 $(AVR_PROGRAMMER) $(MCU) $(DFU_RESET)
292 @echo Done.
293
294erase:
295 @echo
296 @echo Erasing $(MCU) device.
297 $(AVR_PROGRAMMER) $(MCU) $(DFU_ERASE_FLASH)
298 @echo Done.
299endif
300
301# MICRONUCLEUS programming rules.
302ifeq ($(AVR_PROGRAMMER),$(MICRONUCLEUS_PROGRAMMER))
303program: $(BUILDDIR)/$(PROJECT).bin
304 @echo
305 @echo Programming $(MCU) device.
306 $(AVR_PROGRAMMER) $(MICRONUCLEUS_FLAGS) $<
307 @echo Done.
308endif
309
310#
311# End of programming rules.
312##############################################################################
313
314# EOF