-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
121 lines (99 loc) · 2.56 KB
/
Makefile
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# this makefile is to compile apps as a separate bFLT executable
#
#
# PATH CONFIG
FROSTED?=..
PREFIX:=$(PWD)/build
-include kconfig/.config
# TOOLCHAIN CONFIG
CROSS_COMPILE?=arm-frosted-eabi-
CC:=$(CROSS_COMPILE)gcc
AS:=$(CROSS_COMPILE)as
AR:=$(CROSS_COMPILE)ar
ifneq ($(V),1)
Q:=@
#Do not print "Entering directory ...".
MAKEFLAGS += --no-print-directory
endif
#Applications selection
DIR-y+=lib binutils hw-utils netutils games tests
DIR-$(APP_PYTHON)+=micropython
# COMPILER FLAGS -- Target CPU
CFLAGS+=-mthumb -mlittle-endian -mthumb-interwork -ffunction-sections
ifeq ($(ARCH),)
CFLAGS+=-mcpu=cortex-m3
else
CFLAGS+=-mcpu=$(ARCH)
endif
CFLAGS+=-DCORE_M3 -D__frosted__
# COMPILER FLAGS -- No gcc libraries
CFLAGS+=-nostartfiles
# COMPILER FLAGS -- GOT/PIC
CFLAGS+=-fPIC -mlong-calls -fno-common -msingle-pic-base -mno-pic-data-is-text-relative -Wstack-usage=1024
# Debugging
CFLAGS+=-ggdb
CFLAGS+=-I../lib/include -I../lib/wolfssl -I../lib
CFLAGS-$(LIB_WOLFSSL)+=-DENABLE_SSL -DMG_ENABLE_SSL
CFLAGS+=$(CFLAGS-y)
# LINKER FLAGS
LDFLAGS+=-fPIC -mlong-calls -fno-common -Wl,-elf2flt -lgloss
all: apps.img
cp apps.img $(FROSTED)/
xipfstool: xipfs
make -C $^
mv $^/xipfstool .
apps.img: $(APPS-y) $(DIR-y) sh xipfstool lnk
mv out/*.gdb gdb/ 2>/dev/null || true
./xipfstool $@ $(APPS-y) out/*
binutils: FORCE
mkdir -p out
mkdir -p gdb
rm -rf lnk
mkdir -p lnk
cd binutils && ./gen_makefile.py
make -C $@ LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" CC=$(CC)
lib: FORCE
mkdir -p out
mkdir -p gdb
make -C $@ LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" CC=$(CC)
hw-utils: FORCE
mkdir -p out
mkdir -p gdb
make -C $@ LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" CC=$(CC)
netutils: FORCE
mkdir -p out
mkdir -p gdb
make -C $@ LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS) -D__USE_MISC" CC=$(CC)
games: FORCE
mkdir -p out
mkdir -p gdb
make -C $@ LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" CC=$(CC)
sh: FORCE
mkdir -p out
cp -a $@/* out/ || true
lnk: FORCE
mkdir -p out
cp -a $@/* out/ || true
micropython: FORCE
mkdir -p out
mkdir -p gdb
make -C micropython/mpy-cross
make -C micropython/frosted
cp micropython/frosted/micropython out/python
cp micropython/frosted/micropython.gdb gdb
tests: FORCE
mkdir -p out
mkdir -p gdb
make -C $@ LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" CC=$(CC)
FORCE:
menuconfig:
@$(MAKE) -C kconfig/ menuconfig -f Makefile.frosted
clean:
$(foreach d,$(DIR-y),make -C $(d) clean &>/dev/null || true;)
@rm -f *.img
@rm -f *.o
@rm -rf gdb out lnk ice
@make -C xipfs clean
make -C micropython/mpy-cross clean
@make -C micropython/frosted clean
@rm -f xipfstool