2022-05-11 20:25:50 +00:00
|
|
|
PORT ?= /dev/ttyACM0
|
|
|
|
BUILDDIR ?= build
|
|
|
|
IDF_PATH ?= $(shell pwd)/esp-idf
|
|
|
|
IDF_EXPORT_QUIET ?= 0
|
|
|
|
SHELL := /usr/bin/env bash
|
|
|
|
|
|
|
|
.PHONY: prepare clean build flash erase monitor menuconfig image qemu install
|
|
|
|
|
2022-05-12 20:42:35 +00:00
|
|
|
all: prepare build flash
|
|
|
|
|
2022-05-11 20:25:50 +00:00
|
|
|
prepare:
|
|
|
|
git submodule update --init --recursive
|
|
|
|
cd esp-idf; bash install.sh
|
|
|
|
|
|
|
|
clean:
|
2022-05-11 22:31:00 +00:00
|
|
|
rm -rf "$(BUILDDIR)"
|
2022-05-11 20:25:50 +00:00
|
|
|
|
|
|
|
build:
|
2022-05-11 22:31:00 +00:00
|
|
|
source "$(IDF_PATH)/export.sh" && idf.py build
|
2022-05-11 20:25:50 +00:00
|
|
|
|
|
|
|
flash: build
|
2022-05-11 22:31:00 +00:00
|
|
|
source "$(IDF_PATH)/export.sh" && idf.py flash -p $(PORT)
|
2022-05-11 20:25:50 +00:00
|
|
|
|
|
|
|
erase:
|
2022-05-11 22:31:00 +00:00
|
|
|
source "$(IDF_PATH)/export.sh" && idf.py erase-flash -p $(PORT)
|
2022-05-11 20:25:50 +00:00
|
|
|
|
|
|
|
monitor:
|
2022-05-11 22:31:00 +00:00
|
|
|
source "$(IDF_PATH)/export.sh" && idf.py monitor -p $(PORT)
|
2022-05-11 20:25:50 +00:00
|
|
|
|
|
|
|
menuconfig:
|
2022-05-11 22:31:00 +00:00
|
|
|
source "$(IDF_PATH)/export.sh" && idf.py menuconfig
|
2022-05-11 20:25:50 +00:00
|
|
|
|
|
|
|
image:
|
2022-05-11 22:31:00 +00:00
|
|
|
cd "$(BUILDDIR)"; dd if=/dev/zero bs=1M count=16 of=flash.bin
|
|
|
|
cd "$(BUILDDIR)"; dd if=bootloader/bootloader.bin bs=1 seek=4096 of=flash.bin conv=notrunc
|
|
|
|
cd "$(BUILDDIR)"; dd if=partition_table/partition-table.bin bs=1 seek=36864 of=flash.bin conv=notrunc
|
|
|
|
cd "$(BUILDDIR)"; dd if=main.bin bs=1 seek=65536 of=flash.bin conv=notrunc
|
2022-05-11 20:25:50 +00:00
|
|
|
|
|
|
|
qemu: image
|
2022-05-11 22:31:00 +00:00
|
|
|
cd "$(BUILDDIR)"; qemu-system-xtensa -nographic -machine esp32 -drive 'file=flash.bin,if=mtd,format=raw'
|
2022-05-11 20:25:50 +00:00
|
|
|
|
|
|
|
install: flash
|
|
|
|
|