11# Select the board to build for: if not given on the command line,
2- # then default to feather52 .
3- BOARD ?= feather52
2+ # then default to feather52832 .
3+ BOARD ?= feather52832
44ifeq ($(wildcard boards/$(BOARD ) /.) ,)
55$(error Invalid BOARD specified)
66endif
@@ -12,24 +12,17 @@ SD_LOWER = $(shell echo $(SD) | tr '[:upper:]' '[:lower:]')
1212
1313# TODO: Verify that it is a valid target.
1414
15- ifeq ($(SD ) , )
16- # If the build directory is not given, make it reflect the board name.
17- BUILD ?= build-$(BOARD)
18- include ../../py/mkenv.mk
19- include boards/$(BOARD)/mpconfigboard.mk
20- -include mpconfigport.mk
15+ # If the build directory is not given, make it reflect the board name
16+ BUILD ?= $(if $(SD ) ,build-$(BOARD ) -$(SD_LOWER ) ,build-$(BOARD ) )
2117
22- else
23- # If the build directory is not given, make it reflect the board name.
24- BUILD ?= build-$(BOARD)-$(SD_LOWER)
25- include ../../py/mkenv.mk
26- include boards/$(BOARD)/mpconfigboard_$(SD_LOWER).mk
27- -include mpconfigport.mk
18+ include ../../py/mkenv.mk
19+ include boards/$(BOARD ) /mpconfigboard.mk
20+ -include mpconfigport.mk
2821
22+ ifneq ($(SD ) , )
2923 include drivers/bluetooth/bluetooth_common.mk
3024endif
3125
32-
3326# qstr definitions (must come before including py.mk)
3427QSTR_DEFS = qstrdefsport.h $(BUILD ) /pins_qstr.h
3528
@@ -44,43 +37,33 @@ FATFS_DIR = lib/oofatfs
4437
4538CROSS_COMPILE = arm-none-eabi-
4639
47- MCU_VARIANT_UPPER = $(shell echo $(MCU_VARIANT ) | tr '[:lower:]' '[:upper:]')
48-
4940INC += -I.
5041INC += -I../..
5142INC += -I$(BUILD )
5243INC += -I$(BUILD ) /genhdr
5344INC += -I./../../lib/cmsis/inc
45+ INC += -I./boards/$(BOARD )
5446INC += -I./device
5547INC += -I./device/$(MCU_VARIANT )
5648INC += -I./hal
5749INC += -I./hal/$(MCU_VARIANT )
58- INC += -I./modules/machine
5950INC += -I./modules/ubluepy
60- INC += -I./modules/music
6151INC += -I./modules/random
6252INC += -I./modules/ble
6353INC += -I../../lib/mp-readline
6454INC += -I./drivers/bluetooth
6555INC += -I./drivers
6656
67- NRF_DEFINES += -D$(MCU_VARIANT_UPPER )
6857NRF_DEFINES += -DCONFIG_GPIO_AS_PINRESET
6958
70- CFLAGS_CORTEX_M = -mthumb -mabi=aapcs -fsingle-precision-constant -Wdouble-promotion
71-
72- CFLAGS_MCU_m4 = $(CFLAGS_CORTEX_M ) -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard
73-
74- CFLAGS_MCU_m0 = $(CFLAGS_CORTEX_M ) --short-enums -mtune=cortex-m0 -mcpu=cortex-m0 -mfloat-abi=soft -fno-builtin
75-
76-
77- CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES ) )
59+ CFLAGS += -mthumb -mabi=aapcs -fsingle-precision-constant -Wdouble-promotion
60+ CFLAGS += -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard
7861CFLAGS += $(INC ) -Wall -Werror -ansi -std=gnu99 -nostdlib $(COPT ) $(NRF_DEFINES ) $(CFLAGS_MOD )
7962CFLAGS += -fno-strict-aliasing
8063CFLAGS += -fstack-usage
8164CFLAGS += -fdata-sections -ffunction-sections
82- CFLAGS += -Iboards/$(BOARD )
8365CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT ) _hal.h>'
66+ CFLAGS += -D__START=main
8467
8568LDFLAGS = $(CFLAGS )
8669LDFLAGS += -Xlinker -Map=$(@:.elf=.map )
@@ -97,17 +80,13 @@ CFLAGS += -Os -DNDEBUG
9780LDFLAGS += -Os
9881endif
9982
100- LIBS = \
101-
102- ifeq ($(MCU_VARIANT ) , nrf52)
10383LIBM_FILE_NAME = $(shell $(CC ) $(CFLAGS ) -print-file-name=libm.a)
10484LIBC_FILE_NAME = $(shell $(CC ) $(CFLAGS ) -print-file-name=libc.a)
10585LIBGCC_FILE_NAME = $(shell $(CC ) $(CFLAGS ) -print-libgcc-file-name)
10686
107- LIBS + = -L $(dir $(LIBM_FILE_NAME ) ) -lm
87+ LIBS : = -L $(dir $(LIBM_FILE_NAME ) ) -lm
10888LIBS += -L $(dir $(LIBC_FILE_NAME ) ) -lc
10989LIBS += -L $(dir $(LIBGCC_FILE_NAME ) ) -lgcc
110- endif
11190
11291SRC_HAL = $(addprefix hal/,\
11392 hal_uart.c \
@@ -122,19 +101,12 @@ SRC_HAL = $(addprefix hal/,\
122101 hal_temp.c \
123102 hal_gpio.c \
124103 hal_rng.c \
125- )
126-
127- ifeq ($(MCU_VARIANT ) , nrf52)
128- SRC_HAL += $(addprefix hal/,\
129104 hal_pwm.c \
130105 )
131- endif
132-
133106
134107SRC_C += \
135108 mphalport.c \
136109 help.c \
137- pin_named_pins.c \
138110 fatfs_port.c \
139111 fifo.c \
140112 tick.c \
@@ -143,7 +115,7 @@ SRC_C += \
143115 drivers/bluetooth/ble_drv.c \
144116 drivers/bluetooth/ble_uart.c \
145117 boards/$(BOARD ) /board.c \
146- device/ $( MCU_VARIANT ) /system_$(MCU_SUB_VARIANT ) .c \
118+ nrfx/mdk /system_$(MCU_SUB_VARIANT ) .c \
147119 device/$(MCU_VARIANT ) /startup_$(MCU_SUB_VARIANT ) .c \
148120 lib/oofatfs/ff.c \
149121 lib/oofatfs/option/ccsbcs.c \
@@ -158,18 +130,6 @@ SRC_C += \
158130
159131
160132DRIVERS_SRC_C += $(addprefix modules/,\
161- machine/modmachine.c \
162- machine/uart.c \
163- machine/spi.c \
164- machine/i2c.c \
165- machine/adc.c \
166- machine/pin.c \
167- machine/timer.c \
168- machine/pwm.c \
169- machine/led.c \
170- machine/temp.c \
171- utime/modutime.c \
172- pyb/modpyb.c \
173133 ubluepy/modubluepy.c \
174134 ubluepy/ubluepy_peripheral.c \
175135 ubluepy/ubluepy_service.c \
@@ -180,13 +140,10 @@ DRIVERS_SRC_C += $(addprefix modules/,\
180140 ubluepy/ubluepy_descriptor.c \
181141 ubluepy/ubluepy_scanner.c \
182142 ubluepy/ubluepy_scan_entry.c \
183- music/modmusic.c \
184- music/musictunes.c \
185143 ble/modble.c \
186144 random/modrandom.c \
187145 )
188146
189-
190147SRC_COMMON_HAL += \
191148 board/__init__.c \
192149 digitalio/__init__.c \
@@ -208,8 +165,8 @@ SRC_COMMON_HAL += \
208165 pulseio/PulseOut.c \
209166 pulseio/PWMOut.c \
210167 storage/__init__.c \
211- supervisor/__init__.c \
212- supervisor/Runtime.c \
168+ supervisor/__init__.c \
169+ supervisor/Runtime.c \
213170
214171# These don't have corresponding files in each port but are still located in
215172# shared-bindings to make it clear what the contents of the modules are.
@@ -333,10 +290,10 @@ SRC_QSTR_AUTO_DEPS +=
333290$(OBJ ) : | $(HEADER_BUILD ) /pins.h
334291
335292# Use a pattern rule here so that make will only call make-pins.py once to make
336- # both pins_$(BOARD) .c and pins.h
337- $(BUILD ) /% _gen.c $(HEADER_BUILD ) /% .h $(HEADER_BUILD ) / % _af_const.h $( BUILD ) /% _qstr.h : boards/$(BOARD ) /% .csv $(MAKE_PINS ) $(AF_FILE ) $(PREFIX_FILE ) | $(HEADER_BUILD )
293+ # both pins_g .c and pins.h
294+ $(BUILD ) /% _gen.c $(HEADER_BUILD ) /% .h $(BUILD ) /% _qstr.h : boards/$(BOARD ) /% .csv $(MAKE_PINS ) $(AF_FILE ) $(PREFIX_FILE ) | $(HEADER_BUILD )
338295 $(ECHO ) " Create $@ "
339- $(Q )$(PYTHON ) $(MAKE_PINS ) --board $(BOARD_PINS ) --af $(AF_FILE ) --prefix $(PREFIX_FILE ) --hdr $(GEN_PINS_HDR ) --qstr $(GEN_PINS_QSTR ) --af-const $( GEN_PINS_AF_CONST ) --af-py $( GEN_PINS_AF_PY ) > $(GEN_PINS_SRC )
296+ $(Q )$(PYTHON ) $(MAKE_PINS ) --board $(BOARD_PINS ) --af $(AF_FILE ) --prefix $(PREFIX_FILE ) --hdr $(GEN_PINS_HDR ) --qstr $(GEN_PINS_QSTR ) > $(GEN_PINS_SRC )
340297
341298$(BUILD ) /pins_gen.o : $(BUILD ) /pins_gen.c
342299 $(call compile_c)
@@ -348,8 +305,6 @@ PREFIX_FILE = boards/$(MCU_VARIANT)_prefix.c
348305GEN_PINS_SRC = $(BUILD ) /pins_gen.c
349306GEN_PINS_HDR = $(HEADER_BUILD ) /pins.h
350307GEN_PINS_QSTR = $(BUILD ) /pins_qstr.h
351- GEN_PINS_AF_CONST = $(HEADER_BUILD ) /pins_af_const.h
352- GEN_PINS_AF_PY = $(BUILD ) /pins_af.py
353308
354309ifneq ($(FROZEN_DIR ) ,)
355310# To use frozen source modules, put your .py files in a subdirectory (eg scripts/)
0 commit comments