Revision 156
Updated robot_slave code; reformatted a lot of stuff
Makefile | ||
---|---|---|
48 | 48 |
# make program = Download the hex file to the device, using avrdude. |
49 | 49 |
# Please customize the avrdude settings below first! |
50 | 50 |
# |
51 |
# make debug = Start either simulavr or avarice as specified for debugging,
|
|
51 |
# make debug = Start either simulavr or avarice as specified for debugging, |
|
52 | 52 |
# with avr-gdb or avr-insight as the front end for debugging. |
53 | 53 |
# |
54 | 54 |
# make filename.s = Just compile filename.c into the assembler code only. |
... | ... | |
61 | 61 |
|
62 | 62 |
#if you want your code to work on the Firefly++ and not Firefly+ |
63 | 63 |
#then add the -DFFPP line to CDEFS |
64 |
CDEFS =
|
|
64 |
CDEFS = |
|
65 | 65 |
#-DFFPP |
66 | 66 |
|
67 | 67 |
# MCU name |
68 | 68 |
MCU = atmega128 |
69 | 69 |
|
70 | 70 |
# Processor frequency. |
71 |
# This will define a symbol, F_CPU, in all source code files equal to the
|
|
72 |
# processor frequency. You can then use this symbol in your source code to
|
|
71 |
# This will define a symbol, F_CPU, in all source code files equal to the |
|
72 |
# processor frequency. You can then use this symbol in your source code to |
|
73 | 73 |
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done |
74 | 74 |
# automatically to create a 32-bit value in your source code. |
75 | 75 |
F_CPU = 8000000 |
... | ... | |
87 | 87 |
# Even though the DOS/Win* filesystem matches both .s and .S the same, |
88 | 88 |
# it will preserve the spelling of the filenames, and gcc itself does |
89 | 89 |
# care about how the name is spelled on its command-line. |
90 |
ASRC =
|
|
90 |
ASRC = |
|
91 | 91 |
|
92 |
# Optimization level, can be [0, 1, 2, 3, s].
|
|
92 |
# Optimization level, can be [0, 1, 2, 3, s]. |
|
93 | 93 |
# 0 = turn off optimization. s = optimize for size. |
94 | 94 |
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
95 | 95 |
OPT = s |
... | ... | |
108 | 108 |
CSTANDARD = -std=gnu99 |
109 | 109 |
|
110 | 110 |
# Place -D or -U options here |
111 |
CDEFS += -DF_CPU=$(F_CPU)UL
|
|
111 |
CDEFS += -DF_CPU=$(F_CPU)UL |
|
112 | 112 |
CDEFS += -DFFP |
113 | 113 |
# for wireless library |
114 | 114 |
ifdef USE_WIRELESS |
... | ... | |
116 | 116 |
endif |
117 | 117 |
|
118 | 118 |
# Place -I, -L options here |
119 |
CINCS = -I$(COLONYROOT)/code/lib/include/libdragonfly
|
|
119 |
CINCS = -I$(COLONYROOT)/code/lib/include/libdragonfly |
|
120 | 120 |
CINCS += -L$(COLONYROOT)/code/lib/bin |
121 | 121 |
ifdef USE_WIRELESS |
122 | 122 |
CINCS += -I$(COLONYROOT)/code/lib/include/libwireless |
... | ... | |
145 | 145 |
# for use in COFF files, additional information about filenames |
146 | 146 |
# and function names needs to be present in the assembler source |
147 | 147 |
# files -- see avr-libc docs [FIXME: not yet described there] |
148 |
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
|
148 |
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
|
149 | 149 |
|
150 | 150 |
|
151 | 151 |
#---------------- Library Options ---------------- |
... | ... | |
156 | 156 |
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt |
157 | 157 |
|
158 | 158 |
# If this is left blank, then it will use the Standard printf version. |
159 |
PRINTF_LIB =
|
|
159 |
PRINTF_LIB = |
|
160 | 160 |
#PRINTF_LIB = $(PRINTF_LIB_MIN) |
161 | 161 |
#PRINTF_LIB = $(PRINTF_LIB_FLOAT) |
162 | 162 |
|
... | ... | |
168 | 168 |
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt |
169 | 169 |
|
170 | 170 |
# If this is left blank, then it will use the Standard scanf version. |
171 |
SCANF_LIB =
|
|
171 |
SCANF_LIB = |
|
172 | 172 |
#SCANF_LIB = $(SCANF_LIB_MIN) |
173 | 173 |
#SCANF_LIB = $(SCANF_LIB_FLOAT) |
174 | 174 |
|
... | ... | |
202 | 202 |
|
203 | 203 |
#---------------- Programming Options (avrdude) ---------------- |
204 | 204 |
|
205 |
# Programming hardware: alf avr910 avrisp bascom bsd
|
|
205 |
# Programming hardware: alf avr910 avrisp bascom bsd |
|
206 | 206 |
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
207 | 207 |
# |
208 | 208 |
# Type: avrdude -c ? |
... | ... | |
226 | 226 |
#AVRDUDE_NO_VERIFY = -V |
227 | 227 |
|
228 | 228 |
# Increase verbosity level. Please use this when submitting bug |
229 |
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
|
|
229 |
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
|
230 | 230 |
# to submit bug reports. |
231 | 231 |
#AVRDUDE_VERBOSE = -v -v |
232 | 232 |
|
... | ... | |
263 | 263 |
DEBUG_PORT = 4242 |
264 | 264 |
|
265 | 265 |
# Debugging host used to communicate between GDB / avarice / simulavr, normally |
266 |
# just set to localhost unless doing some sort of crazy debugging when
|
|
266 |
# just set to localhost unless doing some sort of crazy debugging when |
|
267 | 267 |
# avarice is running on a different computer. |
268 | 268 |
DEBUG_HOST = localhost |
269 | 269 |
|
... | ... | |
291 | 291 |
MSG_ERRORS_NONE = Errors: none |
292 | 292 |
MSG_BEGIN = -------- begin -------- |
293 | 293 |
MSG_END = -------- end -------- |
294 |
MSG_SIZE_BEFORE = Size before:
|
|
294 |
MSG_SIZE_BEFORE = Size before: |
|
295 | 295 |
MSG_SIZE_AFTER = Size after: |
296 | 296 |
MSG_COFF = Converting to AVR COFF: |
297 | 297 |
MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
... | ... | |
308 | 308 |
|
309 | 309 |
|
310 | 310 |
# Define all object files. |
311 |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
|
|
311 |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
|
312 | 312 |
|
313 | 313 |
# Define all listing files. |
314 |
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
|
|
314 |
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst) |
|
315 | 315 |
|
316 | 316 |
|
317 | 317 |
# Compiler flags to generate dependency files. |
... | ... | |
335 | 335 |
elf: $(TARGET).elf |
336 | 336 |
hex: $(TARGET).hex |
337 | 337 |
eep: $(TARGET).eep |
338 |
lss: $(TARGET).lss
|
|
338 |
lss: $(TARGET).lss |
|
339 | 339 |
sym: $(TARGET).sym |
340 | 340 |
|
341 | 341 |
|
... | ... | |
368 | 368 |
|
369 | 369 |
|
370 | 370 |
# Display compiler version information. |
371 |
gccversion :
|
|
371 |
gccversion : |
|
372 | 372 |
@$(CC) --version |
373 | 373 |
|
374 | 374 |
|
375 | 375 |
|
376 |
# Program the device.
|
|
376 |
# Program the device. |
|
377 | 377 |
program: $(TARGET).hex $(TARGET).eep |
378 | 378 |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
379 | 379 |
|
380 | 380 |
|
381 | 381 |
# Generate avr-gdb config/init file which does the following: |
382 |
# define the reset signal, load the target file, connect to target, and set
|
|
382 |
# define the reset signal, load the target file, connect to target, and set |
|
383 | 383 |
# a breakpoint at main(). |
384 |
gdb-config:
|
|
384 |
gdb-config: |
|
385 | 385 |
@$(REMOVE) $(GDBINIT_FILE) |
386 | 386 |
@echo define reset >> $(GDBINIT_FILE) |
387 | 387 |
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE) |
... | ... | |
390 | 390 |
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) |
391 | 391 |
ifeq ($(DEBUG_BACKEND),simulavr) |
392 | 392 |
@echo load >> $(GDBINIT_FILE) |
393 |
endif
|
|
393 |
endif |
|
394 | 394 |
@echo break main >> $(GDBINIT_FILE) |
395 |
|
|
395 |
|
|
396 | 396 |
debug: gdb-config $(TARGET).elf |
397 | 397 |
ifeq ($(DEBUG_BACKEND), avarice) |
398 | 398 |
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays. |
399 | 399 |
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ |
400 | 400 |
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) |
401 | 401 |
@$(WINSHELL) /c pause |
402 |
|
|
402 |
|
|
403 | 403 |
else |
404 | 404 |
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ |
405 | 405 |
$(DEBUG_MFREQ) --port $(DEBUG_PORT) |
406 | 406 |
endif |
407 | 407 |
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) |
408 |
|
|
409 | 408 |
|
410 | 409 |
|
411 | 410 |
|
411 |
|
|
412 | 412 |
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. |
413 | 413 |
COFFCONVERT=$(OBJCOPY) --debugging \ |
414 | 414 |
--change-section-address .data-0x800000 \ |
415 | 415 |
--change-section-address .bss-0x800000 \ |
416 | 416 |
--change-section-address .noinit-0x800000 \ |
417 |
--change-section-address .eeprom-0x810000
|
|
417 |
--change-section-address .eeprom-0x810000 |
|
418 | 418 |
|
419 | 419 |
|
420 | 420 |
coff: $(TARGET).elf |
... | ... | |
469 | 469 |
%.o : %.c |
470 | 470 |
@echo |
471 | 471 |
@echo $(MSG_COMPILING) $< |
472 |
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
|
472 |
$(CC) -c $(ALL_CFLAGS) $< -o $@ |
|
473 | 473 |
|
474 | 474 |
|
475 | 475 |
# Compile: create assembler files from C source files. |
... | ... | |
485 | 485 |
|
486 | 486 |
# Create preprocessed source for use in sending a bug report. |
487 | 487 |
%.i : %.c |
488 |
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
|
|
488 |
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ |
|
489 | 489 |
|
490 | 490 |
|
491 | 491 |
# Target: clean project. |
Also available in: Unified diff