Skip to content

Commit 3419f43

Browse files
authored
Merge pull request #445 from adafruit/change-s2-4m-partition-to-nooat
change all 4mb esp32s2 to use no-ota partition
2 parents 9650157 + 736a6e0 commit 3419f43

File tree

46 files changed

+109
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+109
-86
lines changed

.github/workflows/build_util.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
5959
- name: Build using ESP-IDF docker
6060
if: inputs.toolchain == 'esp-idf'
61-
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"
61+
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"
6262

6363
- uses: actions/upload-artifact@v4
6464
with:

.github/workflows/ci_set_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def set_matrix_json():
1818
if b.is_dir():
1919
matrix[p.name]['board'].append(b.name)
2020
# For quick testing by only build 1 espressif board
21-
#if p.name == 'espressif':
21+
# if p.name == 'espressif':
2222
# break
2323
print(json.dumps(matrix))
2424

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env bash
22

3-
sudo apt-get -y install gcc-arm-none-eabi
4-
53
cd ports/stm32f4
64
make BOARD=feather_stm32f405_express get-deps
75
make BOARD=feather_stm32f405_express all

.github/workflows/codeql.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
# - https://gh.io/supported-runners-and-hardware-resources
2828
# - https://gh.io/using-larger-runners
2929
# Consider using larger runners for possible analysis time improvements.
30-
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-24.04' }}
31-
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 360
3232
permissions:
3333
actions: read
3434
contents: read
@@ -37,7 +37,7 @@ jobs:
3737
strategy:
3838
fail-fast: false
3939
matrix:
40-
language: [ 'cpp' ]
40+
language: [ 'c-cpp' ]
4141
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
4242
# Use only 'java' to analyze code written in Java, Kotlin or both
4343
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
@@ -49,9 +49,14 @@ jobs:
4949
with:
5050
submodules: recursive
5151

52+
- name: Setup Toolchain
53+
uses: ./.github/actions/setup_toolchain
54+
with:
55+
toolchain: 'arm-gcc'
56+
5257
# Initializes the CodeQL tools for scanning.
5358
- name: Initialize CodeQL
54-
uses: github/codeql-action/init@v2
59+
uses: github/codeql-action/init@v3
5560
with:
5661
languages: ${{ matrix.language }}
5762
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -78,7 +83,7 @@ jobs:
7883
./.github/workflows/codeql-buildscript.sh
7984
8085
- name: Perform CodeQL Analysis
81-
uses: github/codeql-action/analyze@v2
86+
uses: github/codeql-action/analyze@v3
8287
with:
8388
category: "/language:${{matrix.language}}"
8489
upload: false
@@ -107,20 +112,18 @@ jobs:
107112
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
108113

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

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

123-
- name: Fail if an error is found
124-
run: |
125-
./.github/workflows/fail_on_error.py \
126-
${{ steps.step1.outputs.sarif-output }}/cpp.sarif
127+
# - name: Fail if an error is found
128+
# run: |
129+
# ./.github/workflows/fail_on_error.py ${{ steps.step1.outputs.sarif-output }}/cpp.sarif

ports/espressif/CMakeLists.txt

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,71 @@ add_compile_definitions(
2828
UF2_VERSION_BASE="${GIT_VERSION}"
2929
UF2_VERSION="${GIT_VERSION} - ${GIT_SUBMODULE_VERSIONS}"
3030
)
31-
3231
cmake_print_variables(GIT_VERSION GIT_SUBMODULE_VERSIONS)
3332

3433
project(tinyuf2)
3534

