2019-02-15 18:55:10 -05:00
|
|
|
# This file is part of the MicroPython project, http://micropython.org/
|
|
|
|
#
|
|
|
|
# The MIT License (MIT)
|
|
|
|
#
|
|
|
|
# Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
# THE SOFTWARE.
|
|
|
|
|
2018-07-06 03:39:49 -04:00
|
|
|
# Select the board to build for.
|
|
|
|
ifeq ($(BOARD),)
|
|
|
|
$(info You must provide a BOARD parameter with 'BOARD=')
|
|
|
|
$(info Possible values are:)
|
|
|
|
$(info $(sort $(subst /.,,$(subst boards/,,$(wildcard boards/*/.)))))
|
|
|
|
$(error BOARD not defined)
|
|
|
|
else
|
|
|
|
ifeq ($(wildcard boards/$(BOARD)/.),)
|
|
|
|
$(error Invalid BOARD specified)
|
|
|
|
endif
|
2016-11-16 15:38:25 -05:00
|
|
|
endif
|
|
|
|
|
2018-11-28 19:58:44 -05:00
|
|
|
CLI_SD := $(SD)
|
2016-11-16 15:38:25 -05:00
|
|
|
SD_LOWER = $(shell echo $(SD) | tr '[:upper:]' '[:lower:]')
|
|
|
|
|
2018-11-28 19:58:44 -05:00
|
|
|
# Build directory with SD if it's different from the default.
|
|
|
|
BUILD ?= $(if $(CLI_SD),build-$(BOARD)-$(SD_LOWER),build-$(BOARD))
|
2017-12-22 05:29:39 -05:00
|
|
|
|
2018-06-20 15:21:45 -04:00
|
|
|
include ../../py/mkenv.mk
|
2019-02-15 18:55:10 -05:00
|
|
|
# Board-specific
|
|
|
|
include boards/$(BOARD)/mpconfigboard.mk
|
|
|
|
# Port-specific
|
|
|
|
include mpconfigport.mk
|
|
|
|
# CircuitPython-specific
|
2019-02-15 20:32:32 -05:00
|
|
|
include $(TOP)/py/circuitpy_mpconfig.mk
|
2019-02-15 18:55:10 -05:00
|
|
|
|
|
|
|
# qstr definitions (must come before including py.mk)
|
|
|
|
QSTR_DEFS = qstrdefsport.h
|
|
|
|
|
|
|
|
# include py core make definitions
|
|
|
|
include $(TOP)/py/py.mk
|
|
|
|
|
|
|
|
include $(TOP)/supervisor/supervisor.mk
|
|
|
|
|
|
|
|
# Include make rules and variables common across CircuitPython builds.
|
2019-02-15 20:32:32 -05:00
|
|
|
include $(TOP)/py/circuitpy_defns.mk
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2018-06-20 15:21:45 -04:00
|
|
|
ifneq ($(SD), )
|
2018-07-22 10:23:04 -04:00
|
|
|
include bluetooth/bluetooth_common.mk
|
2016-11-16 15:38:25 -05:00
|
|
|
endif
|
|
|
|
|
2017-02-25 19:30:33 -05:00
|
|
|
FROZEN_MPY_DIR = freeze
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
CROSS_COMPILE = arm-none-eabi-
|
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
|
|
|
|
|
|
|
INC += -I.
|
2017-10-04 15:54:01 -04:00
|
|
|
INC += -I../..
|
2016-11-16 15:38:25 -05:00
|
|
|
INC += -I$(BUILD)
|
2018-02-12 16:33:01 -05:00
|
|
|
INC += -I$(BUILD)/genhdr
|
2017-10-04 15:54:01 -04:00
|
|
|
INC += -I./../../lib/cmsis/inc
|
2018-06-20 12:15:34 -04:00
|
|
|
INC += -I./boards/$(BOARD)
|
2017-02-10 15:03:30 -05:00
|
|
|
INC += -I./modules/ubluepy
|
2017-05-11 12:34:12 -04:00
|
|
|
INC += -I./modules/ble
|
2018-06-25 17:33:39 -04:00
|
|
|
INC += -I./nrfx
|
|
|
|
INC += -I./nrfx/hal
|
|
|
|
INC += -I./nrfx/mdk
|
|
|
|
INC += -I./nrfx/drivers/include
|
2018-08-31 15:34:01 -04:00
|
|
|
INC += -I./bluetooth
|
|
|
|
INC += -I./peripherals
|
2017-10-04 15:54:01 -04:00
|
|
|
INC += -I../../lib/mp-readline
|
2018-07-04 05:40:53 -04:00
|
|
|
INC += -I../../lib/tinyusb/src
|
2018-10-19 21:46:22 -04:00
|
|
|
INC += -I../../supervisor/shared/usb
|
2016-11-16 15:38:25 -05:00
|
|
|
|
|
|
|
#Debugging/Optimization
|
|
|
|
ifeq ($(DEBUG), 1)
|
2019-02-15 18:55:10 -05:00
|
|
|
CFLAGS += -ggdb
|
2018-12-27 00:04:04 -05:00
|
|
|
# You may want to enable these flags to make setting breakpoints easier.
|
|
|
|
CFLAGS += -fno-inline -fno-ipa-sra
|
2016-11-16 15:38:25 -05:00
|
|
|
else
|
2018-12-27 00:04:04 -05:00
|
|
|
CFLAGS += -Os -DNDEBUG
|
2019-02-15 18:55:10 -05:00
|
|
|
# TODO: Test with -flto
|
|
|
|
### CFLAGS += -flto
|
2016-11-16 15:38:25 -05:00
|
|
|
endif
|
|
|
|
|
2017-07-17 18:18:05 -04:00
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
|
|
|
|
|
|
|
|
# Undo some warnings.
|
|
|
|
# nrfx uses undefined preprocessor variables quite casually, so we can't do warning checks for these.
|
|
|
|
CFLAGS += -Wno-undef
|
|
|
|
# nrfx does casts that increase alignment requirements.
|
|
|
|
CFLAGS += -Wno-cast-align
|
|
|
|
|
|
|
|
NRF_DEFINES += -DCONFIG_GPIO_AS_PINRESET
|
|
|
|
CFLAGS += $(NRF_DEFINES)
|
|
|
|
|
|
|
|
CFLAGS += \
|
|
|
|
-mthumb \
|
|
|
|
-mabi=aapcs-linux \
|
|
|
|
-mfloat-abi=hard \
|
|
|
|
-mcpu=cortex-m4 \
|
|
|
|
-mfpu=fpv4-sp-d16
|
|
|
|
|
|
|
|
# TODO: check this
|
|
|
|
CFLAGS += -D__START=main
|
|
|
|
|
|
|
|
LDFLAGS = $(CFLAGS) -nostartfiles -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
|
|
|
|
LIBS := -lgcc -lc
|
|
|
|
|
|
|
|
LDFLAGS += -mthumb -mcpu=cortex-m4
|
|
|
|
|
|
|
|
# Use toolchain libm if we're not using our own.
|
|
|
|
ifndef INTERNAL_LIBM
|
|
|
|
LIBS += -lm
|
|
|
|
endif
|
|
|
|
|
|
|
|
# TinyUSB defines
|
|
|
|
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_NRF5X -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD_CDC_TX_BUFSIZE=1024 -DCFG_TUD_MSC_BUFSIZE=4096 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2018-06-25 17:33:39 -04:00
|
|
|
SRC_NRFX = $(addprefix nrfx/,\
|
2018-07-09 15:02:52 -04:00
|
|
|
drivers/src/nrfx_power.c \
|
2018-06-25 17:33:39 -04:00
|
|
|
drivers/src/nrfx_spim.c \
|
2018-10-16 11:05:02 -04:00
|
|
|
drivers/src/nrfx_timer.c \
|
2018-06-28 16:45:02 -04:00
|
|
|
drivers/src/nrfx_twim.c \
|
2018-09-24 03:37:28 -04:00
|
|
|
drivers/src/nrfx_uarte.c \
|
2018-12-18 10:05:17 -05:00
|
|
|
drivers/src/nrfx_gpiote.c \
|
2016-11-16 15:38:25 -05:00
|
|
|
)
|
2017-12-21 07:49:14 -05:00
|
|
|
|
2018-10-19 21:46:22 -04:00
|
|
|
ifdef EXTERNAL_FLASH_DEVICES
|
|
|
|
ifeq ($(QSPI_FLASH_FILESYSTEM),1)
|
|
|
|
SRC_NRFX += nrfx/drivers/src/nrfx_qspi.c
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2016-11-16 17:39:40 -05:00
|
|
|
SRC_C += \
|
2018-07-10 11:49:51 -04:00
|
|
|
background.c \
|
2018-09-05 17:38:59 -04:00
|
|
|
fatfs_port.c \
|
|
|
|
mphalport.c \
|
|
|
|
tick.c \
|
2018-01-03 16:50:57 -05:00
|
|
|
boards/$(BOARD)/board.c \
|
2018-08-30 21:42:25 -04:00
|
|
|
boards/$(BOARD)/pins.c \
|
2017-12-21 07:49:14 -05:00
|
|
|
device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \
|
2018-08-31 15:34:01 -04:00
|
|
|
bluetooth/ble_drv.c \
|
|
|
|
bluetooth/ble_uart.c \
|
2018-09-05 17:38:59 -04:00
|
|
|
lib/libc/string0.c \
|
|
|
|
lib/mp-readline/readline.c \
|
2017-12-21 07:49:14 -05:00
|
|
|
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 \
|
2018-07-31 03:28:34 -04:00
|
|
|
lib/utils/interrupt_char.c \
|
2018-09-05 17:38:59 -04:00
|
|
|
lib/utils/pyexec.c \
|
2018-07-09 15:02:52 -04:00
|
|
|
lib/utils/stdout_helpers.c \
|
2018-07-31 23:19:20 -04:00
|
|
|
lib/utils/sys_stdio_mphal.c \
|
2018-09-05 17:38:59 -04:00
|
|
|
nrfx/hal/nrf_nvmc.c \
|
|
|
|
nrfx/mdk/system_$(MCU_SUB_VARIANT).c \
|
2018-09-09 15:01:28 -04:00
|
|
|
peripherals/nrf/cache.c \
|
|
|
|
peripherals/nrf/clocks.c \
|
2018-08-30 21:42:25 -04:00
|
|
|
peripherals/nrf/$(MCU_CHIP)/pins.c \
|
2018-09-09 15:01:28 -04:00
|
|
|
peripherals/nrf/$(MCU_CHIP)/power.c \
|
2018-10-16 11:05:02 -04:00
|
|
|
peripherals/nrf/timers.c \
|
2019-01-19 19:45:35 -05:00
|
|
|
sd_mutex.c \
|
2018-08-02 17:35:46 -04:00
|
|
|
supervisor/shared/memory.c
|
2018-07-04 06:15:49 -04:00
|
|
|
|
2018-07-31 05:42:04 -04:00
|
|
|
# USB source files for nrf52840
|
|
|
|
ifeq ($(MCU_SUB_VARIANT),nrf52840)
|
|
|
|
SRC_C += \
|
|
|
|
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c \
|
2018-11-23 15:51:11 -05:00
|
|
|
lib/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c
|
2018-07-31 05:42:04 -04:00
|
|
|
endif
|
2018-02-06 18:03:00 -05:00
|
|
|
|
2018-10-19 21:46:22 -04:00
|
|
|
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
|
|
|
|
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
|
|
|
|
$(addprefix common-hal/, $(SRC_COMMON_HAL))
|
2017-12-21 07:49:14 -05:00
|
|
|
|
2018-10-19 21:46:22 -04:00
|
|
|
SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \
|
2018-02-03 11:08:51 -05:00
|
|
|
$(addprefix shared-module/, $(SRC_SHARED_MODULE))
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2018-07-03 10:25:54 -04:00
|
|
|
SRC_S = supervisor/cpu.s
|
|
|
|
|
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))
|
2018-06-25 17:33:39 -04:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_NRFX:.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))
|
2019-02-15 18:55:10 -05:00
|
|
|
ifeq ($(INTERNAL_LIBM),1)
|
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
|
|
|
|
endif
|
2018-07-03 10:25:54 -04:00
|
|
|
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.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
|
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
# List of sources for qstr extraction
|
|
|
|
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
|
|
|
|
# Sources that only hold QSTRs after pre-processing.
|
|
|
|
SRC_QSTR_PREPROCESSOR +=
|
|
|
|
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
|
2017-02-25 19:52:46 -05:00
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
$(BUILD)/firmware.elf: $(OBJ)
|
|
|
|
$(STEPECHO) "LINK $@"
|
|
|
|
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group
|
|
|
|
$(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(LD_FILE)
|
2017-02-25 19:52:46 -05:00
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
|
|
|
|
$(STEPECHO) "Create $@"
|
|
|
|
$(Q)$(OBJCOPY) -O binary $^ $@
|
|
|
|
# $(Q)$(OBJCOPY) -O binary -j .vectors -j .text -j .data $^ $@
|
2017-02-25 19:52:46 -05:00
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
|
|
|
|
$(STEPECHO) "Create $@"
|
|
|
|
$(Q)$(OBJCOPY) -O ihex $^ $@
|
|
|
|
# $(Q)$(OBJCOPY) -O ihex -j .vectors -j .text -j .data $^ $@
|
2017-02-25 19:52:46 -05:00
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
$(BUILD)/firmware.uf2: $(BUILD)/firmware.hex
|
|
|
|
$(ECHO) "Create $@"
|
|
|
|
$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "$(BUILD)/firmware.uf2" $^
|
2017-02-25 19:52:46 -05:00
|
|
|
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2018-08-14 09:19:28 -04:00
|
|
|
|
2018-06-27 03:31:08 -04:00
|
|
|
#####################
|
|
|
|
# Flash with debugger
|
|
|
|
#####################
|
2017-01-03 11:00:06 -05:00
|
|
|
FLASHER ?=
|
|
|
|
|
|
|
|
ifeq ($(FLASHER),)
|
|
|
|
|
2018-06-27 04:22:44 -04:00
|
|
|
# Also update to bootloader settting to validate application and skip checksum ( app valid = 0x0001, crc = 0x0000 )
|
2019-02-15 18:55:10 -05:00
|
|
|
flash: $(BUILD)/firmware.hex
|
2018-06-08 04:11:17 -04:00
|
|
|
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)
|
|
|
|
nrfjprog --erasepage $(BOOT_SETTING_ADDR) -f $(MCU_VARIANT)
|
|
|
|
nrfjprog --memwr $(BOOT_SETTING_ADDR) --val 0x00000001 -f $(MCU_VARIANT)
|
|
|
|
nrfjprog --reset -f $(MCU_VARIANT)
|
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
sd: $(BUILD)/firmware.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)
|
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
flash: $(BUILD)/firmware.hex
|
2018-10-20 05:39:09 -04:00
|
|
|
pyocd-flashtool -t $(MCU_VARIANT) $< --sector_erase
|
|
|
|
#pyocd-tool -t $(MCU_VARIANT) erase $(BOOT_SETTING_ADDR)
|
|
|
|
pyocd-tool -t $(MCU_VARIANT) write32 $(BOOT_SETTING_ADDR) 0x00000001
|
|
|
|
pyocd-tool -t $(MCU_VARIANT) reset
|
2017-01-03 11:00:06 -05:00
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
sd: $(BUILD)/firmware.hex
|
2018-10-20 05:39:09 -04:00
|
|
|
pyocd-flashtool -t $(MCU_VARIANT) --chip_erase
|
|
|
|
pyocd-flashtool -t $(MCU_VARIANT) $(SOFTDEV_HEX)
|
|
|
|
pyocd-flashtool -t $(MCU_VARIANT) $< --sector_erase
|
|
|
|
pyocd-tool -t $(MCU_VARIANT) reset $(BOOT_SETTING_ADDR)
|
2018-07-13 09:17:30 -04:00
|
|
|
|
2017-01-03 11:00:06 -05:00
|
|
|
endif
|
|
|
|
|
2018-06-27 03:31:08 -04:00
|
|
|
#####################
|
|
|
|
# Flash with DFU
|
|
|
|
#####################
|
2018-08-14 09:19:28 -04:00
|
|
|
.phony: dfu-gen dfu-flash
|
2018-06-27 03:31:08 -04:00
|
|
|
|
2018-08-21 04:15:44 -04:00
|
|
|
NRFUTIL = adafruit-nrfutil
|
|
|
|
|
|
|
|
ifeq ($(MCU_SUB_VARIANT),nrf52840)
|
|
|
|
DFU_TOUCH = --touch 1200
|
2018-06-27 03:31:08 -04:00
|
|
|
else
|
2018-08-21 04:15:44 -04:00
|
|
|
DFU_TOUCH =
|
2018-06-27 03:31:08 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
check_defined = \
|
|
|
|
$(strip $(foreach 1,$1, \
|
|
|
|
$(call __check_defined,$1,$(strip $(value 2)))))
|
|
|
|
__check_defined = \
|
|
|
|
$(if $(value $1),, \
|
|
|
|
$(error Undefined make flag: $1$(if $2, ($2))))
|
|
|
|
|
2018-08-14 09:19:28 -04:00
|
|
|
## Flash with DFU serial
|
2018-06-27 04:11:50 -04:00
|
|
|
dfu-flash: $(BUILD)/dfu-package.zip
|
2018-06-27 03:31:08 -04:00
|
|
|
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyUSB0)
|
2018-08-21 04:15:44 -04:00
|
|
|
$(NRFUTIL) --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank $(DFU_TOUCH)
|
2018-06-27 03:31:08 -04:00
|
|
|
|
2018-08-14 09:19:28 -04:00
|
|
|
## Create DFU package file
|
2018-08-30 21:42:25 -04:00
|
|
|
dfu-gen: $(BUILD)/dfu-package.zip
|
2018-06-27 03:31:08 -04:00
|
|
|
|
2019-02-15 18:55:10 -05:00
|
|
|
$(BUILD)/dfu-package.zip: $(BUILD)/firmware.hex
|
2018-08-14 09:19:28 -04:00
|
|
|
$(NRFUTIL) dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application $^ $(BUILD)/dfu-package.zip
|
2018-06-27 03:31:08 -04:00
|
|
|
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2017-12-21 07:49:14 -05:00
|
|
|
include $(TOP)/py/mkrules.mk
|
2019-02-15 18:55:10 -05:00
|
|
|
|
|
|
|
# Print out the value of a make variable.
|
|
|
|
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
|
|
|
|
print-%:
|
|
|
|
@echo $* = $($*)
|