-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.linux
More file actions
68 lines (46 loc) · 1.61 KB
/
Copy pathMakefile.linux
File metadata and controls
68 lines (46 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
TARGET = ipac
# Application source en include includes
SRC_DIR = ./source
INC_DIR = ./include
# NutOS location (includes and libs)
NUT_INC = /opt/ethernut/include
NUT_BUILD_INC = /opt/ethernut/include
NUT_LIB_DIR = /opt/ethernut/lib
# WinAvr includes
AVR_INC = /bin/lib/avr
# Compiler, assembler & linker (flags)
CC = avr-gcc
LD = avr-gcc
CFLAGS = -mmcu=atmega2561 -Os -Wall -Wstrict-prototypes -DNUT_CPU_FREQ=14745600 \
-D__HARVARD_ARCH__ -DNUTOS_VERSION=433 \
-Wa,-ahlms=$(SRC_DIR)/$*lst
ASFLAGS = -mmcu=atmega2561 -I. -x assembler-with-cpp -Wa,-ahlms=$(SRC_DIR)/$*lst,-gstabs
LDFLAGS = -mmcu=atmega2561 -Wl,--defsym=main=0,-Map=TIStreamer.map,--cref
# =================================================================================
include Makefile.targets
# Alle source files in de ./source dir
SRCS = $(addprefix $(SRC_DIR)/,$(CFILES))
OBJS = $(SRCS:.c=.o)
NUT_LIBS = $(NUT_LIB_DIR)/nutinit.o -lnutpro -lnutfs -lnutos -lnutdev -lnutarch -lnutnet -lnutcrt -lnutdev
# Alle includes (header files) in de ./header dir
INCS = $(addprefix $(INC_DIR)/,$(HFILES))
# Linking rule. All *.o to elf file. Then convert to *.hex
$(TARGET): $(OBJS)
$(LD) $(OBJS) $(LDFLAGS) -L$(NUT_LIB_DIR) $(NUT_LIBS) -o $@.elf
avr-objcopy -O ihex $@.elf $@.hex
# hex2bin -ebin $@.hex
# Compiling the objs's. avr-gcc autocalls assembler
$(SRC_DIR)/%o: $(SRC_DIR)/%c
$(CC) -c $< $(CFLAGS) -I$(INC_DIR) -I$(NUT_INC) -I$(AVR_INC) -o $@
.PHONY: all
all: $(TARGET)
.PHONY: linux
linux: all
cp ipac.hex ~/Dropbox/nut_hex/
debug:
@echo $(OBJS)
.PHONY: clean
clean:
-rm -f $(OBJS)
-rm -f $(SRCS:.c=.lst)
-rm -f *.hex *.elf *.map *.bin