aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/demos/AVR/TEST-SUITE-OSLIB/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/demos/AVR/TEST-SUITE-OSLIB/Makefile')
-rw-r--r--lib/chibios/demos/AVR/TEST-SUITE-OSLIB/Makefile319
1 files changed, 319 insertions, 0 deletions
diff --git a/lib/chibios/demos/AVR/TEST-SUITE-OSLIB/Makefile b/lib/chibios/demos/AVR/TEST-SUITE-OSLIB/Makefile
new file mode 100644
index 000000000..ef5442266
--- /dev/null
+++ b/lib/chibios/demos/AVR/TEST-SUITE-OSLIB/Makefile
@@ -0,0 +1,319 @@
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 = yes
62endif
63
64# Enable this if you want to use DFU programmer.
65ifeq ($(USE_DFU_PROGRAMMER),)
66 USE_DFU_PROGRAMMER = no
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 = ../../..
87CHIBIOS := ../../..
88CONFDIR := ./cfg
89BUILDDIR := ./build
90DEPDIR := ./.dep
91
92# Licensing files.
93include $(CHIBIOS)/os/license/license.mk
94
95# HAL-OSAL files (optional).
96include $(CHIBIOS)/os/hal/hal.mk
97include $(CHIBIOS)/os/hal/boards/ARDUINO_MEGA/board.mk
98include $(CHIBIOS)/os/hal/ports/AVR/MEGA/ATMEGAxx/platform.mk
99include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
100
101# RTOS files (optional).
102include $(CHIBIOS)/os/rt/rt.mk
103include $(CHIBIOS)/os/common/ports/AVR/compilers/GCC/mk/port.mk
104
105# Other files (optional).
106include $(CHIBIOS)/test/lib/test.mk
107include $(CHIBIOS)/test/oslib/oslib_test.mk
108
109# List C source files here. (C dependencies are automatically generated.)
110CSRC = $(ALLCSRC) \
111 $(TESTSRC) \
112 main.c
113
114# List C++ sources file here.
115CPPSRC = $(ALLCPPSRC)
116
117INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC)
118
119#
120# Project, sources and paths.
121##############################################################################
122
123##############################################################################
124# Compiler settings.
125#
126
127# Micro-Controller Unit.
128MCU = atmega2560
129
130# MCU frequency (Hz).
131F_CPU = 16000000
132
133# Output format. (can be srec, ihex, binary)
134FORMAT = ihex
135
136# C and C++ Compiler name.
137TRGT = avr-
138CC = $(TRGT)gcc
139CPPC = $(TRGT)g++
140
141# Enable loading with g++ only if you need C++ runtime support.
142# NOTE: You can use C++ even without C++ support if you are careful. C++
143# runtime support makes code size explode.
144LD = $(TRGT)gcc
145CP = $(TRGT)objcopy
146AR = $(TRGT)ar rcs
147OD = $(TRGT)objdump
148NM = $(TRGT)nm
149SZ = $(TRGT)size
150HEX = $(CP) -O ihex
151BIN = $(CP) -O binary
152
153# Size of the elf binary file.
154ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
155
156# MCU specific options here.
157MOPT =
158
159# Define C warning options here.
160CWARN = -Wall -Wstrict-prototypes
161
162# Define C++ warning options here.
163CPPWARN =
164
165#
166# Compiler settings.
167##############################################################################
168
169##############################################################################
170# Start of user section.
171#
172
173# List all user C define here, like -D_DEBUG=1.
174UDEFS =
175
176# Define ASM defines here.
177UADEFS =
178
179# List all user directories here.
180UINCDIR =
181
182# List the user directory to look for the libraries here.
183ULIBDIR =
184
185# List all user libraries here.
186ULIBS =
187
188#
189# End of user defines.
190##############################################################################
191
192##############################################################################
193# Start of programming Options.
194#
195
196# List of available AVR programmer.
197AVRDUDE_PROGRAMMER = avrdude
198AVRDUDE_PROGRAMMER_ID = wiring
199DFU_PROGRAMMER = dfu-programmer
200MICRONUCLEUS = micronucleus
201
202# Set the AVR programmer according to the selection..
203ifeq ($(USE_AVRDUDE_PROGRAMMER),yes)
204 AVR_PROGRAMMER = $(AVRDUDE_PROGRAMMER)
205else ifeq ($(USE_DFU_PROGRAMMER),yes)
206 AVR_PROGRAMMER = $(DFU_PROGRAMMER)
207else ifeq ($(USE_MICRONUCLEUS_PROGRAMMER),yes)
208 AVR_PROGRAMMER = $(MICRONUCLEUS_PROGRAMMER)
209else
210 $(error ERROR: Please you need to configure the AVR programmer!)
211endif
212
213# AVR serial port.
214AVRDUDE_PORT = /dev/ttyUSB0
215
216AVRDUDE_WRITE_FLASH = -D -U flash:w:$(BUILDDIR)/$(PROJECT).hex
217
218# Check if the counter cycle erase must be performed after device programming.
219ifeq ($(USE_AVRDUDE_ERASE_COUNTER),yes)
220 AVRDUDE_ERASE_COUNTER = -y
221endif
222
223# Check if a verification must be performed after device programming.
224ifeq ($(USE_AVRDUDE_NO_VERIFY),no)
225 AVRDUDE_NO_VERIFY = -V
226endif
227
228# Check verbosity level activation.
229ifeq ($(USE_VERBOSE_PROGRAMMATION),yes)
230 AVRDUDE_VERBOSE = -v -v
231endif
232
233# AVR programmer flags for AVRDUDE programmer.
234ifeq ($(AVR_PROGRAMMER),$(AVRDUDE_PROGRAMMER))
235AVRDUDE_FLAGS = -p $(MCU)
236AVRDUDE_FLAGS += -P $(AVRDUDE_PORT)
237AVRDUDE_FLAGS += -b 115200
238AVRDUDE_FLAGS += -c $(AVRDUDE_PROGRAMMER_ID)
239AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
240AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
241AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
242endif
243
244# AVR programmer flags for DFU programmer.
245ifeq ($(AVR_PROGRAMMER),$(DFU_PROGRAMMER))
246DFU_WRITE_FLASH = flash --force
247DFU_ERASE_FLASH = erase
248DFU_RESET=reset
249endif
250
251# AVR programmer flags for MICRONUCLEUS programmer.
252ifeq ($(AVR_PROGRAMMER),$(MICRONUCLEUS_PROGRAMMER))
253MICRONUCLEUS_TIMEOUT_ARG = --timeout 60
254MICRONUCLEUS_RUN_ARG = --run
255MICRONUCLEUS_TYPE_ARG = --type raw
256MICRONUCLEUS_DUMP_PROGRESS = --dump-progress
257MICRONUCLEUS_FLAGS=$(MICRONUCLEUS_TYPE_ARG)
258MICRONUCLEUS_FLAGS+=$(MICRONUCLEUS_TIMEOUT_ARG)
259MICRONUCLEUS_FLAGS+=$(MICRONUCLEUS_RUN_ARG)
260endif
261
262#
263# End of Programming Options.
264##############################################################################
265
266##############################################################################
267# Include file.
268#
269
270RULESPATH = $(CHIBIOS)/os/common/ports/AVR/compilers/GCC
271include $(RULESPATH)/rules.mk
272
273#
274# End of include file.
275##############################################################################
276
277##############################################################################
278# Programming rules
279#
280
281# AVRDUDE programming rules.
282ifeq ($(AVR_PROGRAMMER),$(AVRDUDE_PROGRAMMER))
283program: $(BUILDDIR)/$(PROJECT).hex
284 @echo
285 @echo Programming $(MCU) device.
286 $(AVR_PROGRAMMER) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $<
287 @echo Done.
288endif
289
290# DFU programming rules.
291ifeq ($(AVR_PROGRAMMER),$(DFU_PROGRAMMER))
292program: $(BUILDDIR)/$(PROJECT).hex
293 @echo
294 @echo Programming $(MCU) device.
295 $(AVR_PROGRAMMER) $(MCU) $(DFU_WRITE_FLASH) $<
296 $(AVR_PROGRAMMER) $(MCU) $(DFU_RESET)
297 @echo Done.
298
299erase:
300 @echo
301 @echo Erasing $(MCU) device.
302 $(AVR_PROGRAMMER) $(MCU) $(DFU_ERASE_FLASH)
303 @echo Done.
304endif
305
306# MICRONUCLEUS programming rules.
307ifeq ($(AVR_PROGRAMMER),$(MICRONUCLEUS_PROGRAMMER))
308program: $(BUILDDIR)/$(PROJECT).bin
309 @echo
310 @echo Programming $(MCU) device.
311 $(AVR_PROGRAMMER) $(MICRONUCLEUS_FLAGS) $<
312 @echo Done.
313endif
314
315#
316# End of programming rules.
317##############################################################################
318
319# EOF