Makefile: Fix the BOARDless targets
Currently boardless targets including softdevice, sudmodules and sim cannot be run unless a dummy value of BOARD is supplied. Fix this by distinguishing between conditional and unconditional expansions of the BOARD variable. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
cd97893d2c
commit
28961f1a54
1 changed files with 18 additions and 12 deletions
30
Makefile
30
Makefile
|
@ -2,14 +2,16 @@ export PYTHONPATH := $(PWD)/tools/nrfutil:$(PWD)/tools/intelhex:$(PYTHONPATH)
|
||||||
|
|
||||||
all : bootloader reloader micropython
|
all : bootloader reloader micropython
|
||||||
|
|
||||||
|
# If BOARD is undefined then set it up so that expanding it issues an
|
||||||
|
# error. That ensures that rules that expand BOARD will be automatically
|
||||||
|
# disabled (and give a useful error message) but it creates an additional
|
||||||
|
# problem which is that we must never unconditionally expand BOARD.
|
||||||
|
# We workaround this by using BOARD_SAFE for every unconditional
|
||||||
|
# expansion.
|
||||||
ifdef BOARD
|
ifdef BOARD
|
||||||
WASP_WATCH_PY = wasp/boards/$(BOARD)/watch.py
|
BOARD_SAFE = $(BOARD)
|
||||||
$(WASP_WATCH_PY) : $(WASP_WATCH_PY).in
|
|
||||||
(cd wasp; ../tools/preprocess.py ../$(WASP_WATCH_PY).in > ../$(WASP_WATCH_PY)) \
|
|
||||||
|| ($(RM) $(WASP_WATCH_PY); false)
|
|
||||||
else
|
|
||||||
BOARD ?= $(error Please set BOARD=)
|
|
||||||
endif
|
endif
|
||||||
|
BOARD ?= $(error Please set BOARD=)
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
$(RM) -r \
|
$(RM) -r \
|
||||||
|
@ -17,12 +19,12 @@ clean :
|
||||||
reloader/build-$(BOARD) reloader/src/boards/$(BOARD)/bootloader.h \
|
reloader/build-$(BOARD) reloader/src/boards/$(BOARD)/bootloader.h \
|
||||||
micropython/mpy-cross/build \
|
micropython/mpy-cross/build \
|
||||||
micropython/ports/nrf/build-$(BOARD)-s132 \
|
micropython/ports/nrf/build-$(BOARD)-s132 \
|
||||||
$(WASP_WATCH_PY)
|
wasp/boards/$(BOARD)/watch.py
|
||||||
|
|
||||||
submodules :
|
submodules :
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
bootloader: build-$(BOARD)
|
bootloader: build-$(BOARD_SAFE)
|
||||||
$(RM) bootloader/_build-$(BOARD)_nrf52832//$(BOARD)_nrf52832_bootloader-*-nosd.hex
|
$(RM) bootloader/_build-$(BOARD)_nrf52832//$(BOARD)_nrf52832_bootloader-*-nosd.hex
|
||||||
$(MAKE) -C bootloader/ BOARD=$(BOARD)_nrf52832 all genhex
|
$(MAKE) -C bootloader/ BOARD=$(BOARD)_nrf52832 all genhex
|
||||||
python3 tools/hexmerge.py \
|
python3 tools/hexmerge.py \
|
||||||
|
@ -36,14 +38,18 @@ bootloader: build-$(BOARD)
|
||||||
--softdevice bootloader/lib/softdevice/s132_nrf52_6.1.1/s132_nrf52_6.1.1_softdevice.hex \
|
--softdevice bootloader/lib/softdevice/s132_nrf52_6.1.1/s132_nrf52_6.1.1_softdevice.hex \
|
||||||
build-$(BOARD)/bootloader-daflasher.zip
|
build-$(BOARD)/bootloader-daflasher.zip
|
||||||
|
|
||||||
reloader: bootloader build-$(BOARD)
|
reloader: bootloader build-$(BOARD_SAFE)
|
||||||
$(MAKE) -C reloader/ BOARD=$(BOARD)
|
$(MAKE) -C reloader/ BOARD=$(BOARD)
|
||||||
mv reloader/build-$(BOARD)/reloader.zip build-$(BOARD)/
|
mv reloader/build-$(BOARD)/reloader.zip build-$(BOARD)/
|
||||||
|
|
||||||
softdevice:
|
softdevice:
|
||||||
micropython/ports/nrf/drivers/bluetooth/download_ble_stack.sh
|
micropython/ports/nrf/drivers/bluetooth/download_ble_stack.sh
|
||||||
|
|
||||||
micropython: $(WASP_WATCH_PY) build-$(BOARD)
|
wasp/boards/$(BOARD_SAFE)/watch.py : wasp/boards/$(BOARD_SAFE)/watch.py.in
|
||||||
|
(cd wasp; ../tools/preprocess.py boards/$(BOARD)/watch.py.in > boards/$(BOARD)/watch.py) \
|
||||||
|
|| ($(RM) wasp/boards/$(BOARD)/watch.py; false)
|
||||||
|
|
||||||
|
micropython: build-$(BOARD_SAFE) wasp/boards/$(BOARD_SAFE)/watch.py
|
||||||
$(MAKE) -C micropython/mpy-cross
|
$(MAKE) -C micropython/mpy-cross
|
||||||
$(RM) micropython/ports/nrf/build-$(BOARD)-s132/frozen_content.c
|
$(RM) micropython/ports/nrf/build-$(BOARD)-s132/frozen_content.c
|
||||||
$(MAKE) -C micropython/ports/nrf \
|
$(MAKE) -C micropython/ports/nrf \
|
||||||
|
@ -56,8 +62,8 @@ micropython: $(WASP_WATCH_PY) build-$(BOARD)
|
||||||
--application micropython/ports/nrf/build-$(BOARD)-s132/firmware.hex \
|
--application micropython/ports/nrf/build-$(BOARD)-s132/firmware.hex \
|
||||||
build-$(BOARD)/micropython.zip
|
build-$(BOARD)/micropython.zip
|
||||||
|
|
||||||
build-$(BOARD):
|
build-$(BOARD_SAFE):
|
||||||
mkdir -p $@
|
mkdir -p build-$(BOARD)
|
||||||
|
|
||||||
dfu:
|
dfu:
|
||||||
python3 -m nordicsemi dfu serial --package micropython.zip --port /dev/ttyACM0
|
python3 -m nordicsemi dfu serial --package micropython.zip --port /dev/ttyACM0
|
||||||
|
|
Loading…
Reference in a new issue