Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_util.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 && idf.py -C ports/espressif -DBOARD=${{ matrix.board }} build"

- uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_set_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def set_matrix_json():
if b.is_dir():
matrix[p.name]['board'].append(b.name)
# For quick testing by only build 1 espressif board
#if p.name == 'espressif':
# if p.name == 'espressif':
# break
print(json.dumps(matrix))

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/codeql-buildscript.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash

sudo apt-get -y install gcc-arm-none-eabi

cd ports/stm32f4
make BOARD=feather_stm32f405_express get-deps
make BOARD=feather_stm32f405_express all
25 changes: 14 additions & 11 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-24.04' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
actions: read
contents: read
Expand All @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
language: [ 'c-cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
Expand All @@ -49,9 +49,14 @@ jobs:
with:
submodules: recursive

- name: Setup Toolchain
uses: ./.github/actions/setup_toolchain
with:
toolchain: 'arm-gcc'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -78,7 +83,7 @@ jobs:
./.github/workflows/codeql-buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
upload: false
Expand Down Expand Up @@ -107,20 +112,18 @@ jobs:
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif

- name: Upload CodeQL results to code scanning
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ steps.step1.outputs.sarif-output }}
category: "/language:${{matrix.language}}"

- name: Upload CodeQL results as an artifact
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: codeql-results
path: ${{ steps.step1.outputs.sarif-output }}
retention-days: 5

- name: Fail if an error is found
run: |
./.github/workflows/fail_on_error.py \
${{ steps.step1.outputs.sarif-output }}/cpp.sarif
# - name: Fail if an error is found
# run: |
# ./.github/workflows/fail_on_error.py ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
55 changes: 50 additions & 5 deletions ports/espressif/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,71 @@ add_compile_definitions(
UF2_VERSION_BASE="${GIT_VERSION}"
UF2_VERSION="${GIT_VERSION} - ${GIT_SUBMODULE_VERSIONS}"
)

cmake_print_variables(GIT_VERSION GIT_SUBMODULE_VERSIONS)

project(tinyuf2)

set(ARTIFACT_PATH ${CMAKE_CURRENT_LIST_DIR}/_bin/${BOARD})
execute_process(COMMAND mkdir -p ${ARTIFACT_PATH})

# Create post-build script for combined.bin / combined-ota.bin
file(WRITE ${CMAKE_BINARY_DIR}/tinyuf2.postbuild.sh
"#!/bin/bash\n"
"echo \"Creating combined.bin\"\n"
"esptool.py --chip ${IDF_TARGET} merge_bin --output combined.bin $(tr '\\n' ' ' < ${CMAKE_BINARY_DIR}/flash_args)\n"
)

# check if board is 4MB flash and create combined-ota.bin
file(READ ${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/sdkconfig BOARD_SDKCONFIG_CONTENTS)
string(FIND ${BOARD_SDKCONFIG_CONTENTS} "partitions-4MB-noota.csv" MATCH_INDEX)
if(NOT MATCH_INDEX EQUAL -1)
file(APPEND ${CMAKE_BINARY_DIR}/tinyuf2.postbuild.sh
"echo \"Creating combined-ota.bin\"\n"
"gen_esp32part.py ${CMAKE_CURRENT_LIST_DIR}/partitions-4MB.csv ${CMAKE_BINARY_DIR}/partition_table/partitions-table-4MB-ota.bin\n"
"esptool.py --chip ${IDF_TARGET} merge_bin --output combined_ota.bin $(tr '\\n' ' ' < ${CMAKE_BINARY_DIR}/flash_args | sed 's/partition-table.bin/partitions-table-4MB-ota.bin/g')\n"
"cp combined_ota.bin ${ARTIFACT_PATH}/combined_ota.bin\n"
)
endif()

add_custom_command(TARGET app POST_BUILD
COMMAND bash ${CMAKE_BINARY_DIR}/tinyuf2.postbuild.sh
VERBATIM
)

# Post build: copy binaries for artifact
add_custom_command(TARGET app POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Copy binaries for artifact"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bootloader/bootloader.bin ${ARTIFACT_PATH}/bootloader.bin
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/ota_data_initial.bin ${ARTIFACT_PATH}/ota_data_initial.bin
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/partition_table/partition-table.bin ${ARTIFACT_PATH}/partition-table.bin
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/tinyuf2.bin ${ARTIFACT_PATH}/tinyuf2.bin
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/combined.bin ${ARTIFACT_PATH}/combined.bin
VERBATIM
)

# External project for self-update
# Post build: generate bootloader_bin.c for self-update and combined.bin
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
# Modifying 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
DEPENDS tinyuf2.elf
)

