Fork fix: the SDIO wedge is FIXED (esp-hosted-mcu #167)
Test, Build and Push / test-gateway (push) Successful in 12s
Test, Build and Push / release (push) Skipped
Test, Build and Push / build-gateway (push) Skipped

Root cause (verified against our exact IDF tree, not the community guess):
the "258" in "sdio_write_task: Failed to send data: 258" is NOT a timeout
(that is 263). 258 = 0x102 = ESP_ERR_INVALID_ARG. On the ESP32-P4, block-
mode CMD53 writes require the SOURCE buffer to be 64-byte (cache-line)
aligned; the IDF sdmmc driver rejects a misaligned source with INVALID_ARG
BEFORE any bus activity. esp_hosts write loop then declares "Unrecoverable
host sdio state" and reboots the whole P4. The audio TX payload is not
64-aligned, so streaming mic audio wedged on the very FIRST frame (which is
exactly what we saw: listening -> instant Failed to send -> reboot).

This also explains why buffer/queue/clock/retry tuning all did nothing: the
write never reached the bus. And why our symptom was instant, not after
~100 writes (the community block-mode-desync theory) — it is the first
misaligned buffer, every time.

Fix: vendored esp_hosted 2.12.11 as an editable local component (overrides
the registry copy) and bounce a misaligned TX payload through one aligned
DMA scratch buffer in hosted_sdio_write_block (port_esp_hosted_host_sdio.c).
TX is serialized by the bus lock so a single static bounce buffer is safe;
freed in hosted_sdio_deinit. Host-only change — no C6 reflash.

VERIFIED ON HARDWARE (autonomous self-test): 40s of continuous mic-audio
upstream streaming — the traffic that previously wedged on the first frame
— ran clean, zero timeouts, zero reboots. A guarded SDIO_TX_SELFTEST harness
is kept (compiled out) for future SDIO stress testing.

Credit: root cause + patch designed via multi-agent investigation; the
precise 258=INVALID_ARG decode (correcting the upstream community timeout
assumption) came from checking our actual esp_err.h.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-15 09:50:27 +02:00
co-authored by Claude Fable 5
parent ac9d24e0f9
commit cb5826e02b
666 changed files with 216925 additions and 0 deletions
@@ -0,0 +1,31 @@
.check_pre_commit_template:
stage: pre
image: python:3.8
tags:
- build
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
script:
- python3 -m venv .venv
- source .venv/bin/activate
- pip install --upgrade pip
- pip install pre-commit
- git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME --depth=1
- git fetch origin $CI_COMMIT_REF_NAME --depth=1
- |
echo "Target branch: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
echo "Source branch: $CI_COMMIT_REF_NAME"
MODIFIED_FILES=$(git diff --name-only origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME..origin/$CI_COMMIT_REF_NAME)
echo "Modified files to check:"
echo "$MODIFIED_FILES"
if [ -n "$MODIFIED_FILES" ]; then
CI=true pre-commit run --files $MODIFIED_FILES
else
echo "No modified files to check."
fi
check_pre_commit:
extends:
- .check_pre_commit_template
@@ -0,0 +1,354 @@
# Holds jobs that run before promoting to main branch
### Notes:
# IDF v5.3 and v5.3.1 do not build for P4
# - fix only merged for v5.3.2 and above
# - https://github.com/espressif/esp-idf/commit/1aec9e7df38bb7ccc9ec2fb846288910c329d77a
### IDF master and v6.x don't build mqtt example with wifi-remote and ESP-Hosted
### so we only verify mqtt example against earlier IDF
regression_build_idf_v5.3_mqtt_h2:
variables:
EXAMPLE_CI_FILE: "sdkconfig.ci.p4_wifi"
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example_mqtt
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_VER: ["v5.3", "v5.3.1", "v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
IDF_TARGET: ["esp32h2"]
IDF_SLAVE_TARGET: ["esp32c6"]
regression_build_idf_v5.3_mqtt_p4:
variables:
EXAMPLE_CI_FILE: "sdkconfig.ci.p4_wifi"
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example_mqtt
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_VER: ["v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
IDF_TARGET: ["esp32p4"]
IDF_SLAVE_TARGET: ["esp32c6"]
regression_build_idf_v5.4_mqtt:
variables:
EXAMPLE_CI_FILE: "sdkconfig.ci.p4_wifi"
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example_mqtt
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "v5.4.4", "release-v5.4"]
IDF_TARGET: ["esp32p4", "esp32h2"]
IDF_SLAVE_TARGET: ["esp32c6"]
regression_build_idf_v5.5_iperf:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_VER: ["v5.5", "v5.5.1", "v5.5.2", "v5.5.3", "release-v5.5"]
IDF_TARGET: ["esp32p4", "esp32h2"]
IDF_SLAVE_TARGET: ["esp32", "esp32c2", "esp32c3", "esp32s3" ]
IDF_EXAMPLE_PATH: ["examples/wifi/iperf"]
regression_build_idf_master_iperf:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template
image: espressif/idf:latest
parallel:
matrix:
- IDF_TARGET: ["esp32p4", "esp32h2"]
IDF_SLAVE_TARGET: ["esp32", "esp32c2", "esp32c3", "esp32s3" ]
IDF_EXAMPLE_PATH: ["examples/wifi/iperf"]
regression_build_coprocessor_idf_v5.3_pt1:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32c6"]
IDF_VER: ["v5.3", "v5.3.1", "v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
SLAVE_CI_FILE: ["sdio", "spi", "spi_hd", "uart", "dpp"]
# override performance optimization to prevent build errors
CONFIG_OVERRIDE: "CONFIG_COMPILER_OPTIMIZATION_DEBUG=y"
regression_build_coprocessor_idf_v5.3_pt2:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32c2", "esp32c3", "esp32s3"]
IDF_VER: ["v5.3", "v5.3.1", "v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
SLAVE_CI_FILE: ["spi", "spi_hd", "uart"]
# override performance optimization to prevent build errors
CONFIG_OVERRIDE: "CONFIG_COMPILER_OPTIMIZATION_DEBUG=y"
regression_build_coprocessor_idf_v5.3_esp32:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32"]
IDF_VER: ["v5.3", "v5.3.1", "v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
SLAVE_CI_FILE: ["sdio", "spi", "uart"]
# override performance optimization to prevent build errors
CONFIG_OVERRIDE: "CONFIG_COMPILER_OPTIMIZATION_DEBUG=y"
regression_build_coprocessor_idf_v5.4_pt1:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32c6"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "v5.4.4", "release-v5.4"]
SLAVE_CI_FILE: ["sdio", "spi", "spi_hd", "uart", "dpp"]
regression_build_coprocessor_idf_v5.4_pt2:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32c2", "esp32c3", "esp32s3"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "v5.4.4", "release-v5.4"]
SLAVE_CI_FILE: ["spi", "spi_hd", "uart"]
regression_build_coprocessor_idf_v5.4_esp32:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "v5.4.4", "release-v5.4"]
SLAVE_CI_FILE: ["sdio", "spi", "uart"]
regression_build_coprocessor_idf_v5.5:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32c2", "esp32c3", "esp32s3"]
IDF_VER: ["v5.5", "v5.5.1", "v5.5.2", "v5.5.3", "release-v5.5"]
SLAVE_CI_FILE: ["spi", "spi_hd", "uart"]
regression_build_coprocessor_idf_v5.5_esp32:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32"]
IDF_VER: ["v5.5", "v5.5.1", "v5.5.2", "v5.5.3", "release-v5.5"]
SLAVE_CI_FILE: ["sdio", "spi", "uart"]
regression_build_coprocessor_idf_master_all_features_enabled:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:latest
parallel:
matrix:
- IDF_TARGET: ["esp32c6"]
SLAVE_CI_FILE: ["all_features"]
regression_build_nimble_examples_h2:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32h2"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "release-v5.4",
"v5.3", "v5.3.1", "v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
IDF_SLAVE_TARGET: ["esp32c6"]
EXAMPLE_TO_BUILD: ["host_nimble_bleprph_host_only_vhci",
"host_nimble_bleprph_host_only_uart_hci"]
regression_build_nimble_examples_p4:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "release-v5.4",
"v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
IDF_SLAVE_TARGET: ["esp32c6"]
EXAMPLE_TO_BUILD: ["host_nimble_bleprph_host_only_vhci",
"host_nimble_bleprph_host_only_uart_hci"]
regression_build_bluedroid_examples_h2:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32h2"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "release-v5.4",
"v5.3", "v5.3.1", "v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
IDF_SLAVE_TARGET: ["esp32"]
EXAMPLE_TO_BUILD: ["host_bluedroid_ble_compatibility_test",
"host_bluedroid_bt_hid_mouse_device",
"host_bluedroid_host_only",
"host_bt_controller_mac_addr"]
regression_build_bluedroid_examples_p4:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "release-v5.4",
"v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
IDF_SLAVE_TARGET: ["esp32"]
EXAMPLE_TO_BUILD: ["host_bluedroid_ble_compatibility_test",
"host_bluedroid_bt_hid_mouse_device",
"host_bluedroid_host_only",
"host_bt_controller_mac_addr"]
regression_build_wifi_examples_h2:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32h2"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "release-v5.4",
"v5.3", "v5.3.1", "v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
IDF_SLAVE_TARGET: ["esp32c6"]
EXAMPLE_TO_BUILD: ["host_wifi_easy_connect_dpp_enrollee",
"host_wifi_itwt",
"host_transport_config",
"host_network_split__power_save"]
regression_build_wifi_examples_p4:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "release-v5.4",
"v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
IDF_SLAVE_TARGET: ["esp32c6"]
EXAMPLE_TO_BUILD: ["host_wifi_easy_connect_dpp_enrollee",
"host_wifi_itwt",
"host_transport_config",
"host_network_split__power_save"]
# build an example using the various transports
# this is to verify transport builds as expected on the host
# for h2, build only for ESP-IDF v5.3 and v5.3.1
# for p4, build for other ESP-IDFs
regression_build_transport_examples_h2:
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32h2"]
IDF_VER: ["v5.3", "v5.3.1"]
IDF_SLAVE_TARGET: ["esp32c6"]
EXAMPLE_TO_BUILD: ["host_network_split__power_save"]
EXAMPLE_CI_FILE: ["spi", "spi_hd", "uart"]
regression_build_transport_examples_p4:
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "release-v5.4",
"v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
IDF_SLAVE_TARGET: ["esp32c6"]
EXAMPLE_TO_BUILD: ["host_network_split__power_save"]
EXAMPLE_CI_FILE: ["sdio", "spi", "spi_hd", "uart"]
regression_build_misc_examples:
tags:
- build
rules:
- !reference [.staging_branch_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4", "esp32h2"]
IDF_VER: ["v5.4", "v5.4.1", "v5.4.2", "v5.4.3", "release-v5.4",
"v5.3.2", "v5.3.3", "v5.3.4", "v5.3.5", "release-v5.3"]
IDF_SLAVE_TARGET: ["esp32c6"]
EXAMPLE_TO_BUILD: ["host_gpio_expander",
"host_peer_data_transfer",
"host_performs_slave_ota"]
@@ -0,0 +1,26 @@
# Holds rules for running jobs
# default rule
# used for running jobs on a merge request to staging
.default_rules:
rules:
- if: $CI_COMMIT_BRANCH == "staging" && $CI_PIPELINE_SOURCE == "push"
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "staging"
# staging branch rule
# used for running regression jobs on staging branch
.staging_branch_rules:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: $CI_COMMIT_BRANCH == "staging" && $CI_PIPELINE_SOURCE == "push"
# no build rule to disable jobs temporarily
# while testing new build rules
.no_build_rules:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: $CI_COMMIT_BRANCH == "staging" && $CI_PIPELINE_SOURCE == "push"
when: never
@@ -0,0 +1,228 @@
# Holds jobs that run from a merge request
###
### Check project pre-requisites have been fulfilled
###
premerge_check:
rules:
- !reference [.default_rules, rules]
extends: .premerge_check_template
image: espressif/idf:latest
###
### Build host using ESP-IDF examples
###
### protocols/mqtt example
### IDF master and v6.x don't build mqtt example with wifi-remote and ESP-Hosted
### so we only verify mqtt example against earlier IDF
sanity_build_idf_release_mqtt:
variables:
EXAMPLE_CI_FILE: "sdkconfig.ci.p4_wifi"
rules:
- !reference [.default_rules, rules]
extends: .build_template_example_mqtt
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_VER: ["release-v5.5"]
IDF_TARGET: ["esp32p4"]
IDF_SLAVE_TARGET: ["esp32c6", "esp32c5"]
### wifi/iperf example
sanity_build_idf_v5.5_iperf:
rules:
- !reference [.default_rules, rules]
extends: .build_template
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_VER: ["v5.5.4", "release-v5.5"]
IDF_TARGET: ["esp32p4"]
IDF_SLAVE_TARGET: ["esp32c6", "esp32c5"]
IDF_EXAMPLE_PATH: ["examples/wifi/iperf"]
sanity_build_idf_master_iperf:
rules:
- !reference [.default_rules, rules]
extends: .build_template
image: espressif/idf:latest
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_SLAVE_TARGET: ["esp32c6", "esp32c5", "esp32c61"]
IDF_EXAMPLE_PATH: ["examples/wifi/iperf"]
###
### Build coprocessor
###
sanity_build_coprocessor_idf_v5.5:
rules:
- !reference [.default_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32c6", "esp32c5"]
IDF_VER: ["v5.5.4", "release-v5.5"]
SLAVE_CI_FILE: ["sdio", "spi", "spi_hd", "uart", "dpp"]
# verify co-processor targets with Wi-Fi + BT
sanity_build_coprocessor_idf_master:
rules:
- !reference [.default_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:latest
parallel:
matrix:
- IDF_TARGET: ["esp32c6", "esp32c5", "esp32c61"]
SLAVE_CI_FILE: ["sdio", "spi", "spi_hd", "uart", "dpp"]
# verify co-processor targets with BT only
sanity_build_coprocessor_idf_master_2:
rules:
- !reference [.default_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:latest
parallel:
matrix:
- IDF_TARGET: ["esp32h2"]
SLAVE_CI_FILE: ["spi", "spi_hd", "uart"]
# verify co-processor targets with OpenThread RCP
# v5.5.4 is for Zigbee SDK release
sanity_build_coprocessor_rcp:
rules:
- !reference [.default_rules, rules]
extends: .build_template_coprocessor
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32c6", "esp32c5", "esp32h2"]
IDF_VER: ["latest", "v5.5.4"]
SLAVE_CI_FILE: ["openthread_rcp"]
###
### build ESP-Hosted examples
###
sanity_build_nimble_examples:
rules:
- !reference [.default_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["latest",
"v5.5.4", "release-v5.5"]
IDF_SLAVE_TARGET: ["esp32c6", "esp32h2"]
EXAMPLE_TO_BUILD: ["host_nimble_bleprph_host_only_vhci",
"host_nimble_bleprph_host_only_uart_hci"]
# verify host builds with co-processor target with BT only
sanity_build_nimble_examples_2:
rules:
- !reference [.default_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["latest"]
IDF_SLAVE_TARGET: ["esp32h2"]
EXAMPLE_TO_BUILD: ["host_nimble_bleprph_host_only_vhci",
"host_nimble_bleprph_host_only_uart_hci"]
sanity_build_bluedroid_examples:
rules:
- !reference [.default_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["latest",
"v5.5.4", "release-v5.5"]
IDF_SLAVE_TARGET: ["esp32"]
EXAMPLE_TO_BUILD: ["host_bluedroid_ble_compatibility_test",
"host_bluedroid_bt_hid_mouse_device",
"host_bluedroid_host_only",
"host_bt_controller_mac_addr"]
sanity_build_wifi_examples:
rules:
- !reference [.default_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["latest",
"v5.5.4", "release-v5.5"]
IDF_SLAVE_TARGET: ["esp32c6", "esp32c5"]
EXAMPLE_TO_BUILD: ["host_wifi_easy_connect_dpp_enrollee",
"host_wifi_itwt",
"host_transport_config",
"host_network_split__power_save",
"host_performs_slave_ota"]
# build an example using the various transports
# this is to verify transport builds as expected on the host
sanity_build_transport_examples:
rules:
- !reference [.default_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["latest",
"v5.5.4", "release-v5.5"]
IDF_SLAVE_TARGET: ["esp32c6"]
EXAMPLE_TO_BUILD: ["host_network_split__power_save"]
EXAMPLE_CI_FILE: ["sdio", "spi", "spi_hd", "uart"]
# build OpenThread Host examples
sanity_build_openthread_examples:
rules:
- !reference [.default_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["latest"]
IDF_SLAVE_TARGET: ["esp32c6", "esp32c5"]
EXAMPLE_TO_BUILD: ["host_openthread_border_router",
"host_openthread_cli"]
# build Zigbee Host examples
sanity_build_zigbee_examples:
rules:
- !reference [.default_rules, rules]
extends: .build_template_example
image: espressif/idf:${IDF_VER}
parallel:
matrix:
- IDF_TARGET: ["esp32p4"]
IDF_VER: ["v5.5.4"]
IDF_SLAVE_TARGET: ["esp32c6", "esp32c5"]
EXAMPLE_TO_BUILD: ["host_zigbee_thermostat"]
###
### Promote staging to main after successful regression testing
###
promote_staging_to_main:
stage: deploy
dependencies: []
rules:
- if: $CI_COMMIT_BRANCH == "staging" && $CI_PIPELINE_SOURCE == "push"
script:
- git remote set-url origin https://oauth2:${GITLAB_TOKEN_STAGING_TO_MAIN}@gitlab.espressif.cn:6688/app-frameworks/esp_hosted_mcu.git
- git push origin $CI_COMMIT_SHA:main
tags:
- build
@@ -0,0 +1,326 @@
# Holds templates used for jobs
.premerge_check_template:
stage: pre
tags:
- build
script:
- source ${IDF_PATH}/export.sh
# check the exported fw versions
- python tools/check_fw_versions.py
# check the changelog
- python tools/check_changelog.py
# check weak functions # Can also pass --functions optionally # Can also pass --functions optionally.
- python tools/check_weak_functions.py --file host/api/src/esp_wifi_weak.c
.build_template_coprocessor:
stage: build_coprocessor
tags:
- build
dependencies: []
artifacts:
when: always
expire_in: 4 days
script:
- export IDF_PYTHON_CHECK_CONSTRAINTS=yes
- ${IDF_PATH}/install.sh --enable-ci
- source ${IDF_PATH}/export.sh
- SDKCONFIG_PATTERN="sdkconfig.ci.${SLAVE_CI_FILE}"
# Build with IDF pedantic flags and IDF build apps script
- export ESP_HOSTED_CI_PEDANTIC=1
- export EXTRA_CFLAGS="-DIDF_CI_BUILD"
- export EXTRA_CXXFLAGS="-DIDF_CI_BUILD"
- |
if [[ -n ${CONFIG_OVERRIDE} ]]; then
CONFIG_OVERRIDE_STRING="--override-sdkconfig-items=${CONFIG_OVERRIDE}"
echo "adding ${CONFIG_OVERRIDE_STRING} to build"
fi
- cd slave
# use --enable-preview-targets to build for all targets
- idf-build-apps find -p . --enable-preview-targets --config ${SDKCONFIG_PATTERN} ${CONFIG_OVERRIDE_STRING} -vv --target ${IDF_TARGET}
- idf-build-apps build -p . --enable-preview-targets --config ${SDKCONFIG_PATTERN} ${CONFIG_OVERRIDE_STRING} -vv --target ${IDF_TARGET}
.build_template_example:
stage: build_example
tags:
- build
dependencies: []
artifacts:
when: always
expire_in: 4 days
script:
- export IDF_PYTHON_CHECK_CONSTRAINTS=yes
- ${IDF_PATH}/install.sh --enable-ci
- source ${IDF_PATH}/export.sh
# Need to rename the cloned "esp_hosted_mcu" directory since the injected component name is "esp_hosted"
- cd .. && rm -rf esp_hosted && mv esp_hosted_mcu esp_hosted && cd esp_hosted
# Create components directory and link esp_hosted component
- export OVERRIDE_PATH=`pwd`
- cd examples/${EXAMPLE_TO_BUILD}
# Create components directory and link esp_hosted component
- mkdir -p components
- ln -sf ${OVERRIDE_PATH} components/esp_hosted
# Override component dependency as backup only if not already present
- |
if ! grep -q "esp_hosted" main/idf_component.yml 2>/dev/null; then
cat ${OVERRIDE_PATH}/.gitlab-ci-override-idf-component.yml >> main/idf_component.yml
echo "Added esp_hosted override to idf_component.yml"
fi
# Add slave target configuration if specified
# Also add wi-fi remote slave target for supported targets (not ESP32-H2)
- |
if [ ! -z "${IDF_SLAVE_TARGET}" ]; then
if [[ "${IDF_SLAVE_TARGET}" != "esp32h2" ]]; then
echo "CONFIG_SLAVE_IDF_TARGET_${IDF_SLAVE_TARGET^^}=y" >> sdkconfig.defaults
echo "Added target CONFIG_SLAVE_IDF_TARGET_${IDF_SLAVE_TARGET^^}=y to sdkconfig.defaults"
fi
echo "CONFIG_ESP_HOSTED_CP_TARGET_${IDF_SLAVE_TARGET^^}=y" >> sdkconfig.defaults
echo "Added target CONFIG_ESP_HOSTED_CP_TARGET_${IDF_SLAVE_TARGET^^}=y to sdkconfig.defaults"
fi
# Append sdkconfig.ci.common if available
- |
if [ -f sdkconfig.ci.common ]; then
cat sdkconfig.ci.common >> sdkconfig.defaults
echo "Appended sdkconfig.ci.common to sdkconfig.defaults"
fi
# Build with IDF pedantic flags and IDF build apps script
- export ESP_HOSTED_CI_PEDANTIC=1
- export EXTRA_CFLAGS="-DIDF_CI_BUILD"
- export EXTRA_CXXFLAGS="-DIDF_CI_BUILD"
# Build with extra ci config file if specified
- |
if [ ! -z "${EXAMPLE_CI_FILE}" ]; then
idf-build-apps find -p . -vv --config sdkconfig.ci.${EXAMPLE_CI_FILE} --target ${IDF_TARGET}
idf-build-apps build -p . -vv --config sdkconfig.ci.${EXAMPLE_CI_FILE} --target ${IDF_TARGET}
else
idf-build-apps find -p . -vv --target ${IDF_TARGET}
idf-build-apps build -p . -vv --target ${IDF_TARGET}
fi
# build mqtt example from examples/protocol/mqtt
# the example may be mqtt or mqtt/tcp, depending on IDF version
.build_template_example_mqtt:
stage: build
tags:
- build
artifacts:
paths:
- "artifacts_*/"
when: always
expire_in: 4 days
script:
- export IDF_PYTHON_CHECK_CONSTRAINTS=yes
- ${IDF_PATH}/install.sh --enable-ci
- source ${IDF_PATH}/export.sh
# Need to rename the cloned "esp_hosted_mcu" directory since the injected component name is "esp_hosted"
- cd .. && rm -rf esp_hosted && mv esp_hosted_mcu esp_hosted && cd esp_hosted
- export OVERRIDE_PATH=`pwd`
# get path to mqtt example to build
- |
# Check if the newer path structure exists (latest and release-v6.0)
if [ -f "${IDF_PATH}/examples/protocols/mqtt/main/idf_component.yml" ]; then
MQTT_EXAMPLE_PATH="${IDF_PATH}/examples/protocols/mqtt"
# Fall back to older path structure (release-v5.x and earlier)
elif [ -f "${IDF_PATH}/examples/protocols/mqtt/tcp/main/idf_component.yml" ]; then
MQTT_EXAMPLE_PATH="${IDF_PATH}/examples/protocols/mqtt/tcp"
else
echo "Error: Could not find MQTT example at either path"
ls -la ${IDF_PATH}/examples/protocols/mqtt/ || true
exit 1
fi
echo "Using MQTT example path: ${MQTT_EXAMPLE_PATH}"
- cd ${MQTT_EXAMPLE_PATH}
# Create components directory and link esp_hosted component
- mkdir -p components
- ln -sf ${OVERRIDE_PATH} components/esp_hosted
# Override component dependency as backup only if not already present
- |
if ! grep -q "esp_hosted" main/idf_component.yml 2>/dev/null; then
cat ${OVERRIDE_PATH}/.gitlab-ci-override-idf-component.yml >> main/idf_component.yml
echo "Added esp_hosted override to idf_component.yml"
fi
# Add slave target configuration if specified
# Also add wi-fi remote slave target for supported targets (not ESP32-H2)
- |
if [ ! -z "${IDF_SLAVE_TARGET}" ]; then
if [[ "${IDF_SLAVE_TARGET}" != "esp32h2" ]]; then
echo "CONFIG_SLAVE_IDF_TARGET_${IDF_SLAVE_TARGET^^}=y" >> sdkconfig.defaults
echo "Added target CONFIG_SLAVE_IDF_TARGET_${IDF_SLAVE_TARGET^^}=y to sdkconfig.defaults"
fi
echo "CONFIG_ESP_HOSTED_CP_TARGET_${IDF_SLAVE_TARGET^^}=y" >> sdkconfig.defaults
echo "Added target CONFIG_ESP_HOSTED_CP_TARGET_${IDF_SLAVE_TARGET^^}=y to sdkconfig.defaults"
fi
# Append sdkconfig.ci.common if available
- |
if [ -f sdkconfig.ci.common ]; then
cat sdkconfig.ci.common >> sdkconfig.defaults
echo "Appended sdkconfig.ci.common to sdkconfig.defaults"
fi
# Build with IDF pedantic flags and IDF build apps script
- export ESP_HOSTED_CI_PEDANTIC=1
- export EXTRA_CFLAGS="-DIDF_CI_BUILD"
- export EXTRA_CXXFLAGS="-DIDF_CI_BUILD"
# use --config-file to override default IDF config file
# use --enable-preview-targets to build for all targets
# use --override-sdkconfig-items to override (possibly incorrect) build target that may be in provided config file
- idf-build-apps find -p . --enable-preview-targets --config-file "${OVERRIDE_PATH}/.idf_build_apps.toml" --override-sdkconfig-items=CONFIG_IDF_TARGET=${IDF_TARGET} -vv --target ${IDF_TARGET}
- idf-build-apps build -p . --enable-preview-targets --config-file "${OVERRIDE_PATH}/.idf_build_apps.toml" --override-sdkconfig-items=CONFIG_IDF_TARGET=${IDF_TARGET} -vv --target ${IDF_TARGET}
# Copy config files back to project directory for artifacts
- mkdir -p ${OVERRIDE_PATH}/artifacts_${IDF_TARGET}_${IDF_SLAVE_TARGET}
- cp sdkconfig* ${OVERRIDE_PATH}/artifacts_${IDF_TARGET}_${IDF_SLAVE_TARGET}/ 2>/dev/null || echo "No sdkconfig files found"
- cp main/idf_component.yml ${OVERRIDE_PATH}/artifacts_${IDF_TARGET}_${IDF_SLAVE_TARGET}/ 2>/dev/null || echo "No component file found"
# Clean up the component symlink
- unlink components/esp_hosted
- echo "Cleaned up esp_hosted component symlink"
# Rename back, since post scripts expect the original name
- cd ${OVERRIDE_PATH} && cd .. && mv esp_hosted esp_hosted_mcu
# build mqtt/tcp example from espressif/mqtt Registry Component
.build_template_mqtt_tcp_component:
stage: build
tags:
- build
artifacts:
paths:
- "artifacts_*/"
when: always
expire_in: 4 days
script:
- export IDF_PYTHON_CHECK_CONSTRAINTS=yes
- ${IDF_PATH}/install.sh --enable-ci
- source ${IDF_PATH}/export.sh
# Need to rename the cloned "esp_hosted_mcu" directory since the injected component name is "esp_hosted"
- cd .. && rm -rf esp_hosted && mv esp_hosted_mcu esp_hosted && cd esp_hosted
- export OVERRIDE_PATH=`pwd`
# get the example from Component Registry
- echo "Checking out example ${IDF_REGISTRY_COMPONENT}:${IDF_REGISTRY_COMPONENT_EXAMPLE}"
- cd ..
- idf.py create-project-from-example "${IDF_REGISTRY_COMPONENT}:${IDF_REGISTRY_COMPONENT_EXAMPLE}"
- cd "${IDF_REGISTRY_COMPONENT_EXAMPLE}"
# Override esp_hosted component in example's deps with the one from the current repository
- mkdir -p components
- ln -sf ${OVERRIDE_PATH} components/esp_hosted
# Add slave target configuration if specified
# Also add wi-fi remote slave target for supported targets (not ESP32-H2)
- |
if [ ! -z "${IDF_SLAVE_TARGET}" ]; then
if [[ "${IDF_SLAVE_TARGET}" != "esp32h2" ]]; then
echo "CONFIG_SLAVE_IDF_TARGET_${IDF_SLAVE_TARGET^^}=y" >> sdkconfig.defaults
echo "Added target CONFIG_SLAVE_IDF_TARGET_${IDF_SLAVE_TARGET^^}=y to sdkconfig.defaults"
fi
echo "CONFIG_ESP_HOSTED_CP_TARGET_${IDF_SLAVE_TARGET^^}=y" >> sdkconfig.defaults
echo "Added slave target CONFIG_ESP_HOSTED_CP_TARGET_${IDF_SLAVE_TARGET^^}=y to sdkconfig.defaults"
fi
# EXAMPLE_CI_FILE: use sdkconfig CI file in example directory
- |
if [ ! -z "${SDKCONFIG_CI_FILE}" ]; then
cp ${OVERRIDE_PATH}/${SDKCONFIG_CI_FILE} ./sdkconfig.ci.custom
echo "Using custom sdkconfig: ${SDKCONFIG_CI_FILE}"
SDKCONFIG_PATTERN="sdkconfig.ci.custom"
elif [ ! -z "${EXAMPLE_CI_FILE}" ]; then
echo "Using CI sdkconfig file in example: ${EXAMPLE_CI_FILE}"
SDKCONFIG_PATTERN="./${EXAMPLE_CI_FILE}"
else
SDKCONFIG_PATTERN="sdkconfig.ci*"
fi
- echo "SDKCONFIG_PATTERN is ${SDKCONFIG_PATTERN}"
# Build with IDF pedantic flags and IDF build apps script
- export ESP_HOSTED_CI_PEDANTIC=1
- export EXTRA_CFLAGS="-DIDF_CI_BUILD"
- export EXTRA_CXXFLAGS="-DIDF_CI_BUILD"
# use --config-file to override default IDF config file
# use --enable-preview-targets to build for all targets
# use --override-sdkconfig-items to override (possibly incorrect) build target that may be in provided config file
- idf-build-apps find -p . --enable-preview-targets --config-file "${OVERRIDE_PATH}/.idf_build_apps.toml" --config ${SDKCONFIG_PATTERN} --override-sdkconfig-items=CONFIG_IDF_TARGET=${IDF_TARGET} -vv --target ${IDF_TARGET}
- idf-build-apps build -p . --enable-preview-targets --config-file "${OVERRIDE_PATH}/.idf_build_apps.toml" --config ${SDKCONFIG_PATTERN} --override-sdkconfig-items=CONFIG_IDF_TARGET=${IDF_TARGET} -vv --target ${IDF_TARGET}
# Copy config files back to project directory for artifacts
- mkdir -p ${OVERRIDE_PATH}/artifacts_${IDF_TARGET}_${IDF_SLAVE_TARGET}
- cp sdkconfig* ${OVERRIDE_PATH}/artifacts_${IDF_TARGET}_${IDF_SLAVE_TARGET}/ 2>/dev/null || echo "No sdkconfig files found"
- cp main/idf_component.yml ${OVERRIDE_PATH}/artifacts_${IDF_TARGET}_${IDF_SLAVE_TARGET}/ 2>/dev/null || echo "No component file found"
# Clean up the component symlink
- unlink components/esp_hosted
- echo "Cleaned up esp_hosted component symlink"
# Rename back, since post scripts expect the original name
- cd ${OVERRIDE_PATH} && cd .. && mv esp_hosted esp_hosted_mcu
.build_template:
stage: build
tags:
- build
artifacts:
paths:
- "artifacts_*/"
when: always
expire_in: 4 days
script:
- export IDF_PYTHON_CHECK_CONSTRAINTS=yes
- ${IDF_PATH}/install.sh --enable-ci
- source ${IDF_PATH}/export.sh
# Need to rename the cloned "esp_hosted_mcu" directory since the injected component name is "esp_hosted"
- cd .. && rm -rf esp_hosted && mv esp_hosted_mcu esp_hosted && cd esp_hosted
# Replaces esp_hosted component in example's deps with the one from the current repository
- export OVERRIDE_PATH=`pwd`
- cd ${IDF_PATH}/${IDF_EXAMPLE_PATH}
# Create components directory and link esp_hosted component
- mkdir -p components
- ln -sf ${OVERRIDE_PATH} components/esp_hosted
- echo "Created components directory with esp_hosted link:"
- ls -la components/
# Override component dependency as backup only if not already present
- |
if ! grep -q "esp_hosted" main/idf_component.yml 2>/dev/null; then
cat ${OVERRIDE_PATH}/.gitlab-ci-override-idf-component.yml >> main/idf_component.yml
echo "Added esp_hosted override to idf_component.yml"
fi
# Add slave target configuration if specified
# Also add wi-fi remote slave target for supported targets (not ESP32-H2)
- |
if [ ! -z "${IDF_SLAVE_TARGET}" ]; then
if [[ "${IDF_SLAVE_TARGET}" != "esp32h2" ]]; then
echo "CONFIG_SLAVE_IDF_TARGET_${IDF_SLAVE_TARGET^^}=y" >> sdkconfig.defaults
echo "Added target CONFIG_SLAVE_IDF_TARGET_${IDF_SLAVE_TARGET^^}=y to sdkconfig.defaults"
fi
echo "CONFIG_ESP_HOSTED_CP_TARGET_${IDF_SLAVE_TARGET^^}=y" >> sdkconfig.defaults
echo "Added slave target CONFIG_ESP_HOSTED_CP_TARGET_${IDF_SLAVE_TARGET^^}=y to sdkconfig.defaults"
fi
# HOSTED_CI_FILE: use custom sdkconfig CI file from esp_hosted directory, or
# EXAMPLE_CI_FILE: use sdkconfig CI file in example directory
- |
if [ ! -z "${SDKCONFIG_CI_FILE}" ]; then
cp ${OVERRIDE_PATH}/${SDKCONFIG_CI_FILE} ./sdkconfig.ci.custom
echo "Using custom sdkconfig: ${SDKCONFIG_CI_FILE}"
SDKCONFIG_PATTERN="sdkconfig.ci.custom"
elif [ ! -z "${EXAMPLE_CI_FILE}" ]; then
echo "Using CI sdkconfig file in example: ${EXAMPLE_CI_FILE}"
SDKCONFIG_PATTERN="./${EXAMPLE_CI_FILE}"
else
SDKCONFIG_PATTERN="sdkconfig.ci*"
fi
- echo "SDKCONFIG_PATTERN is ${SDKCONFIG_PATTERN}"
# Build with IDF pedantic flags and IDF build apps script
- export ESP_HOSTED_CI_PEDANTIC=1
- export EXTRA_CFLAGS="-DIDF_CI_BUILD"
- export EXTRA_CXXFLAGS="-DIDF_CI_BUILD"
# Remove the conflicting extconn config that disables hosted
- rm -f sdkconfig.ci.*extconn*
# use --config-file to override default IDF config file
# use --enable-preview-targets to build for all targets
# use --override-sdkconfig-items to override (possibly incorrect) build target that may be in provided config file
- idf-build-apps find -p . --enable-preview-targets --config-file "${OVERRIDE_PATH}/.idf_build_apps.toml" --config ${SDKCONFIG_PATTERN} --override-sdkconfig-items=CONFIG_IDF_TARGET=${IDF_TARGET} -vv --target ${IDF_TARGET}
- idf-build-apps build -p . --enable-preview-targets --config-file "${OVERRIDE_PATH}/.idf_build_apps.toml" --config ${SDKCONFIG_PATTERN} --override-sdkconfig-items=CONFIG_IDF_TARGET=${IDF_TARGET} -vv --target ${IDF_TARGET}
# - echo "----------- last sdkconfig.defaults,ci* used (${IDF_TARGET}-${IDF_SLAVE_TARGET}) --------------"
# - cat sdkconfig.defaults
# - cat sdkconfig.ci*
# - echo "----------- last (generated) sdkconfig used (${IDF_TARGET}-${IDF_SLAVE_TARGET}) --------------"
# - cat sdkconfig
# - echo "----------------------------------------------"
# Copy config files back to project directory for artifacts
- mkdir -p ${OVERRIDE_PATH}/artifacts_${IDF_TARGET}_${IDF_SLAVE_TARGET}
- cp sdkconfig* ${OVERRIDE_PATH}/artifacts_${IDF_TARGET}_${IDF_SLAVE_TARGET}/ 2>/dev/null || echo "No sdkconfig files found"
- cp main/idf_component.yml ${OVERRIDE_PATH}/artifacts_${IDF_TARGET}_${IDF_SLAVE_TARGET}/ 2>/dev/null || echo "No component file found"
# Clean up the component symlink
- unlink components/esp_hosted
- echo "Cleaned up esp_hosted component symlink"
# Rename back, since post scripts expect the original name
- cd ${OVERRIDE_PATH} && cd .. && mv esp_hosted esp_hosted_mcu