Revision 2006

View differences:

trunk/code/projects/forklift_demo/Makefile
1
# This is the root makefile
1
# This is a copy of the root makefile, modified to compile with
2
# avr-g++ instead of avr-gcc
2 3
#
3
# Make global makefile changes here
4
#
5 4
###################################
6 5

  
6
TARGET = forklift_demo
7
AVRDUDE_PORT = /dev/ttyUSB0
8

  
7 9
# Relative path to the root directory (containing lib directory)
8 10
ifndef COLONYROOT
9
COLONYROOT := ..
11
COLONYROOT := ../../..
10 12
else
11 13
COLONYROOT := ../$(COLONYROOT)
12 14
endif
......
47 49
#
48 50
# make demo = copy this directory and all subdirectories to the demos folder
49 51
#
50
# make filename.s = Just compile filename.c into the assembler code only.
52
# make filename.s = Just compile filename.cpp into the assembler code only.
51 53
#
52 54
# make filename.i = Create a preprocessed source file for use in submitting
53 55
#                   bug reports to the GCC project.
......
74 76
FORMAT = ihex
75 77

  
76 78
# List C source files here. (C dependencies are automatically generated.)
77
SRC = $(wildcard *.c)
79
SRC = $(wildcard *.cpp)
78 80

  
79 81
# List Assembler source files here.
80 82
#     Make them always end in a capital .S.  Files ending in a lowercase .s
......
131 133
CFLAGS += -O$(OPT)
132 134
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
133 135
CFLAGS += -Wall -Wstrict-prototypes
134
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
136
CFLAGS += -Wa,-adhlns=$(<:.cpp=.lst)
135 137
CFLAGS += $(CSTANDARD)
136 138

  
137 139
#---------------- Assembler Options ----------------
......
305 307

  
306 308

  
307 309
# Define all object files.
308
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
310
OBJ = $(SRC:.cpp=.o) $(ASRC:.S=.o)
309 311

  
310 312
# Define all listing files.
311
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
313
LST = $(SRC:.cpp=.lst) $(ASRC:.S=.lst)
312 314

  
313 315

  
314 316
# Compiler flags to generate dependency files.
......
498 500

  
499 501

  
500 502
# Compile: create object files from C source files.
501
%.o : %.c
503
%.o : %.cpp
502 504
	@echo
503 505
	@echo $(MSG_COMPILING) $<
504 506
	$(CC) -c $(ALL_CFLAGS) $< -o $@
505 507

  
506 508

  
507 509
# Compile: create assembler files from C source files.
508
%.s : %.c
510
%.s : %.cpp
509 511
	$(CC) -S $(ALL_CFLAGS) $< -o $@
510 512

  
511 513

  
......
516 518
	$(CC) -c $(ALL_ASFLAGS) $< -o $@
517 519

  
518 520
# Create preprocessed source for use in sending a bug report.
519
%.i : %.c
521
%.i : %.cpp
520 522
	$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
521 523

  
522 524

  
......
535 537
	$(REMOVE) $(TARGET).lss
536 538
	$(REMOVE) $(OBJ)
537 539
	$(REMOVE) $(LST)
538
	$(REMOVE) $(SRC:.c=.s)
539
	$(REMOVE) $(SRC:.c=.d)
540
	$(REMOVE) $(SRC:.cpp=.s)
541
	$(REMOVE) $(SRC:.cpp=.d)
540 542
	$(REMOVEDIR) .dep
541 543

  
542 544

  
trunk/code/projects/forklift_demo/Forklift.cpp
1 1
#include "Forklift.h"
2
#include "libdragonfly/i2c.h"
2
extern "C"
3
{
4
#include "i2c.h"
3 5
#include <util/delay.h>
6
}
4 7

  
5 8
#define SCOUT_AVR_ADDR 0x01
6 9

  

Also available in: Unified diff