espressif add self_update as external project

This commit is contained in:
hathach 2025-04-04 15:58:14 +07:00
parent 8d600e75e7
commit 522462499a
No known key found for this signature in database
GPG key ID: 26FAB84F615C3C52
5 changed files with 18 additions and 12 deletions

View file

@ -58,7 +58,7 @@ jobs:
- name: Build using ESP-IDF docker
if: inputs.toolchain == 'esp-idf'
run: docker run --rm -v $PWD:/project -w /project espressif/idf:${{ inputs.toolchain_version }} /bin/bash -c "git config --global --add safe.directory /project && make -C ports/espressif/ BOARD=${{ matrix.board }} all self-update copy-artifact"
run: docker run --rm -v $PWD:/project -w /project espressif/idf:${{ inputs.toolchain_version }} /bin/bash -c "git config --global --add safe.directory /project && make -C ports/espressif/ BOARD=${{ matrix.board }} all copy-artifact"
- uses: actions/upload-artifact@v4
with:

View file

@ -38,6 +38,18 @@ add_custom_command(TARGET app POST_BUILD
COMMAND ${Python_EXECUTABLE} ${UF2CONV_PY} --carray -o ${CMAKE_CURRENT_LIST_DIR}/apps/self_update/main/bootloader_bin.c ${CMAKE_BINARY_DIR}/tinyuf2.bin
)
# External project for self-update
externalproject_add(self_update
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/apps/self_update
BINARY_DIR ${CMAKE_BINARY_DIR}/self_update
# Modiying the list separator for the arguments, as such, we won't need to manually
# replace the new separator by the default ';' in the subproject
CMAKE_ARGS -DBOARD=${BOARD}
INSTALL_COMMAND ""
BUILD_ALWAYS 1
DEPENDS app
)
# -------------------------------------------------------------
# Post build: update arduino-esp32 bootloader for debug purpose
# -------------------------------------------------------------

View file

@ -50,15 +50,8 @@ combined-flash: $(BUILD)/combined.bin
esptool.py --chip $(IDF_TARGET) write_flash 0x0 $<
#-------------- Self Update --------------
SELF_APP = apps/self_update
SELF_BUILD = ${SELF_APP}/${BUILD}
# cmake post build of tinyuf2's app will generate bootloader_bin.c
# cmake post build of self-update's app will generate update-tinyuf2.uf2
$(SELF_BUILD)/update-tinyuf2.uf2: app
idf.py -C ${SELF_APP} -B${SELF_BUILD} -DBOARD=${BOARD} app
self-update: $(SELF_BUILD)/update-tinyuf2.uf2
# Self_update is a sub/external project, will be built by cmake's all target
SELF_BUILD = ${BUILD}/self_update
#-------------- Artifacts --------------
$(BIN):
@ -67,7 +60,7 @@ $(BIN):
# get the partition csv from sdkconfig
PARTITION_CSV := $(strip $(foreach csv,$(wildcard partitions-*.csv),$(findstring $(csv),$(file < boards/$(BOARD)/sdkconfig))))
copy-artifact: $(BIN) all self-update $(BUILD)/combined.bin
copy-artifact: $(BIN) all $(BUILD)/combined.bin
@cp $(BUILD)/bootloader/bootloader.bin $<
@cp $(BUILD)/partition_table/partition-table.bin $<
@cp $(BUILD)/ota_data_initial.bin $<

View file

@ -7,6 +7,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/../../boards/${BOARD}/board.cmake)
# Must be set before including IDF project.cmake
set(EXTRA_COMPONENT_DIRS "../../boards" "../../components")
set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)
set(SELFUPDATE_BUILD 1)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)

View file

@ -43,7 +43,7 @@
//--------------------------------------------------------------------+
// GPIO connected to Neopixel data
#define NEOPIXEL_PIN 48
#define NEOPIXEL_PIN 38
// Brightness percentage from 1 to 255
#define NEOPIXEL_BRIGHTNESS 0x10