circuitpython/ports/esp32/Makefile
Jim Mussared 19f5da9e1b esp32/Makefile: Force micropython-lib as a required submodule.
Also use mkrules.mk's submodule target rather than duplicating the call to
`submodule sync`.

Until we can find a way to use idf.py/cmake to discover submodules we have
no way to discover optional or board-specific submodules so need to err on
the side of including everything.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-03 00:07:35 +10:00

60 lines
1.6 KiB
Makefile

# Makefile for MicroPython on ESP32.
#
# This is a simple, convenience wrapper around idf.py (which uses cmake).
# Select the board to build for, defaulting to GENERIC.
BOARD ?= GENERIC
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
# Device serial settings.
PORT ?= /dev/ttyUSB0
BAUD ?= 460800
PYTHON ?= python3
# Would be good to use cmake to discover submodules (see how rp2/Makefile does
# it), but on ESP32 the same trick doesn't work because "idf.py build" fails
# on berkeley-db dependency before printing out the submodule list.
# For now just force the submodule dependencies here.
GIT_SUBMODULES += lib/berkeley-db-1.xx lib/micropython-lib
.PHONY: all clean deploy erase submodules FORCE
CMAKE_ARGS =
ifdef USER_C_MODULES
CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES}
endif
IDFPY_FLAGS += -D MICROPY_BOARD=$(BOARD) -B $(BUILD) $(CMAKE_ARGS)
ifdef FROZEN_MANIFEST
IDFPY_FLAGS += -D MICROPY_FROZEN_MANIFEST=$(FROZEN_MANIFEST)
endif
all:
idf.py $(IDFPY_FLAGS) build
@$(PYTHON) makeimg.py \
$(BUILD)/sdkconfig \
$(BUILD)/bootloader/bootloader.bin \
$(BUILD)/partition_table/partition-table.bin \
$(BUILD)/micropython.bin \
$(BUILD)/firmware.bin \
$(BUILD)/micropython.uf2
$(BUILD)/bootloader/bootloader.bin $(BUILD)/partition_table/partition-table.bin $(BUILD)/micropython.bin: FORCE
clean:
idf.py $(IDFPY_FLAGS) fullclean
deploy:
idf.py $(IDFPY_FLAGS) -p $(PORT) -b $(BAUD) flash
erase:
idf.py $(IDFPY_FLAGS) -p $(PORT) -b $(BAUD) erase_flash
submodules:
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$(GIT_SUBMODULES)" submodules