chore: unify building system with Makefile (#398)
* reorder and extend platformio config * update gitignore * add processing extra_script * add makefile * update github workflow * update docker build * add release and debug targets * define custom_build debug * fix custom_build target * update README
This commit is contained in:
45
.github/workflows/build.yml
vendored
45
.github/workflows/build.yml
vendored
@@ -44,14 +44,13 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
~/.cache/pip
|
~/.cache/pip
|
||||||
~/.platformio/.cache
|
~/.platformio/.cache
|
||||||
key: ${{ runner.os }}-pio
|
~/.platformio/packages
|
||||||
|
key: ${{ runner.os }}-pio-${{ matrix.board }}
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.9'
|
python-version: '3.9'
|
||||||
- name: Install PlatformIO Core
|
- name: Install dependencies
|
||||||
run: pip install --upgrade platformio
|
run: make deps
|
||||||
- name: Install ESPTool
|
|
||||||
run: pip install --upgrade esptool
|
|
||||||
- name: Add version info
|
- name: Add version info
|
||||||
env:
|
env:
|
||||||
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
|
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
|
||||||
@@ -63,42 +62,8 @@ jobs:
|
|||||||
BOARD="${BOARD}_dbg"
|
BOARD="${BOARD}_dbg"
|
||||||
fi
|
fi
|
||||||
echo "::group::Building with PlatformIO"
|
echo "::group::Building with PlatformIO"
|
||||||
pio run --environment ${BOARD}
|
make $BOARD
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
mkdir -p ${BUILD}/${VARIANT}
|
|
||||||
cp -v .pio/build/${BOARD}/firmware.bin ${BUILD}/${VARIANT}/nuki_hub_${VARIANT}.bin
|
|
||||||
cp -v .pio/build/${BOARD}/partitions.bin ${BUILD}/${VARIANT}/nuki_hub.partitions.bin
|
|
||||||
cp -v .pio/build/${BOARD}/bootloader.bin ${BUILD}/${VARIANT}/bootloader.bin
|
|
||||||
if [ "$BUILD" = "debug" ]; then
|
|
||||||
cp -v .pio/build/${BOARD}/firmware.elf ${BUILD}/${VARIANT}/nuki_hub_${VARIANT}.elf
|
|
||||||
fi
|
|
||||||
cp -v bin/boot_app0.bin ${BUILD}/${VARIANT}/boot_app0.bin
|
|
||||||
cp -v how-to-flash.txt ${BUILD}/${VARIANT}/how-to-flash.txt
|
|
||||||
|
|
||||||
- name: Pack webflash image
|
|
||||||
if: ${{ matrix.build == 'release' && matrix.board != 'esp32solo1' }}
|
|
||||||
env:
|
|
||||||
POSITION_BOOTLOADER: "0x0"
|
|
||||||
POSITION_PARTITIONS: "0x8000"
|
|
||||||
POSITION_BOOT_APP: "0xe000"
|
|
||||||
POSITION_APP: "0x10000"
|
|
||||||
CHIP: ${{ env.VARIANT }}
|
|
||||||
FILES: ${{ format('{0}/{1}', env.BUILD, env.VARIANT) }}
|
|
||||||
run: |
|
|
||||||
if [ "$BOARD" = "esp32dev" ]; then
|
|
||||||
POSITION_BOOTLOADER="0x1000"
|
|
||||||
fi
|
|
||||||
|
|
||||||
esptool.py \
|
|
||||||
--chip ${CHIP} \
|
|
||||||
merge_bin -o ${FILES}/webflash_nuki_hub_${VARIANT}.bin \
|
|
||||||
--flash_mode dio \
|
|
||||||
--flash_freq keep \
|
|
||||||
--flash_size keep \
|
|
||||||
${POSITION_BOOT_APP} bin/boot_app0.bin \
|
|
||||||
${POSITION_BOOTLOADER} ${FILES}/bootloader.bin \
|
|
||||||
${POSITION_APP} ${FILES}/nuki_hub_${VARIANT}.bin \
|
|
||||||
${POSITION_PARTITIONS} ${FILES}/nuki_hub.partitions.bin
|
|
||||||
|
|
||||||
- name: Add flash script
|
- name: Add flash script
|
||||||
env:
|
env:
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -11,3 +11,8 @@ webflash/*.bin
|
|||||||
.pio
|
.pio
|
||||||
.vscode
|
.vscode
|
||||||
.project
|
.project
|
||||||
|
|
||||||
|
# Python venv
|
||||||
|
/pyvenv.cfg
|
||||||
|
/lib64
|
||||||
|
/lib/python3*
|
||||||
|
|||||||
9
Docker/Dockerfile
Normal file
9
Docker/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
FROM eclipse-temurin:11-jdk-jammy AS builder
|
||||||
|
|
||||||
|
RUN set -ex && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y git python3 pip make && \
|
||||||
|
pip install --upgrade platformio && \
|
||||||
|
pip install --upgrade esptool
|
||||||
|
|
||||||
|
CMD ["/bin/bash"]
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
FROM eclipse-temurin:11-jdk-jammy AS builder
|
|
||||||
|
|
||||||
RUN set -ex && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y git python3 pip && \
|
|
||||||
pip install --upgrade platformio && \
|
|
||||||
pip install --upgrade esptool
|
|
||||||
|
|
||||||
COPY icon /usr/src/nuki_hub/icon
|
|
||||||
COPY include /usr/src/nuki_hub/include
|
|
||||||
COPY lib /usr/src/nuki_hub/lib
|
|
||||||
COPY networkDevices /usr/src/nuki_hub/networkDevices
|
|
||||||
COPY partitions.csv /usr/src/nuki_hub
|
|
||||||
COPY platformio.ini /usr/src/nuki_hub
|
|
||||||
COPY index.html /usr/src/nuki_hub
|
|
||||||
COPY *.h /usr/src/nuki_hub/
|
|
||||||
COPY *.cpp /usr/src/nuki_hub/
|
|
||||||
|
|
||||||
RUN set -ex && \
|
|
||||||
cd /usr/src/nuki_hub && \
|
|
||||||
mkdir -p release/esp32 && \
|
|
||||||
mkdir -p release/esp32s3 && \
|
|
||||||
mkdir -p release/esp32c3 && \
|
|
||||||
mkdir -p release/esp32solo1 && \
|
|
||||||
pio run --environment esp32dev && \
|
|
||||||
esptool.py --chip esp32 merge_bin -o release/webflash_nuki_hub_esp32.bin --flash_mode dio --flash_freq keep --flash_size keep 0x1000 .pio/build/esp32dev/bootloader.bin 0x10000 .pio/build/esp32dev/firmware.bin 0x8000 .pio/build/esp32dev/partitions.bin && \
|
|
||||||
cp .pio/build/esp32dev/bootloader.bin release/esp32/bootloader.bin && \
|
|
||||||
cp .pio/build/esp32dev/firmware.bin release/esp32/nuki_hub_esp32.bin && \
|
|
||||||
cp .pio/build/esp32dev/partitions.bin release/esp32/nuki_hub.partitions.bin && \
|
|
||||||
pio run --environment esp32-s3 && \
|
|
||||||
esptool.py --chip esp32s3 merge_bin -o release/webflash_nuki_hub_esp32s3.bin --flash_mode dio --flash_freq keep --flash_size keep 0x0 .pio/build/esp32-s3/bootloader.bin 0x10000 .pio/build/esp32-s3/firmware.bin 0x8000 .pio/build/esp32-s3/partitions.bin && \
|
|
||||||
cp .pio/build/esp32-s3/bootloader.bin release/esp32s3/bootloader.bin && \
|
|
||||||
cp .pio/build/esp32-s3/firmware.bin release/esp32s3/nuki_hub_esp32s3.bin && \
|
|
||||||
cp .pio/build/esp32-s3/partitions.bin release/esp32s3/nuki_hub.partitions.bin && \
|
|
||||||
pio run --environment esp32-c3 && \
|
|
||||||
esptool.py --chip esp32c3 merge_bin -o release/webflash_nuki_hub_esp32c3.bin --flash_mode dio --flash_freq keep --flash_size keep 0x0 .pio/build/esp32-c3/bootloader.bin 0x10000 .pio/build/esp32-c3/firmware.bin 0x8000 .pio/build/esp32-c3/partitions.bin && \
|
|
||||||
cp .pio/build/esp32-c3/bootloader.bin release/esp32c3/bootloader.bin && \
|
|
||||||
cp .pio/build/esp32-c3/firmware.bin release/esp32c3/nuki_hub_esp32c3.bin && \
|
|
||||||
cp .pio/build/esp32-c3/partitions.bin release/esp32c3/nuki_hub.partitions.bin && \
|
|
||||||
pio run --environment esp32solo1 && \
|
|
||||||
cp .pio/build/esp32solo1/bootloader.bin release/esp32solo1/bootloader.bin && \
|
|
||||||
cp .pio/build/esp32solo1/firmware.bin release/esp32solo1/nuki_hub_esp32solo1.bin && \
|
|
||||||
cp .pio/build/esp32solo1/partitions.bin release/esp32solo1/nuki_hub.partitions.bin
|
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
FROM eclipse-temurin:11-jdk-jammy AS builder
|
|
||||||
|
|
||||||
RUN set -ex && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y git python3 pip && \
|
|
||||||
pip install --upgrade platformio && \
|
|
||||||
pip install --upgrade esptool
|
|
||||||
|
|
||||||
COPY icon /usr/src/nuki_hub/icon
|
|
||||||
COPY include /usr/src/nuki_hub/include
|
|
||||||
COPY lib /usr/src/nuki_hub/lib
|
|
||||||
COPY networkDevices /usr/src/nuki_hub/networkDevices
|
|
||||||
COPY partitions.csv /usr/src/nuki_hub
|
|
||||||
COPY platformio.ini /usr/src/nuki_hub
|
|
||||||
COPY index.html /usr/src/nuki_hub
|
|
||||||
COPY *.h /usr/src/nuki_hub/
|
|
||||||
COPY *.cpp /usr/src/nuki_hub/
|
|
||||||
|
|
||||||
RUN set -ex && \
|
|
||||||
cd /usr/src/nuki_hub && \
|
|
||||||
mkdir -p debug/esp32 && \
|
|
||||||
mkdir -p debug/esp32s3 && \
|
|
||||||
mkdir -p debug/esp32c3 && \
|
|
||||||
mkdir -p debug/esp32solo1 && \
|
|
||||||
pio run --environment esp32dev_dbg && \
|
|
||||||
esptool.py --chip esp32 merge_bin -o debug/webflash_nuki_hub_esp32.bin --flash_mode dio --flash_freq keep --flash_size keep 0x1000 .pio/build/esp32dev_dbg/bootloader.bin 0x10000 .pio/build/esp32dev_dbg/firmware.bin 0x8000 .pio/build/esp32dev_dbg/partitions.bin && \
|
|
||||||
cp .pio/build/esp32dev_dbg/bootloader.bin debug/esp32/bootloader.bin && \
|
|
||||||
cp .pio/build/esp32dev_dbg/firmware.bin debug/esp32/nuki_hub_esp32.bin && \
|
|
||||||
cp .pio/build/esp32dev_dbg/partitions.bin debug/esp32/nuki_hub.partitions.bin && \
|
|
||||||
cp .pio/build/esp32dev_dbg/firmware.elf debug/esp32/nuki_hub_esp32.elf && \
|
|
||||||
pio run --environment esp32-s3_dbg && \
|
|
||||||
esptool.py --chip esp32s3 merge_bin -o debug/webflash_nuki_hub_esp32s3.bin --flash_mode dio --flash_freq keep --flash_size keep 0x0 .pio/build/esp32-s3_dbg/bootloader.bin 0x10000 .pio/build/esp32-s3_dbg/firmware.bin 0x8000 .pio/build/esp32-s3_dbg/partitions.bin && \
|
|
||||||
cp .pio/build/esp32-s3_dbg/bootloader.bin debug/esp32s3/bootloader.bin && \
|
|
||||||
cp .pio/build/esp32-s3_dbg/firmware.bin debug/esp32s3/nuki_hub_esp32s3.bin && \
|
|
||||||
cp .pio/build/esp32-s3_dbg/partitions.bin debug/esp32s3/nuki_hub.partitions.bin && \
|
|
||||||
cp .pio/build/esp32-s3_dbg/firmware.elf debug/esp32s3/nuki_hub_esp32s3.elf && \
|
|
||||||
pio run --environment esp32-c3_dbg && \
|
|
||||||
esptool.py --chip esp32c3 merge_bin -o debug/webflash_nuki_hub_esp32c3.bin --flash_mode dio --flash_freq keep --flash_size keep 0x0 .pio/build/esp32-c3_dbg/bootloader.bin 0x10000 .pio/build/esp32-c3_dbg/firmware.bin 0x8000 .pio/build/esp32-c3_dbg/partitions.bin && \
|
|
||||||
cp .pio/build/esp32-c3_dbg/bootloader.bin debug/esp32c3/bootloader.bin && \
|
|
||||||
cp .pio/build/esp32-c3_dbg/firmware.bin debug/esp32c3/nuki_hub_esp32c3.bin && \
|
|
||||||
cp .pio/build/esp32-c3_dbg/partitions.bin debug/esp32c3/nuki_hub.partitions.bin && \
|
|
||||||
cp .pio/build/esp32-c3_dbg/firmware.elf debug/esp32c3/nuki_hub_esp32c3.elf && \
|
|
||||||
pio run --environment esp32solo1_dbg && \
|
|
||||||
cp .pio/build/esp32solo1_dbg/bootloader.bin debug/esp32solo1/bootloader.bin && \
|
|
||||||
cp .pio/build/esp32solo1_dbg/firmware.bin debug/esp32solo1/nuki_hub_esp32solo1.bin && \
|
|
||||||
cp .pio/build/esp32solo1_dbg/partitions.bin debug/esp32solo1/nuki_hub.partitions.bin && \
|
|
||||||
cp .pio/build/esp32solo1_dbg/firmware.elf debug/esp32solo1/nuki_hub_esp32solo1.elf
|
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
|
||||||
@@ -9,7 +9,7 @@ cd nuki_hub/Docker
|
|||||||
./build_with_docker_pio.sh
|
./build_with_docker_pio.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
once the script is complete you will find the nuki_hub binaries in the `nuki_hub/build_pio` folder.
|
once the script is complete you will find the nuki_hub binaries in the `nuki_hub/release` folder.
|
||||||
|
|
||||||
## Build with CMake (will only build for the ESP32)
|
## Build with CMake (will only build for the ESP32)
|
||||||
```console
|
```console
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
set -ex
|
set -ex
|
||||||
docker build -f ./Dockerfile_pio -t nuki_hub_pio ..
|
IMAGE_NAME=nuki_hub_build
|
||||||
docker create --name nuki_hub_pio nuki_hub_pio
|
docker build -f ./Dockerfile -t ${IMAGE_NAME} ..
|
||||||
rm -rf ../build_pio
|
docker run --rm -it -v $PWD/..:/src -w /src ${IMAGE_NAME} make release
|
||||||
docker cp nuki_hub_pio:/usr/src/nuki_hub/release/ ../build_pio
|
|
||||||
docker rm -f nuki_hub_pio
|
|
||||||
|
|||||||
8
Docker/build_with_docker_pio_debug.sh
Normal file → Executable file
8
Docker/build_with_docker_pio_debug.sh
Normal file → Executable file
@@ -1,6 +1,4 @@
|
|||||||
set -ex
|
set -ex
|
||||||
docker build -f ./Dockerfile_pio_debug -t nuki_hub_pio_dbg ..
|
IMAGE_NAME=nuki_hub_build
|
||||||
docker create --name nuki_hub_pio_dbg nuki_hub_pio_dbg
|
docker build -f ./Dockerfile -t ${IMAGE_NAME} ..
|
||||||
rm -rf ../build_pio_dbg
|
docker run --rm -it -v $PWD/..:/src -w /src ${IMAGE_NAME} make debug
|
||||||
docker cp nuki_hub_pio_dbg:/usr/src/nuki_hub/debug/ ../build_pio_dbg
|
|
||||||
docker rm -f nuki_hub_pio_dbg
|
|
||||||
|
|||||||
51
Makefile
Normal file
51
Makefile
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# Extract board names from platformio.ini
|
||||||
|
PLATFORMIO_INI := platformio.ini
|
||||||
|
BOARDS := $(shell grep -oP '(?<=\[env:)[^\]]+' $(PLATFORMIO_INI) | grep -v '_dbg')
|
||||||
|
DEBUG_BOARDS := $(shell grep -oP '(?<=\[env:)[^\]]+' $(PLATFORMIO_INI) | grep '_dbg')
|
||||||
|
|
||||||
|
# Default target
|
||||||
|
.PHONY: default
|
||||||
|
default: esp32
|
||||||
|
|
||||||
|
.PHONY: release
|
||||||
|
release: $(BOARDS)
|
||||||
|
|
||||||
|
.PHONY: debug
|
||||||
|
debug: $(DEBUG_BOARDS)
|
||||||
|
|
||||||
|
# Target to build all boards in both release and debug modes
|
||||||
|
.PHONY: all
|
||||||
|
all: release debug
|
||||||
|
|
||||||
|
# Alias
|
||||||
|
.PHONY: esp32
|
||||||
|
esp32: esp32dev
|
||||||
|
|
||||||
|
esp%:
|
||||||
|
@echo "Building $@"
|
||||||
|
pio run --environment $@
|
||||||
|
|
||||||
|
# Help target to display available build targets
|
||||||
|
.PHONY: help
|
||||||
|
help:
|
||||||
|
@echo "Makefile targets:"
|
||||||
|
@echo " make - Default build (ESP32 in release mode)"
|
||||||
|
@echo " make deps - Install software dependencies (PlatformIO)"
|
||||||
|
@echo " make all - Build all boards in both release and debug modes"
|
||||||
|
@$(foreach board,$(BOARDS),echo " make $(board) - Build $(board) in release mode";)
|
||||||
|
@$(foreach board,$(DEBUG_BOARDS),echo " make $(board) - Build $(board) in debug mode";)
|
||||||
|
@echo "Available boards:"
|
||||||
|
@echo " $(BOARDS)"
|
||||||
|
@echo " $(DEBUG_BOARDS)"
|
||||||
|
|
||||||
|
# Utility target to clean build artifacts
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
@echo "Cleaning build artifacts..."
|
||||||
|
@-rm -rf release debug .pio/build
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
.PHONY: deps
|
||||||
|
deps:
|
||||||
|
@echo "Installing dependencies..."
|
||||||
|
pip install --upgrade platformio esptool
|
||||||
31
README.md
31
README.md
@@ -706,33 +706,18 @@ See the [README](/Docker/README.md) in the Docker directory for instructions on
|
|||||||
<b>Platform IO, instructions for Debian-based Linux distro (e.g. Ubuntu)</b><br>
|
<b>Platform IO, instructions for Debian-based Linux distro (e.g. Ubuntu)</b><br>
|
||||||
```console
|
```console
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y git python3 pip
|
apt-get install -y git python3 pip make
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
pip install --upgrade platformio
|
|
||||||
pip install --upgrade esptool
|
|
||||||
git clone https://github.com/technyon/nuki_hub --recursive
|
git clone https://github.com/technyon/nuki_hub --recursive
|
||||||
cd nuki_hub
|
cd nuki_hub
|
||||||
mkdir -p release/esp32
|
|
||||||
mkdir -p release/esp32s3
|
# install tools platformio and esptool
|
||||||
mkdir -p release/esp32c3
|
make deps
|
||||||
mkdir -p release/esp32solo1
|
|
||||||
pio run --environment esp32dev
|
# build all binary boards
|
||||||
cp .pio/build/esp32dev/bootloader.bin release/esp32/bootloader.bin
|
make release
|
||||||
cp .pio/build/esp32dev/firmware.bin release/esp32/nuki_hub_esp32.bin
|
|
||||||
cp .pio/build/esp32dev/partitions.bin release/esp32/nuki_hub.partitions.bin
|
|
||||||
pio run --environment esp32-s3
|
|
||||||
cp .pio/build/esp32-s3/bootloader.bin release/esp32s3/bootloader.bin
|
|
||||||
cp .pio/build/esp32-s3/firmware.bin release/esp32s3/nuki_hub_esp32s3.bin
|
|
||||||
cp .pio/build/esp32-s3/partitions.bin release/esp32s3/nuki_hub.partitions.bin
|
|
||||||
pio run --environment esp32-c3
|
|
||||||
cp .pio/build/esp32-c3/bootloader.bin release/esp32c3/bootloader.bin
|
|
||||||
cp .pio/build/esp32-c3/firmware.bin release/esp32c3/nuki_hub_esp32c3.bin
|
|
||||||
cp .pio/build/esp32-c3/partitions.bin release/esp32c3/nuki_hub.partitions.bin
|
|
||||||
pio run --environment esp32solo1
|
|
||||||
cp .pio/build/esp32solo1/bootloader.bin release/esp32solo1/bootloader.bin
|
|
||||||
cp .pio/build/esp32solo1/firmware.bin release/esp32solo1/nuki_hub_esp32solo1.bin
|
|
||||||
cp .pio/build/esp32solo1/partitions.bin release/esp32solo1/nuki_hub.partitions.bin
|
|
||||||
```
|
```
|
||||||
<br>
|
<br>
|
||||||
<b>VMWare image (Not preferred, not using the latest Arduino ESP32 release at this time)</b><br>
|
<b>VMWare image (Not preferred, not using the latest Arduino ESP32 release at this time)</b><br>
|
||||||
|
|||||||
78
pio_package.py
Normal file
78
pio_package.py
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
""" PlatformIO POST script execution to copy artifacts """
|
||||||
|
|
||||||
|
Import("env")
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
def get_board_name(env):
|
||||||
|
board = env.get('BOARD_MCU')
|
||||||
|
if env.get('BOARD') == 'esp32-solo1':
|
||||||
|
board = env.get('BOARD').replace('-', '')
|
||||||
|
return board
|
||||||
|
|
||||||
|
def create_target_dir(env):
|
||||||
|
board = get_board_name(env)
|
||||||
|
target_dir = env.GetProjectOption("custom_build") + '/' + board
|
||||||
|
if not os.path.exists(target_dir):
|
||||||
|
os.makedirs(target_dir)
|
||||||
|
return target_dir
|
||||||
|
|
||||||
|
def copy_files(source, target, env):
|
||||||
|
file = Path(target[0].get_abspath())
|
||||||
|
target_dir = create_target_dir(env)
|
||||||
|
board = get_board_name(env)
|
||||||
|
|
||||||
|
if "partitions.bin" in file.name:
|
||||||
|
shutil.copy(file, f"{target_dir}/nuki_hub.{file.name}")
|
||||||
|
elif "firmware" in file.stem:
|
||||||
|
shutil.copy(file, f"{target_dir}/nuki_hub_{board}{file.suffix}")
|
||||||
|
else:
|
||||||
|
shutil.copy(file, f"{target_dir}/{file.name}")
|
||||||
|
|
||||||
|
def merge_bin(source, target, env):
|
||||||
|
#if not env.get('BUILD_TYPE') in ['release']:
|
||||||
|
# return
|
||||||
|
|
||||||
|
if env.get('BOARD') in ['esp32-solo1']:
|
||||||
|
return
|
||||||
|
|
||||||
|
board = get_board_name(env)
|
||||||
|
chip = env.get('BOARD_MCU')
|
||||||
|
target_dir = create_target_dir(env)
|
||||||
|
target_file = f"{target_dir}/webflash_nuki_hub_{board}.bin"
|
||||||
|
|
||||||
|
app_position = "0x10000"
|
||||||
|
app_path = target[0].get_abspath()
|
||||||
|
|
||||||
|
flash_args = list()
|
||||||
|
flash_args.append(app_position)
|
||||||
|
flash_args.append(app_path)
|
||||||
|
|
||||||
|
for position, bin_file in env.get('FLASH_EXTRA_IMAGES'):
|
||||||
|
if "boot_app0.bin" in bin_file:
|
||||||
|
bin_file = "bin/boot_app0.bin"
|
||||||
|
flash_args.append(position)
|
||||||
|
flash_args.append(bin_file)
|
||||||
|
|
||||||
|
cmd = f"esptool.py --chip {chip} merge_bin -o {target_file} --flash_mode dio --flash_freq keep --flash_size keep " + " ".join(flash_args)
|
||||||
|
env.Execute(cmd)
|
||||||
|
|
||||||
|
def package_last_files(source, target, env):
|
||||||
|
files = ["bin/boot_app0.bin", "how-to-flash.txt"]
|
||||||
|
|
||||||
|
target_dir = create_target_dir(env)
|
||||||
|
for file in files:
|
||||||
|
file = Path(file)
|
||||||
|
shutil.copy(file, f"{target_dir}/{file.name}")
|
||||||
|
|
||||||
|
if env.GetProjectOption("custom_build") == 'release':
|
||||||
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", merge_bin)
|
||||||
|
|
||||||
|
env.AddPostAction("$BUILD_DIR/firmware.bin", copy_files)
|
||||||
|
env.AddPostAction("$BUILD_DIR/firmware.bin", package_last_files)
|
||||||
|
env.AddPostAction("$BUILD_DIR/partitions.bin", copy_files)
|
||||||
|
env.AddPostAction("$BUILD_DIR/bootloader.bin", copy_files)
|
||||||
|
|
||||||
|
if env.GetProjectOption("custom_build") == 'debug':
|
||||||
|
env.AddPostAction("$BUILD_DIR/firmware.elf", copy_files)
|
||||||
@@ -15,6 +15,7 @@ default_envs = esp32dev
|
|||||||
platform = espressif32
|
platform = espressif32
|
||||||
framework = arduino
|
framework = arduino
|
||||||
build_type = release
|
build_type = release
|
||||||
|
custom_build = release
|
||||||
board_build.partitions = partitions.csv
|
board_build.partitions = partitions.csv
|
||||||
build_flags =
|
build_flags =
|
||||||
-fexceptions
|
-fexceptions
|
||||||
@@ -33,50 +34,33 @@ monitor_filters =
|
|||||||
|
|
||||||
[env:esp32dev]
|
[env:esp32dev]
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
|
extra_scripts = post:pio_package.py
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
|
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
|
||||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
|
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
|
||||||
|
|
||||||
[env:esp32-c3]
|
[env:esp32-c3]
|
||||||
|
extends = env:esp32dev
|
||||||
board = esp32-c3-devkitc-02
|
board = esp32-c3-devkitc-02
|
||||||
build_flags =
|
|
||||||
${env.build_flags}
|
[env:esp32-s3]
|
||||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
|
extends = env:esp32dev
|
||||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
|
board = esp32-s3-devkitc-1
|
||||||
|
|
||||||
[env:esp32solo1]
|
[env:esp32solo1]
|
||||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.03/platform-espressif32-2023.10.03.zip
|
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.03/platform-espressif32-2023.10.03.zip
|
||||||
board = esp32-solo1
|
board = esp32-solo1
|
||||||
|
extra_scripts = post:pio_package.py
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
-DFRAMEWORK_ARDUINO_SOLO1
|
-DFRAMEWORK_ARDUINO_SOLO1
|
||||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
|
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
|
||||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
|
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
|
||||||
|
|
||||||
[env:esp32-s3]
|
|
||||||
board = esp32-s3-devkitc-1
|
|
||||||
build_flags =
|
|
||||||
${env.build_flags}
|
|
||||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
|
|
||||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
|
|
||||||
|
|
||||||
[env:esp32dev_dbg]
|
[env:esp32dev_dbg]
|
||||||
board = esp32dev
|
extends = env:esp32dev
|
||||||
build_flags =
|
custom_build = debug
|
||||||
${env.build_flags}
|
|
||||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
|
||||||
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
|
|
||||||
-DDEBUG_NUKIHUB
|
|
||||||
-DDEBUG_SENSE_NUKI
|
|
||||||
-DDEBUG_NUKI_COMMAND
|
|
||||||
-DDEBUG_NUKI_CONNECT
|
|
||||||
-DDEBUG_NUKI_COMMUNICATION
|
|
||||||
;-DDEBUG_NUKI_HEX_DATA
|
|
||||||
-DDEBUG_NUKI_READABLE_DATA
|
|
||||||
|
|
||||||
[env:esp32-s3_dbg]
|
|
||||||
board = esp32-s3-devkitc-1
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||||
@@ -90,7 +74,23 @@ build_flags =
|
|||||||
-DDEBUG_NUKI_READABLE_DATA
|
-DDEBUG_NUKI_READABLE_DATA
|
||||||
|
|
||||||
[env:esp32-c3_dbg]
|
[env:esp32-c3_dbg]
|
||||||
board = esp32-c3-devkitc-02
|
extends = env:esp32-c3
|
||||||
|
custom_build = debug
|
||||||
|
build_flags =
|
||||||
|
${env.build_flags}
|
||||||
|
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||||
|
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
|
||||||
|
-DDEBUG_NUKIHUB
|
||||||
|
-DDEBUG_SENSE_NUKI
|
||||||
|
-DDEBUG_NUKI_COMMAND
|
||||||
|
-DDEBUG_NUKI_CONNECT
|
||||||
|
-DDEBUG_NUKI_COMMUNICATION
|
||||||
|
;-DDEBUG_NUKI_HEX_DATA
|
||||||
|
-DDEBUG_NUKI_READABLE_DATA
|
||||||
|
|
||||||
|
[env:esp32-s3_dbg]
|
||||||
|
extends = env:esp32-s3
|
||||||
|
custom_build = debug
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||||
@@ -104,8 +104,8 @@ build_flags =
|
|||||||
-DDEBUG_NUKI_READABLE_DATA
|
-DDEBUG_NUKI_READABLE_DATA
|
||||||
|
|
||||||
[env:esp32solo1_dbg]
|
[env:esp32solo1_dbg]
|
||||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.03/platform-espressif32-2023.10.03.zip
|
extends = env:esp32solo1
|
||||||
board = esp32-solo1
|
custom_build = debug
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags}
|
${env.build_flags}
|
||||||
-DFRAMEWORK_ARDUINO_SOLO1
|
-DFRAMEWORK_ARDUINO_SOLO1
|
||||||
@@ -117,4 +117,4 @@ build_flags =
|
|||||||
-DDEBUG_NUKI_CONNECT
|
-DDEBUG_NUKI_CONNECT
|
||||||
-DDEBUG_NUKI_COMMUNICATION
|
-DDEBUG_NUKI_COMMUNICATION
|
||||||
;-DDEBUG_NUKI_HEX_DATA
|
;-DDEBUG_NUKI_HEX_DATA
|
||||||
-DDEBUG_NUKI_READABLE_DATA
|
-DDEBUG_NUKI_READABLE_DATA
|
||||||
|
|||||||
Reference in New Issue
Block a user