1
1
# ******************************************************************************
2
2
# CONFIGURE
3
- # - SDK_PATH : path to SDK directory
4
- # - SRC_PATH : path to src folder
3
+ # - SDK_PATH : path to SDK directory
4
+ # - SRC_PATH : path to src folder
5
5
#
6
- # - SD_NAME : e.g s132, s140
7
- # - SD_VER1, SD_VER2, SD_VER3 : SoftDevice version e.g 6.0.0
8
- # - SD_HEX : to bootloader hex binary
6
+ # - SD_NAME : e.g s132, s140
7
+ # - SD_VERSION : SoftDevice version e.g 6.0.0
8
+ # - SD_HEX : to bootloader hex binary
9
9
# ******************************************************************************
10
10
SRC_PATH = src
11
11
@@ -16,26 +16,20 @@ SD_PATH = lib/softdevice/$(SD_FILENAME)
16
16
TUSB_PATH = lib/tinyusb/src
17
17
NRFX_PATH = lib/nrfx
18
18
19
- SD_VER1 = 6
20
- SD_VER2 = 1
21
- SD_VER3 = 1
22
-
23
- SD_VERSION = $(SD_VER1 ) .$(SD_VER2 ) .$(SD_VER3 )
19
+ SD_VERSION = 6.1.1
24
20
SD_FILENAME = $(SD_NAME ) _nrf52_$(SD_VERSION )
25
21
SD_API_PATH = $(SD_PATH ) /$(SD_FILENAME ) _API
26
22
SD_HEX = $(SD_PATH ) /$(SD_FILENAME ) _softdevice.hex
27
23
28
- LD_FILE = $(SRC_PATH ) /linker/$(SD_NAME ) _v$(SD_VER1 ) .ld
24
+ LD_FILE = $(SRC_PATH ) /linker/$(SD_NAME ) _v$(word 1, $( subst ., , $( SD_VERSION ) ) ) .ld
29
25
30
26
MERGED_FNAME = $(OUTPUT_FILENAME ) _$(SD_NAME ) _$(SD_VERSION )
31
27
32
-
33
- MK_DIS_FIRMWARE = "$(SD_NAME ) $(SD_VERSION ) "
34
-
35
28
GIT_VERSION = $(shell git describe --dirty --always --tags)
36
29
GIT_SUBMODULE_VERSIONS = $(shell git submodule status | cut -d' ' -f3,4 | paste -s -d" " -)
37
30
38
31
OUTPUT_FILENAME = $(BOARD ) _bootloader-$(GIT_VERSION )
32
+
39
33
# ******************************************************************************
40
34
# Tool configure
41
35
# ******************************************************************************
@@ -80,22 +74,15 @@ remduplicates = $(strip $(if $1,$(firstword $1) $(call remduplicates,$(filter-ou
80
74
# *********************************
81
75
# Select the board to build
82
76
# *********************************
83
- BOARD_LIST = $(sort $(subst .h,,$(subst src/boards/,,$(wildcard src/boards/* .h ) ) ) )
77
+ BOARD_LIST = $(sort $(subst .h,,$(subst src/boards/,,$(wildcard src/boards/* ) ) ) )
84
78
85
79
NRF52832_BOARDLIST = feather_nrf52832
86
80
IS_52832 = $(filter $(BOARD ) ,$(NRF52832_BOARDLIST ) )
87
81
88
- ifeq ($(filter $(MAKECMDGOALS ) ,all-board help) ,)
89
- ifeq ($(BOARD),)
90
- $(info You must provide a BOARD parameter with 'BOARD=')
91
- $(info Supported boards are : $(BOARD_LIST ) )
92
- $(info Run 'make help' for usage)
93
- $(error BOARD not defined)
94
- else
95
- ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
96
- $(error Invalid BOARD specified)
97
- endif
98
- endif
82
+ ifeq ($(filter $(BOARD ) ,$(BOARD_LIST ) ) ,)
83
+ $(info You must provide a BOARD parameter with 'BOARD='. Supported boards are :)
84
+ $(info $(BOARD_LIST))
85
+ $(error Invalid BOARD specified)
99
86
endif
100
87
101
88
BUILD = _build-$(BOARD )
@@ -108,8 +95,6 @@ SD_NAME = s140
108
95
DFU_DEV_REV = 52840
109
96
endif
110
97
111
-
112
-
113
98
# ******************************************************************************
114
99
# SOURCE FILES
115
100
# ******************************************************************************
@@ -201,6 +186,8 @@ endif
201
186
202
187
# src
203
188
IPATH += $(SRC_PATH )
189
+ IPATH += $(SRC_PATH ) /boards/$(BOARD )
190
+
204
191
IPATH += $(SRC_PATH ) /cmsis/include
205
192
IPATH += $(SRC_PATH ) /usb
206
193
IPATH += $(SRC_PATH ) /boards
@@ -232,7 +219,6 @@ IPATH += $(SDK_PATH)/drivers_nrf/delay
232
219
IPATH += $(SD_API_PATH ) /include
233
220
IPATH += $(SD_API_PATH ) /include/nrf52
234
221
235
-
236
222
INC_PATHS = $(addprefix -I,$(IPATH ) )
237
223
238
224
# ******************************************************************************
@@ -251,23 +237,20 @@ CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
251
237
CFLAGS += -fno-builtin --short-enums -fstack-usage
252
238
253
239
# Defined Symbol (MACROS)
254
-
255
- # TODO use GIT_VERSION (numberic format)
256
- CFLAGS += -DMK_BOOTLOADER_VERSION=0x0$(SD_VER1 ) 0$(SD_VER2 ) 0$(SD_VER3 ) UL
257
-
258
240
CFLAGS += -D__HEAP_SIZE=0
259
241
CFLAGS += -DCONFIG_GPIO_AS_PINRESET
242
+ CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
260
243
CFLAGS += -DBLE_STACK_SUPPORT_REQD
261
- CFLAGS += -DBSP_DEFINES_ONLY
262
244
CFLAGS += -DSWI_DISABLE0
263
245
CFLAGS += -DSOFTDEVICE_PRESENT
264
246
CFLAGS += -DFLOAT_ABI_HARD
265
- CFLAGS += -DMK_DIS_FIRMWARE='$(MK_DIS_FIRMWARE ) '
266
247
CFLAGS += -DDFU_APP_DATA_RESERVED=7*4096
267
248
268
249
CFLAGS += -DUF2_VERSION='"$(GIT_VERSION ) $(GIT_SUBMODULE_VERSIONS ) $(SD_NAME ) $(SD_VERSION ) "'
269
- CFLAGS += -DBOARD_$(shell echo $(BOARD ) | tr '[:lower:]' '[:upper:]')
270
- CFLAGS += -DBOARD_HEADER_FILE='"$(BOARD ) .h"'
250
+ CFLAGS += -DBLEDIS_FW_VERSION='"$(GIT_VERSION ) $(SD_NAME ) $(SD_VERSION ) "'
251
+
252
+ _VER = $(subst ., ,$(word 1, $(subst -, ,$(GIT_VERSION ) ) ) )
253
+ CFLAGS += -DMK_BOOTLOADER_VERSION='($(word 1,$(_VER ) ) << 16) + ($(word 2,$(_VER ) ) << 8) + $(word 3,$(_VER ) ) '
271
254
272
255
ifneq ($(IS_52832 ) ,)
273
256
CFLAGS += -DNRF52
@@ -302,9 +285,7 @@ LDFLAGS += --specs=nano.specs -lc -lnosys
302
285
# ******************************************************************************
303
286
ASMFLAGS += -x assembler-with-cpp
304
287
ASMFLAGS += -D__HEAP_SIZE=0
305
- ASMFLAGS += -DCONFIG_GPIO_AS_PINRESET
306
288
ASMFLAGS += -DBLE_STACK_SUPPORT_REQD
307
- ASMFLAGS += -DBSP_DEFINES_ONLY
308
289
ASMFLAGS += -DSWI_DISABLE0
309
290
ASMFLAGS += -DSOFTDEVICE_PRESENT
310
291
ASMFLAGS += -DFLOAT_ABI_HARD
@@ -348,29 +329,6 @@ endif
348
329
# default target to build
349
330
all : $(BUILD ) /$(OUTPUT_FILENAME ) -nosd.out size
350
331
351
- # Rule using BOARD_LIST, nl is newline
352
- define nl
353
-
354
-
355
- endef
356
-
357
- _make_board = $(MAKE ) -s -f $(MAKEFILE_LIST ) -e BOARD=$1 $2 $(nl )
358
- _make_all_board = $(foreach b,$(BOARD_LIST ) , $(call _make_board,$b,$1) )
359
-
360
- # build all the boards
361
- all-board :
362
- $(call _make_all_board,clean all)
363
-
364
- help :
365
- @echo To compile and build the current code for a board
366
- @echo $$ make BOARD=feather_nrf52840_express all
367
- @echo
368
- @echo To flash current code using Jlink
369
- @echo $$ make BOARD=feather_nrf52840_express flash
370
- @echo
371
- @echo To flash current code using existing bootloader dfu
372
- @echo $$ make BOARD=feather_nrf52840_express SERIAL=/dev/ttyACM0 dfu-flash
373
-
374
332
# ******************* Flash target *******************
375
333
376
334
check_defined = \
0 commit comments