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