forked from not404/radioblock-simplemesh-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makerules
158 lines (129 loc) · 3.59 KB
/
Makerules
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
##############################################################################
ifeq ($(HAL), LPC1114)
CFLAGS += -W -Wall --std=gnu99 -Os
CFLAGS += -ffunction-sections -fdata-sections -fshort-enums
else
CFLAGS += -Wall --std=gnu99 -Wpointer-arith -mrelax -MD -MP -MF -O1
CFLAGS += -ffunction-sections -fdata-sections
endif
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,-Map=$(APP_NAME).map
##############################################################################
#
# atmega128rfa1
#
ifeq ($(HAL), ATMEGA128RFA1)
CC = avr-gcc
OBJCOPY = avr-objcopy
SIZE = avr-size
MCU = atmega128rfa1
HAL_PATH = atmega128rfa1
CFLAGS += -mmcu=$(MCU)
LDFLAGS += -mmcu=$(MCU)
INCLUDES += \
-I$(STACK_PATH)/hal/atmega128rfa1/include
SRCS += \
$(STACK_PATH)/hal/atmega128rfa1/src/hal.c
#
# atmega256rfr2
#
else ifeq ($(HAL), ATMEGA256RFR2)
CC = avr-gcc
OBJCOPY = avr-objcopy
SIZE = avr-size
MCU = atmega256rfr2
HAL_PATH = atmega256rfr2
CFLAGS += -mmcu=$(MCU)
LDFLAGS += -mmcu=$(MCU)
INCLUDES += \
-I$(STACK_PATH)/hal/atmega256rfr2/include
SRCS += \
$(STACK_PATH)/hal/atmega256rfr2/src/hal.c \
$(STACK_PATH)/hal/atmega256rfr2/src/halTimer.c \
$(STACK_PATH)/hal/atmega256rfr2/src/halUart.c \
$(STACK_PATH)/hal/atmega256rfr2/src/halSleep.c \
$(STACK_PATH)/hal/atmega256rfr2/src/halPhy.c
#
# atmega328p
#
else ifeq ($(HAL), ATMEGA328P)
CC = avr-gcc
OBJCOPY = avr-objcopy
SIZE = avr-size
MCU = atmega328p
CFLAGS += -mmcu=$(MCU)
LDFLAGS += -mmcu=$(MCU)
INCLUDES += \
-I$(STACK_PATH)/hal/atmega328p/include
SRCS += \
$(STACK_PATH)/hal/atmega328p/src/hal.c
#
# lpc1114
#
else ifeq ($(HAL), LPC1114)
CC = arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy
SIZE = arm-none-eabi-size
MCU = cortex-m0
CFLAGS += -mcpu=$(MCU) -mthumb -O1
LDFLAGS += -mcpu=$(MCU) -mthumb -nostartfiles
INCLUDES += \
-I$(STACK_PATH)/hal/lpc111x/include
SRCS += \
$(STACK_PATH)/hal/lpc111x/src/hal.c \
$(STACK_PATH)/hal/lpc111x/src/halPhy.c \
$(STACK_PATH)/hal/lpc111x/src/halTimer.c \
$(STACK_PATH)/hal/lpc111x/src/startup.c \
$(STACK_PATH)/hal/lpc111x/src/halUart.c \
$(STACK_PATH)/hal/lpc111x/src/halSleep.c
else
$(error unsupported HAL)
endif
##############################################################################
ifeq ($(PHY), ATMEGA128RFA1)
PHY_PATH = atmega128rfa1
else ifeq ($(PHY), ATMEGA256RFR2)
PHY_PATH = atmega256rfr2
else ifeq ($(PHY), AT86RF230)
PHY_PATH = at86rf230
else ifeq ($(PHY), AT86RF231)
PHY_PATH = at86rf231
else
$(error unsupported PHY)
endif
##############################################################################
ifeq ($(FREQ), 8_MHz)
F_CPU = 8000000
else ifeq ($(FREQ), 12_MHz)
F_CPU = 12000000
else ifeq ($(FREQ), 16_MHz)
F_CPU = 16000000
else
$(error unsupported FREQ)
endif
##############################################################################
DEFINES += \
-DHAL_$(HAL) \
-DPHY_$(PHY) \
-DBOARD_$(BOARD) \
-DF_CPU=$(F_CPU) \
-DLED_APP \
-DATMEGA256RFR2
INCLUDES += \
-I$(STACK_PATH)/phy/$(PHY_PATH)/include \
-I$(STACK_PATH)/sys/include \
-I$(STACK_PATH)/nwk/include
SRCS += \
$(STACK_PATH)/phy/$(PHY_PATH)/src/phy.c \
$(STACK_PATH)/sys/src/sysQueue.c \
$(STACK_PATH)/sys/src/sysTimer.c \
$(STACK_PATH)/sys/src/sysTaskManager.c \
$(STACK_PATH)/sys/src/sysMem.c \
$(STACK_PATH)/nwk/src/nwk.c \
$(STACK_PATH)/nwk/src/nwkDataReq.c \
$(STACK_PATH)/nwk/src/nwkSecurity.c \
$(STACK_PATH)/nwk/src/nwkFrame.c \
$(STACK_PATH)/nwk/src/nwkRoute.c \
$(STACK_PATH)/nwk/src/nwkRx.c \
$(STACK_PATH)/nwk/src/nwkTx.c
CFLAGS += $(INCLUDES) $(DEFINES)