35+
set(ARTIFACT_PATH ${CMAKE_CURRENT_LIST_DIR}/_bin/${BOARD})
36+
execute_process(COMMAND mkdir -p ${ARTIFACT_PATH})
37+
38+
# Create post-build script for combined.bin / combined-ota.bin
39+
file(WRITE ${CMAKE_BINARY_DIR}/tinyuf2.postbuild.sh
40+
"#!/bin/bash\n"
41+
"echo \"Creating combined.bin\"\n"
42+
"esptool.py --chip ${IDF_TARGET} merge_bin --output combined.bin $(tr '\\n' ' ' < ${CMAKE_BINARY_DIR}/flash_args)\n"
43+
)
44+
45+
# check if board is 4MB flash and create combined-ota.bin
46+
file(READ ${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/sdkconfig BOARD_SDKCONFIG_CONTENTS)
47+
string(FIND ${BOARD_SDKCONFIG_CONTENTS} "partitions-4MB-noota.csv" MATCH_INDEX)
48+
if(NOT MATCH_INDEX EQUAL -1)
49+
file(APPEND ${CMAKE_BINARY_DIR}/tinyuf2.postbuild.sh
50+
"echo \"Creating combined-ota.bin\"\n"
51+
"gen_esp32part.py ${CMAKE_CURRENT_LIST_DIR}/partitions-4MB.csv ${CMAKE_BINARY_DIR}/partition_table/partitions-table-4MB-ota.bin\n"
52+
"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"
53+
"cp combined_ota.bin ${ARTIFACT_PATH}/combined_ota.bin\n"
54+
)
55+
endif()
56+
57+
add_custom_command(TARGET app POST_BUILD
58+
COMMAND bash ${CMAKE_BINARY_DIR}/tinyuf2.postbuild.sh
59+
VERBATIM
60+
)
61+
62+
# Post build: copy binaries for artifact
63+
add_custom_command(TARGET app POST_BUILD
64+
COMMAND ${CMAKE_COMMAND} -E echo "Copy binaries for artifact"
65+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bootloader/bootloader.bin ${ARTIFACT_PATH}/bootloader.bin
66+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/ota_data_initial.bin ${ARTIFACT_PATH}/ota_data_initial.bin
67+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/partition_table/partition-table.bin ${ARTIFACT_PATH}/partition-table.bin
68+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/tinyuf2.bin ${ARTIFACT_PATH}/tinyuf2.bin
69+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/combined.bin ${ARTIFACT_PATH}/combined.bin
70+
VERBATIM
71+
)
72+
73+
# External project for self-update
3674
# Post build: generate bootloader_bin.c for self-update and combined.bin
3775
add_custom_command(TARGET app POST_BUILD
3876
COMMAND ${Python_EXECUTABLE} ${UF2CONV_PY} --carray -o ${CMAKE_CURRENT_LIST_DIR}/apps/self_update/main/bootloader_bin.c ${CMAKE_BINARY_DIR}/tinyuf2.bin
3977
)
4078

41-
# External project for self-update
4279
externalproject_add(self_update
4380
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/apps/self_update
4481
BINARY_DIR ${CMAKE_BINARY_DIR}/self_update
45-
# Modiying the list separator for the arguments, as such, we won't need to manually
82+
# Modifying the list separator for the arguments, as such, we won't need to manually
4683
# replace the new separator by the default ';' in the subproject
4784
CMAKE_ARGS -DBOARD=${BOARD}
4885
INSTALL_COMMAND ""
4986
BUILD_ALWAYS 1
50-
DEPENDS app
87+
DEPENDS tinyuf2.elf
88+
)
89+
90+
# flash combined.bin
91+
add_custom_target(combined-flash
92+
DEPENDS tinyuf2.elf
93+
COMMAND ${CMAKE_COMMAND} -E echo "Flashing combined.bin"
94+
COMMAND esptool.py --chip ${IDF_TARGET} write_flash 0x0 combined.bin
95+
VERBATIM
5196
)
5297

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

64-
add_custom_command(TARGET app POST_BUILD
109+
add_custom_command(TARGET tinyuf2.elf POST_BUILD
65110
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/tinyuf2.bin ${ARDUINO_VARIANT_DIR}/tinyuf2.bin
66111
)
67112
endif ()

ports/espressif/Makefile

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
.PHONY: all build clean flash monitor erase
44
.DEFAULT_GOAL := all
55

6-
# Set default python interpreters
7-
PYTHON3 ?= python3
8-
96
# Build directory
107
BUILD = _build/$(BOARD)
118
BIN = _bin/$(BOARD)
@@ -15,9 +12,6 @@ ifdef SERIAL
1512
SERIAL_OPT = --port $(SERIAL)
1613
endif
1714

18-
UF2_FAMILY_ID_esp32s2 = 0xbfdd4eee
19-
UF2_FAMILY_ID_esp32s3 = 0xc47e5767
20-
2115
BOARD_CMAKE := $(file < boards/$(BOARD)/board.cmake)
2216
ifneq ($(findstring esp32s2,$(BOARD_CMAKE)),)
2317
IDF_TARGET = esp32s2
@@ -40,31 +34,12 @@ fullclean:
4034
app bootloader clean flash bootloader-flash app-flash erase-flash monitor dfu-flash dfu size size-components size-files:
4135
idf.py -B$(BUILD) -DBOARD=$(BOARD) $(SERIAL_OPT) $@
4236

43-
combined.bin: $(BUILD)/combined.bin
44-
37+
# combined.bin is POST build step, generated by cmake app target
4538
$(BUILD)/combined.bin: app
46-
cd $(BUILD); \
47-
esptool.py --chip $(IDF_TARGET) merge_bin --output combined.bin $(strip $(file < $(BUILD)/flash_args))
48-
4939
combined-flash: $(BUILD)/combined.bin
5040
esptool.py --chip $(IDF_TARGET) write_flash 0x0 $<
5141

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

56-
#-------------- Artifacts --------------
57-
$(BIN):
58-
@mkdir -p $@
59-
60-
# get the partition csv from sdkconfig
61-
PARTITION_CSV := $(strip $(foreach csv,$(wildcard partitions-*.csv),$(findstring $(csv),$(file < boards/$(BOARD)/sdkconfig))))
62-
63-
copy-artifact: $(BIN) all $(BUILD)/combined.bin
64-
@cp $(BUILD)/bootloader/bootloader.bin $<
65-
@cp $(BUILD)/partition_table/partition-table.bin $<
66-
@cp $(BUILD)/ota_data_initial.bin $<
67-
@cp $(BUILD)/tinyuf2.bin $<
68-
@cp $(BUILD)/combined.bin $<
69-
@cp $(SELF_BUILD)/update-tinyuf2.uf2 $<
70-
@cp $(PARTITION_CSV) $<
45+
# Artifacts is generated as Cmake post build

ports/espressif/apps/self_update/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ add_compile_definitions(TINYUF2_SELF_UPDATE)
1616

1717
project(update-tinyuf2)
1818

19+
set(ARTIFACT_PATH ${CMAKE_CURRENT_LIST_DIR}/../../_bin/${BOARD})
1920
add_custom_command(TARGET app POST_BUILD
2021
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
22+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/update-tinyuf2.uf2 ${ARTIFACT_PATH}/update-tinyuf2.uf2
2123
VERBATIM
2224
)
2325

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Board Specific Config
22

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

66
# Serial flasher config
77
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Board Specific Config
22

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

66
# Serial flasher config
77
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Board Specific Config
22

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

66
# Serial flasher config
77
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y

0 commit comments

Comments
 (0)