-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
53 lines (43 loc) · 1.96 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
MP_DIR := ${CURDIR}/vendor/micropython
UNIX_DIR := ${MP_DIR}/ports/unix
PORT_DIR := ${MP_DIR}/ports/esp32
BOARD := ribbit
BUILD_DIR := ${PORT_DIR}/build-${BOARD}
DEVICE := /dev/ttyACM*
.PHONY: build
build: ${MP_DIR}/mpy-cross/build/mpy-cross modules/ribbit/_static.py
rm -f ${BUILD_DIR}/frozen_content.c
ln -sfn ${CURDIR}/board ${PORT_DIR}/boards/ribbit
make -C ${PORT_DIR} BOARD=${BOARD} FROZEN_MANIFEST=${CURDIR}/manifest.py
mkdir -p ./firmware
cp ${BUILD_DIR}/bootloader/bootloader.bin ${BUILD_DIR}/partition_table/partition-table.bin ${BUILD_DIR}/ota_data_initial.bin ${BUILD_DIR}/micropython.bin ./firmware
# Workaround: mpy-cross fails to build with FROZEN_MANIFEST set
# Remove when that is fixed in MicroPython
${MP_DIR}/mpy-cross/build/mpy-cross:
make -C ${MP_DIR}/mpy-cross
modules/ribbit/_static.py: modules/ribbit/sensor-ui/*
python3 ./tools/generate_static.py
${UNIX_DIR}/build-standard/micropython: ${MP_DIR}/mpy-cross/build/mpy-cross
make -C ${MP_DIR}/ports/unix -j FROZEN_MANIFEST=${CURDIR}/manifest-unix.py
.PHONY: test
test: ${UNIX_DIR}/build-standard/micropython
cd modules ; ${UNIX_DIR}/build-standard/micropython -m unittest discover -p "*_test.py"
${UNIX_DIR}/build-simulator/micropython:
rm -rf ${UNIX_DIR}/variants/simulator
cp -rp ${CURDIR}/board-simulator ${UNIX_DIR}/variants/simulator
make -C ${MP_DIR}/ports/unix -j VARIANT=simulator
.PHONY: simulator
simulator: ${UNIX_DIR}/build-simulator/micropython modules/ribbit/_static.py
cd modules ; ${UNIX_DIR}/build-simulator/micropython -m main
.PHONY: flash
flash: build
esptool.py -p ${DEVICE} -b 460800 --before default_reset --after no_reset \
--chip esp32s3 \
write_flash --flash_mode dio --flash_size detect --flash_freq 80m \
0x0 firmware/bootloader.bin \
0x8000 firmware/partition-table.bin \
0xd000 firmware/ota_data_initial.bin \
0x10000 firmware/micropython.bin
.PHONY: clean
clean:
rm -rf ${BUILD_DIR} ${UNIX_DIR}/build-standard ${UNIX_DIR}/build-simulator modules/ribbit/_static.py