# flash combined.bin
add_custom_target(combined-flash
DEPENDS tinyuf2.elf
COMMAND ${CMAKE_COMMAND} -E echo "Flashing combined.bin"
COMMAND esptool.py --chip ${IDF_TARGET} write_flash 0x0 combined.bin
VERBATIM
)

# -------------------------------------------------------------
Expand All @@ -61,7 +106,7 @@ if (0)
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bootloader/bootloader.bin ${ARDUINO_VARIANT_DIR}/bootloader-tinyuf2.bin
)

add_custom_command(TARGET app POST_BUILD
add_custom_command(TARGET tinyuf2.elf POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/tinyuf2.bin ${ARDUINO_VARIANT_DIR}/tinyuf2.bin
)
endif ()
29 changes: 2 additions & 27 deletions ports/espressif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
.PHONY: all build clean flash monitor erase
.DEFAULT_GOAL := all

# Set default python interpreters
PYTHON3 ?= python3

# Build directory
BUILD = _build/$(BOARD)
BIN = _bin/$(BOARD)
Expand All @@ -15,9 +12,6 @@ ifdef SERIAL
SERIAL_OPT = --port $(SERIAL)
endif

UF2_FAMILY_ID_esp32s2 = 0xbfdd4eee
UF2_FAMILY_ID_esp32s3 = 0xc47e5767

BOARD_CMAKE := $(file < boards/$(BOARD)/board.cmake)
ifneq ($(findstring esp32s2,$(BOARD_CMAKE)),)
IDF_TARGET = esp32s2
Expand All @@ -40,31 +34,12 @@ fullclean:
app bootloader clean flash bootloader-flash app-flash erase-flash monitor dfu-flash dfu size size-components size-files:
idf.py -B$(BUILD) -DBOARD=$(BOARD) $(SERIAL_OPT) $@

combined.bin: $(BUILD)/combined.bin

# combined.bin is POST build step, generated by cmake app target
$(BUILD)/combined.bin: app
cd $(BUILD); \
esptool.py --chip $(IDF_TARGET) merge_bin --output combined.bin $(strip $(file < $(BUILD)/flash_args))

combined-flash: $(BUILD)/combined.bin
esptool.py --chip $(IDF_TARGET) write_flash 0x0 $<

#-------------- Self Update --------------
# Self_update is a sub/external project, will be built by cmake's all target
SELF_BUILD = ${BUILD}/self_update

#-------------- Artifacts --------------
$(BIN):
@mkdir -p $@

# get the partition csv from sdkconfig
PARTITION_CSV := $(strip $(foreach csv,$(wildcard partitions-*.csv),$(findstring $(csv),$(file < boards/$(BOARD)/sdkconfig))))

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 $<
@cp $(BUILD)/tinyuf2.bin $<
@cp $(BUILD)/combined.bin $<
@cp $(SELF_BUILD)/update-tinyuf2.uf2 $<
@cp $(PARTITION_CSV) $<
# Artifacts is generated as Cmake post build
2 changes: 2 additions & 0 deletions ports/espressif/apps/self_update/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ add_compile_definitions(TINYUF2_SELF_UPDATE)

project(update-tinyuf2)

set(ARTIFACT_PATH ${CMAKE_CURRENT_LIST_DIR}/../../_bin/${BOARD})
add_custom_command(TARGET app POST_BUILD
COMMAND ${Python_EXECUTABLE} ${UF2CONV_PY} -f ${UF2_FAMILY_ID_${IDF_TARGET}} -b 0x0 -c -o ${CMAKE_BINARY_DIR}/update-tinyuf2.uf2 ${CMAKE_BINARY_DIR}/update-tinyuf2.bin
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/update-tinyuf2.uf2 ${ARTIFACT_PATH}/update-tinyuf2.uf2
VERBATIM
)

Expand Down
2 changes: 1 addition & 1 deletion ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/adafruit_funhouse_esp32s2/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/adafruit_magtag_29gray/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/adafruit_vindie_s2/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/artisense_rd00/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/bpi_bit_s2/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/bpi_leaf_s2/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/deneyap_mini/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/deneyap_mini_v2/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
2 changes: 1 addition & 1 deletion ports/espressif/boards/espressif_hmi_1/sdkconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Board Specific Config

# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB-noota.csv"

# Serial flasher config
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
Loading
Loading