2016-11-16 15:38:25 -05:00
|
|
|
# Select the board to build for: if not given on the command line,
|
2017-12-21 07:49:14 -05:00
|
|
|
# then default to feather52.
|
|
|
|
BOARD ?= feather52
|
2016-11-16 15:38:25 -05:00
|
|
|
ifeq ($(wildcard boards/$(BOARD)/.),)
|
|
|
|
$(error Invalid BOARD specified)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# If SoftDevice is selected, try to use that one.
|
2016-12-13 14:27:26 -05:00
|
|
|
SD ?=
|
2016-11-16 15:38:25 -05:00
|
|
|
SD_LOWER = $(shell echo $(SD) | tr '[:upper:]' '[:lower:]')
|
|
|
|
|
|
|
|
# TODO: Verify that it is a valid target.
|
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
ifeq ($(SD), )
|
2016-11-16 15:38:25 -05:00
|
|
|
# If the build directory is not given, make it reflect the board name.
|
|
|
|
BUILD ?= build-$(BOARD)
|
2017-10-04 15:54:01 -04:00
|
|
|
include ../../py/mkenv.mk
|
2016-11-16 15:38:25 -05:00
|
|
|
include boards/$(BOARD)/mpconfigboard.mk
|
2017-12-21 07:49:14 -05:00
|
|
|
-include mpconfigport.mk
|
2017-12-22 05:29:39 -05:00
|
|
|
|
|
|
|
INC += -Idrivers/bluetooth/s132_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/s132_$(MCU_VARIANT)_$(SOFTDEV_VERSION)_API/include
|
|
|
|
INC += -Idrivers/bluetooth/s132_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/s132_$(MCU_VARIANT)_$(SOFTDEV_VERSION)_API/include/$(MCU_VARIANT)
|
|
|
|
|
2016-11-16 15:38:25 -05:00
|
|
|
else
|
|
|
|
# If the build directory is not given, make it reflect the board name.
|
|
|
|
BUILD ?= build-$(BOARD)-$(SD_LOWER)
|
2017-10-04 15:54:01 -04:00
|
|
|
include ../../py/mkenv.mk
|
2016-11-16 15:38:25 -05:00
|
|
|
include boards/$(BOARD)/mpconfigboard_$(SD_LOWER).mk
|
2017-12-21 07:49:14 -05:00
|
|
|
-include mpconfigport.mk
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2017-05-11 12:53:53 -04:00
|
|
|
include drivers/bluetooth/bluetooth_common.mk
|
2016-11-16 15:38:25 -05:00
|
|
|
endif
|
|
|
|
|
2017-12-21 07:49:14 -05:00
|
|
|
|
2016-11-16 15:38:25 -05:00
|
|
|
# qstr definitions (must come before including py.mk)
|
2017-12-21 07:49:14 -05:00
|
|
|
QSTR_DEFS = qstrdefsport.h
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2017-02-25 19:30:33 -05:00
|
|
|
FROZEN_MPY_DIR = freeze
|
2016-11-16 15:38:25 -05:00
|
|
|
|
|
|
|
# include py core make definitions
|
2017-10-04 15:54:01 -04:00
|
|
|
include ../../py/py.mk
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2017-12-21 07:49:14 -05:00
|
|
|
include $(TOP)/supervisor/supervisor.mk
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2017-02-07 17:30:12 -05:00
|
|
|
FATFS_DIR = lib/oofatfs
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2016-11-16 15:38:25 -05:00
|
|
|
CROSS_COMPILE = arm-none-eabi-
|
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
MCU_VARIANT_UPPER = $(shell echo $(MCU_VARIANT) | tr '[:lower:]' '[:upper:]')
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
INC += -I.
|
2017-10-04 15:54:01 -04:00
|
|
|
INC += -I../..
|
2016-11-16 15:38:25 -05:00
|
|
|
INC += -I$(BUILD)
|
2017-10-04 15:54:01 -04:00
|
|
|
INC += -I./../../lib/cmsis/inc
|
2016-11-16 15:38:25 -05:00
|
|
|
INC += -I./device
|
2016-12-13 14:27:26 -05:00
|
|
|
INC += -I./device/$(MCU_VARIANT)
|
2016-11-16 15:38:25 -05:00
|
|
|
INC += -I./hal
|
2016-12-13 14:27:26 -05:00
|
|
|
INC += -I./hal/$(MCU_VARIANT)
|
2017-02-04 17:56:42 -05:00
|
|
|
INC += -I./modules/machine
|
2017-02-10 15:03:30 -05:00
|
|
|
INC += -I./modules/ubluepy
|
2017-05-16 19:05:41 -04:00
|
|
|
INC += -I./modules/music
|
2017-10-04 14:49:03 -04:00
|
|
|
INC += -I./modules/random
|
2017-05-11 12:34:12 -04:00
|
|
|
INC += -I./modules/ble
|
2017-10-04 15:54:01 -04:00
|
|
|
INC += -I../../lib/mp-readline
|
2017-05-11 12:53:53 -04:00
|
|
|
INC += -I./drivers/bluetooth
|
2017-05-16 19:05:41 -04:00
|
|
|
INC += -I./drivers
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2017-01-08 09:15:36 -05:00
|
|
|
NRF_DEFINES += -D$(MCU_VARIANT_UPPER)
|
2016-11-16 15:38:25 -05:00
|
|
|
NRF_DEFINES += -DCONFIG_GPIO_AS_PINRESET
|
|
|
|
|
|
|
|
CFLAGS_CORTEX_M = -mthumb -mabi=aapcs -fsingle-precision-constant -Wdouble-promotion
|
|
|
|
|
2017-10-11 18:44:24 -04:00
|
|
|
CFLAGS_MCU_m4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
2016-11-16 15:38:25 -05:00
|
|
|
|
|
|
|
CFLAGS_MCU_m0 = $(CFLAGS_CORTEX_M) --short-enums -mtune=cortex-m0 -mcpu=cortex-m0 -mfloat-abi=soft -fno-builtin
|
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2017-11-10 03:17:24 -05:00
|
|
|
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
|
2017-02-07 17:30:12 -05:00
|
|
|
CFLAGS += $(INC) -Wall -Werror -ansi -std=gnu99 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_MOD)
|
2016-12-13 14:27:26 -05:00
|
|
|
CFLAGS += -fno-strict-aliasing
|
2017-05-18 16:41:06 -04:00
|
|
|
CFLAGS += -fstack-usage
|
2017-10-11 18:44:24 -04:00
|
|
|
CFLAGS += -fdata-sections -ffunction-sections
|
2016-11-16 15:38:25 -05:00
|
|
|
CFLAGS += -Iboards/$(BOARD)
|
2016-12-13 14:27:26 -05:00
|
|
|
CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT)_hal.h>'
|
2016-11-16 15:38:25 -05:00
|
|
|
|
|
|
|
LDFLAGS = $(CFLAGS)
|
|
|
|
LDFLAGS += -Xlinker -Map=$(@:.elf=.map)
|
2016-12-13 14:27:26 -05:00
|
|
|
LDFLAGS += -mthumb -mabi=aapcs -T $(LD_FILE) -L boards/
|
2017-10-11 18:44:24 -04:00
|
|
|
LDFLAGS += -Wl,--gc-sections
|
2016-11-16 15:38:25 -05:00
|
|
|
|
|
|
|
#Debugging/Optimization
|
|
|
|
ifeq ($(DEBUG), 1)
|
2016-12-13 14:27:26 -05:00
|
|
|
#ASMFLAGS += -g -gtabs+
|
2016-11-16 15:38:25 -05:00
|
|
|
CFLAGS += -O0 -ggdb
|
|
|
|
LDFLAGS += -O0
|
|
|
|
else
|
|
|
|
CFLAGS += -Os -DNDEBUG
|
|
|
|
LDFLAGS += -Os
|
|
|
|
endif
|
|
|
|
|
2017-07-17 18:18:05 -04:00
|
|
|
LIBS = \
|
|
|
|
|
|
|
|
ifeq ($(MCU_VARIANT), nrf52)
|
|
|
|
LIBM_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-file-name=libm.a)
|
|
|
|
LIBC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-file-name=libc.a)
|
|
|
|
LIBGCC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
|
|
|
|
|
|
|
LIBS += -L $(dir $(LIBM_FILE_NAME)) -lm
|
|
|
|
LIBS += -L $(dir $(LIBC_FILE_NAME)) -lc
|
|
|
|
LIBS += -L $(dir $(LIBGCC_FILE_NAME)) -lgcc
|
|
|
|
endif
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
SRC_HAL = $(addprefix hal/,\
|
|
|
|
hal_uart.c \
|
|
|
|
hal_uarte.c \
|
|
|
|
hal_spi.c \
|
|
|
|
hal_spie.c \
|
|
|
|
hal_time.c \
|
2016-12-25 12:12:51 -05:00
|
|
|
hal_timer.c \
|
2017-01-11 10:54:56 -05:00
|
|
|
hal_twi.c \
|
2017-01-11 11:04:53 -05:00
|
|
|
hal_adc.c \
|
|
|
|
hal_adce.c \
|
2017-02-23 16:38:08 -05:00
|
|
|
hal_temp.c \
|
2017-04-11 07:59:54 -04:00
|
|
|
hal_gpio.c \
|
2017-10-04 14:45:40 -04:00
|
|
|
hal_rng.c \
|
2016-12-16 19:16:38 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
ifeq ($(MCU_VARIANT), nrf52)
|
|
|
|
SRC_HAL += $(addprefix hal/,\
|
2016-12-16 13:50:35 -05:00
|
|
|
hal_pwm.c \
|
2016-11-16 15:38:25 -05:00
|
|
|
)
|
2016-12-16 19:16:38 -05:00
|
|
|
endif
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2017-12-21 07:49:14 -05:00
|
|
|
|
2016-11-16 17:39:40 -05:00
|
|
|
SRC_C += \
|
2016-11-16 15:38:25 -05:00
|
|
|
mphalport.c \
|
|
|
|
help.c \
|
2016-12-13 14:27:26 -05:00
|
|
|
pin_named_pins.c \
|
|
|
|
fatfs_port.c \
|
2018-01-03 16:50:57 -05:00
|
|
|
fifo.c \
|
2017-05-16 19:05:41 -04:00
|
|
|
drivers/softpwm.c \
|
|
|
|
drivers/ticker.c \
|
2017-05-11 12:53:53 -04:00
|
|
|
drivers/bluetooth/ble_drv.c \
|
|
|
|
drivers/bluetooth/ble_uart.c \
|
2018-01-03 16:50:57 -05:00
|
|
|
boards/$(BOARD)/board.c \
|
|
|
|
boards/$(BOARD)/pins.c \
|
2017-12-21 07:49:14 -05:00
|
|
|
device/$(MCU_VARIANT)/system_$(MCU_SUB_VARIANT).c \
|
|
|
|
device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \
|
|
|
|
lib/oofatfs/ff.c \
|
|
|
|
lib/oofatfs/option/ccsbcs.c \
|
2018-01-03 16:50:57 -05:00
|
|
|
lib/timeutils/timeutils.c \
|
|
|
|
lib/utils/buffer_helper.c \
|
|
|
|
lib/utils/context_manager_helpers.c \
|
|
|
|
lib/utils/interrupt_char.c \
|
|
|
|
lib/utils/pyexec.c \
|
2017-12-21 07:49:14 -05:00
|
|
|
lib/libc/string0.c \
|
|
|
|
lib/mp-readline/readline.c \
|
2018-01-03 16:50:57 -05:00
|
|
|
internal_flash.c \
|
2017-12-22 05:29:39 -05:00
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2017-02-04 17:51:11 -05:00
|
|
|
DRIVERS_SRC_C += $(addprefix modules/,\
|
2017-02-04 17:56:42 -05:00
|
|
|
machine/modmachine.c \
|
2017-02-04 18:00:42 -05:00
|
|
|
machine/uart.c \
|
2017-02-04 18:03:49 -05:00
|
|
|
machine/spi.c \
|
2017-02-04 18:05:20 -05:00
|
|
|
machine/i2c.c \
|
2017-02-05 10:17:12 -05:00
|
|
|
machine/adc.c \
|
2017-02-05 13:56:24 -05:00
|
|
|
machine/pin.c \
|
2017-02-05 13:59:34 -05:00
|
|
|
machine/timer.c \
|
2017-02-05 14:03:52 -05:00
|
|
|
machine/pwm.c \
|
2017-02-05 14:06:24 -05:00
|
|
|
machine/led.c \
|
2017-02-23 16:38:08 -05:00
|
|
|
machine/temp.c \
|
2017-02-05 14:28:26 -05:00
|
|
|
utime/modutime.c \
|
2017-02-05 14:30:58 -05:00
|
|
|
pyb/modpyb.c \
|
2017-02-07 18:05:37 -05:00
|
|
|
ubluepy/modubluepy.c \
|
|
|
|
ubluepy/ubluepy_peripheral.c \
|
|
|
|
ubluepy/ubluepy_service.c \
|
|
|
|
ubluepy/ubluepy_characteristic.c \
|
|
|
|
ubluepy/ubluepy_uuid.c \
|
2017-02-14 18:17:47 -05:00
|
|
|
ubluepy/ubluepy_delegate.c \
|
2017-02-17 18:11:10 -05:00
|
|
|
ubluepy/ubluepy_constants.c \
|
2017-02-18 16:49:50 -05:00
|
|
|
ubluepy/ubluepy_descriptor.c \
|
2017-03-12 18:24:20 -04:00
|
|
|
ubluepy/ubluepy_scanner.c \
|
|
|
|
ubluepy/ubluepy_scan_entry.c \
|
2017-05-08 16:06:25 -04:00
|
|
|
music/modmusic.c \
|
|
|
|
music/musictunes.c \
|
2017-05-11 12:34:12 -04:00
|
|
|
ble/modble.c \
|
2017-10-04 14:49:03 -04:00
|
|
|
random/modrandom.c \
|
2017-01-04 11:13:19 -05:00
|
|
|
)
|
|
|
|
|
2017-12-22 05:29:39 -05:00
|
|
|
|
2017-12-21 07:49:14 -05:00
|
|
|
SRC_COMMON_HAL += \
|
2017-12-22 05:29:39 -05:00
|
|
|
board/__init__.c \
|
2017-12-21 07:49:14 -05:00
|
|
|
digitalio/__init__.c \
|
|
|
|
digitalio/DigitalInOut.c \
|
|
|
|
microcontroller/__init__.c \
|
|
|
|
microcontroller/Pin.c \
|
|
|
|
microcontroller/Processor.c \
|
|
|
|
os/__init__.c \
|
2018-01-03 16:50:57 -05:00
|
|
|
time/__init__.c \
|
2017-12-21 07:49:14 -05:00
|
|
|
analogio/__init__.c \
|
|
|
|
analogio/AnalogIn.c \
|
|
|
|
analogio/AnalogOut.c \
|
|
|
|
busio/__init__.c\
|
|
|
|
busio/I2C.c \
|
|
|
|
busio/SPI.c \
|
2018-01-03 16:50:57 -05:00
|
|
|
pulseio/__init__.c \
|
2017-12-21 07:49:14 -05:00
|
|
|
pulseio/PulseIn.c \
|
|
|
|
pulseio/PulseOut.c \
|
2018-01-03 16:50:57 -05:00
|
|
|
pulseio/PWMOut.c \
|
|
|
|
storage/__init__.c \
|
2017-12-21 07:49:14 -05:00
|
|
|
|
|
|
|
# These don't have corresponding files in each port but are still located in
|
|
|
|
# shared-bindings to make it clear what the contents of the modules are.
|
|
|
|
SRC_BINDINGS_ENUMS = \
|
|
|
|
digitalio/Direction.c \
|
|
|
|
digitalio/DriveMode.c \
|
|
|
|
digitalio/Pull.c \
|
2018-01-03 16:50:57 -05:00
|
|
|
microcontroller/RunMode.c \
|
2017-12-21 07:49:14 -05:00
|
|
|
help.c \
|
|
|
|
math/__init__.c \
|
|
|
|
supervisor/__init__.c \
|
|
|
|
util.c
|
|
|
|
|
|
|
|
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
|
|
|
|
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
|
|
|
|
$(addprefix common-hal/, $(SRC_COMMON_HAL))
|
|
|
|
|
|
|
|
SRC_SHARED_MODULE = \
|
2018-01-03 16:50:57 -05:00
|
|
|
os/__init__.c \
|
2017-12-21 07:49:14 -05:00
|
|
|
random/__init__.c \
|
|
|
|
storage/__init__.c \
|
|
|
|
|
|
|
|
# bitbangio/__init__.c \
|
|
|
|
bitbangio/I2C.c \
|
|
|
|
bitbangio/OneWire.c \
|
|
|
|
bitbangio/SPI.c \
|
|
|
|
busio/OneWire.c \
|
|
|
|
gamepad/__init__.c \
|
|
|
|
gamepad/GamePad.c \
|
|
|
|
struct/__init__.c \
|
|
|
|
uheap/__init__.c \
|
|
|
|
ustack/__init__.c
|
|
|
|
|
|
|
|
#SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \
|
|
|
|
$(addprefix shared-module/, $(SRC_SHARED_MODULE))
|
|
|
|
|
|
|
|
SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-module/, $(SRC_SHARED_MODULE))
|
2016-12-13 14:27:26 -05:00
|
|
|
|
|
|
|
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
|
|
|
|
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2017-12-21 07:49:14 -05:00
|
|
|
OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
2016-12-13 14:27:26 -05:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_HAL:.c=.o))
|
2017-01-04 11:13:19 -05:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
|
2017-12-21 07:49:14 -05:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o))
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED_MODULE_EXPANDED:.c=.o))
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
|
|
|
|
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
|
|
|
|
|
2017-02-25 19:52:46 -05:00
|
|
|
.phony: all flash sd binary hex
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2017-02-25 19:52:46 -05:00
|
|
|
all: binary hex
|
|
|
|
|
|
|
|
OUTPUT_FILENAME = firmware
|
|
|
|
|
|
|
|
## Create binary .bin file from the .out file
|
|
|
|
binary: $(BUILD)/$(OUTPUT_FILENAME).bin
|
|
|
|
|
|
|
|
$(BUILD)/$(OUTPUT_FILENAME).bin: $(BUILD)/$(OUTPUT_FILENAME).elf
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
|
|
|
|
## Create binary .hex file from the .out file
|
|
|
|
hex: $(BUILD)/$(OUTPUT_FILENAME).hex
|
|
|
|
|
|
|
|
$(BUILD)/$(OUTPUT_FILENAME).hex: $(BUILD)/$(OUTPUT_FILENAME).elf
|
|
|
|
$(OBJCOPY) -O ihex $< $@
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2017-01-03 11:00:06 -05:00
|
|
|
FLASHER ?=
|
|
|
|
|
|
|
|
ifeq ($(FLASHER),)
|
|
|
|
|
2017-02-25 19:52:46 -05:00
|
|
|
flash: $(BUILD)/$(OUTPUT_FILENAME).hex
|
|
|
|
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)
|
2017-01-08 09:17:03 -05:00
|
|
|
nrfjprog --reset -f $(MCU_VARIANT)
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2017-02-25 19:52:46 -05:00
|
|
|
sd: $(BUILD)/$(OUTPUT_FILENAME).hex
|
2016-12-13 14:27:26 -05:00
|
|
|
nrfjprog --eraseall -f $(MCU_VARIANT)
|
|
|
|
nrfjprog --program $(SOFTDEV_HEX) -f $(MCU_VARIANT)
|
2017-02-25 19:52:46 -05:00
|
|
|
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)
|
2017-01-08 09:17:03 -05:00
|
|
|
nrfjprog --reset -f $(MCU_VARIANT)
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2017-01-03 11:00:06 -05:00
|
|
|
else ifeq ($(FLASHER), pyocd)
|
|
|
|
|
2017-02-25 19:52:46 -05:00
|
|
|
flash: $(BUILD)/$(OUTPUT_FILENAME).hex
|
|
|
|
pyocd-flashtool -t $(MCU_VARIANT) $<
|
2017-01-03 11:00:06 -05:00
|
|
|
|
2017-02-25 19:52:46 -05:00
|
|
|
sd: $(BUILD)/$(OUTPUT_FILENAME).hex
|
2017-02-16 17:18:07 -05:00
|
|
|
pyocd-flashtool -t $(MCU_VARIANT) --chip_erase
|
|
|
|
pyocd-flashtool -t $(MCU_VARIANT) $(SOFTDEV_HEX)
|
2017-02-25 19:52:46 -05:00
|
|
|
pyocd-flashtool -t $(MCU_VARIANT) $<
|
2017-02-16 17:18:07 -05:00
|
|
|
|
2017-01-03 11:00:06 -05:00
|
|
|
endif
|
|
|
|
|
2017-02-25 19:52:46 -05:00
|
|
|
$(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ)
|
2016-11-16 15:38:25 -05:00
|
|
|
$(ECHO) "LINK $@"
|
2017-12-21 07:49:14 -05:00
|
|
|
$(Q)$(CC) $(LDFLAGS) -o $@ $(OBJ) -Wl,--start-group $(LIBS) -Wl,--end-group
|
2016-11-16 15:38:25 -05:00
|
|
|
$(Q)$(SIZE) $@
|
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
# List of sources for qstr extraction
|
2017-12-21 07:49:14 -05:00
|
|
|
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(DRIVERS_SRC_C) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
# Append any auto-generated sources that are needed by sources listed in
|
|
|
|
# SRC_QSTR
|
|
|
|
SRC_QSTR_AUTO_DEPS +=
|
|
|
|
|
|
|
|
# Making OBJ use an order-only depenedency on the generated pins.h file
|
|
|
|
# has the side effect of making the pins.h file before we actually compile
|
|
|
|
# any of the objects. The normal dependency generation will deal with the
|
|
|
|
# case when pins.h is modified. But when it doesn't exist, we don't know
|
|
|
|
# which source files might need it.
|
2017-12-21 07:49:14 -05:00
|
|
|
#$(OBJ): | $(HEADER_BUILD)/pins.h
|
2016-12-13 14:27:26 -05:00
|
|
|
|
|
|
|
# Use a pattern rule here so that make will only call make-pins.py once to make
|
|
|
|
# both pins_$(BOARD).c and pins.h
|
2017-12-21 07:49:14 -05:00
|
|
|
#$(BUILD)/%_$(BOARD).c $(HEADER_BUILD)/%.h $(HEADER_BUILD)/%_af_const.h $(BUILD)/%_qstr.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
|
|
|
|
# $(ECHO) "Create $@"
|
|
|
|
# $(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)
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2017-12-21 07:49:14 -05:00
|
|
|
#$(BUILD)/pins_gen.o: $(BUILD)/pins_gen.c
|
|
|
|
# $(call compile_c)
|
2016-12-13 14:27:26 -05:00
|
|
|
|
|
|
|
MAKE_PINS = boards/make-pins.py
|
|
|
|
BOARD_PINS = boards/$(BOARD)/pins.csv
|
|
|
|
AF_FILE = $(MCU_VARIANT)_af.csv
|
|
|
|
PREFIX_FILE = boards/$(MCU_VARIANT)_prefix.c
|
|
|
|
GEN_PINS_SRC = $(BUILD)/pins_gen.c
|
|
|
|
GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
|
|
|
|
GEN_PINS_QSTR = $(BUILD)/pins_qstr.h
|
|
|
|
GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins_af_const.h
|
|
|
|
GEN_PINS_AF_PY = $(BUILD)/pins_af.py
|
|
|
|
|
2017-01-22 16:18:44 -05:00
|
|
|
ifneq ($(FROZEN_DIR),)
|
|
|
|
# To use frozen source modules, put your .py files in a subdirectory (eg scripts/)
|
|
|
|
# and then invoke make with FROZEN_DIR=scripts (be sure to build from scratch).
|
|
|
|
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
|
|
|
|
endif
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2017-01-22 16:18:44 -05:00
|
|
|
ifneq ($(FROZEN_MPY_DIR),)
|
|
|
|
# To use frozen bytecode, put your .py files in a subdirectory (eg frozen/) and
|
|
|
|
# then invoke make with FROZEN_MPY_DIR=frozen (be sure to build from scratch).
|
|
|
|
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
|
|
|
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
|
|
|
endif
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2017-12-21 07:49:14 -05:00
|
|
|
include $(TOP)/py/mkrules.mk
|