Repository navigation
Phase 4D-C1: add guarded Direct/SBO control semantics #188
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ESP-IDF Compile CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| esp32p4-compile: | |
| name: ESP32-P4 / ESP-IDF v6.0.2 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build ESP32-P4 component smoke app | |
| uses: espressif/esp-idf-ci-action@v1 | |
| with: | |
| esp_idf_version: v6.0.2 | |
| target: esp32p4 | |
| path: ports/esp_idf/smoke_app | |
| - name: Build ESP32-P4 BRCB flash probe firmware | |
| uses: espressif/esp-idf-ci-action@v1 | |
| with: | |
| esp_idf_version: v6.0.2 | |
| target: esp32p4 | |
| path: ports/esp_idf/brcb_flash_probe_app | |
| - name: Build flashable ESP32-P4 SV trial firmware | |
| uses: espressif/esp-idf-ci-action@v1 | |
| with: | |
| esp_idf_version: v6.0.2 | |
| target: esp32p4 | |
| path: ports/esp_idf/sv_trial_app | |
| - name: Verify BRCB flash probe outputs | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| app=ports/esp_idf/brcb_flash_probe_app | |
| build="$app/build" | |
| test -s "$build/arstack61850_esp32p4_brcb_flash_probe.bin" | |
| test -s "$build/arstack61850_esp32p4_brcb_flash_probe.elf" | |
| test -s "$build/arstack61850_esp32p4_brcb_flash_probe.map" | |
| test -s "$build/bootloader/bootloader.bin" | |
| test -s "$build/partition_table/partition-table.bin" | |
| test -s "$build/flasher_args.json" | |
| test -s "$app/partitions.csv" | |
| test -s "$app/sdkconfig.defaults" | |
| test -s "$app/README.md" | |
| grep -Eq '^brcb_state,[[:space:]]*0x40,[[:space:]]*0x01,[[:space:]]*,[[:space:]]*0x3000' "$app/partitions.csv" | |
| grep -q 'CONFIG_PARTITION_TABLE_CUSTOM 1' "$build/config/sdkconfig.h" | |
| python3 -m json.tool "$build/flasher_args.json" >/dev/null | |
| python3 - <<'PY' | |
| import json | |
| from pathlib import Path | |
| app = Path('ports/esp_idf/brcb_flash_probe_app') | |
| build = app / 'build' | |
| manifest = json.loads((build / 'flasher_args.json').read_text(encoding='utf-8')) | |
| chip = manifest.get('extra_esptool_args', {}).get('chip') | |
| if chip != 'esp32p4': | |
| raise SystemExit(f'expected flasher chip esp32p4, got {chip!r}') | |
| raw = manifest.get('flash_files') | |
| if not isinstance(raw, dict): | |
| raise SystemExit('probe flasher manifest has no flash_files object') | |
| flash_files = {int(str(k), 0): str(v) for k, v in raw.items()} | |
| expected = { | |
| 0x2000: 'bootloader/bootloader.bin', | |
| 0x8000: 'partition_table/partition-table.bin', | |
| 0x10000: 'arstack61850_esp32p4_brcb_flash_probe.bin', | |
| } | |
| if flash_files != expected: | |
| raise SystemExit( | |
| f'unexpected probe flash layout: expected {expected!r}, got {flash_files!r}') | |
| print('ESP32P4/BRCB-FLASH-PROBE/CROSS-COMPILED') | |
| PY | |
| - name: Verify flashable firmware outputs | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| app=ports/esp_idf/sv_trial_app | |
| build="$app/build" | |
| qa="$app/ci-artifacts" | |
| mkdir -p "$qa" | |
| test -s "$build/arstack61850_esp32p4_sv_trial.bin" | |
| test -s "$build/arstack61850_esp32p4_sv_trial.elf" | |
| test -s "$build/arstack61850_esp32p4_sv_trial.map" | |
| test -s "$build/bootloader/bootloader.bin" | |
| test -s "$build/partition_table/partition-table.bin" | |
| test -s "$build/flash_args" | |
| test -s "$build/flasher_args.json" | |
| test -s "$app/sdkconfig.defaults" | |
| test -s "$app/partitions.csv" | |
| test -s "$app/README.md" | |
| grep -Eq '^brcb_state,[[:space:]]*0x40,[[:space:]]*0x01,[[:space:]]*,[[:space:]]*0x3000' "$app/partitions.csv" | |
| grep -q 'CONFIG_PARTITION_TABLE_CUSTOM 1' "$build/config/sdkconfig.h" | |
| python3 -m json.tool "$build/flasher_args.json" >/dev/null | |
| python3 - <<'PY' | |
| import json | |
| from pathlib import Path | |
| app = Path('ports/esp_idf/sv_trial_app') | |
| build = app / 'build' | |
| qa = app / 'ci-artifacts' | |
| qa.mkdir(parents=True, exist_ok=True) | |
| manifest = json.loads((build / 'flasher_args.json').read_text(encoding='utf-8')) | |
| chip = manifest.get('extra_esptool_args', {}).get('chip') | |
| if chip != 'esp32p4': | |
| raise SystemExit(f'expected flasher chip esp32p4, got {chip!r}') | |
| expected = { | |
| 0x2000: 'bootloader/bootloader.bin', | |
| 0x8000: 'partition_table/partition-table.bin', | |
| 0x10000: 'arstack61850_esp32p4_sv_trial.bin', | |
| } | |
| raw_flash_files = manifest.get('flash_files') | |
| if not isinstance(raw_flash_files, dict): | |
| raise SystemExit('flasher manifest has no flash_files object') | |
| try: | |
| flash_files = { | |
| int(str(offset), 0): str(relative) | |
| for offset, relative in raw_flash_files.items() | |
| } | |
| except (TypeError, ValueError) as exc: | |
| raise SystemExit(f'invalid flasher offset: {exc}') from exc | |
| if flash_files != expected: | |
| pretty_actual = {hex(k): v for k, v in sorted(flash_files.items())} | |
| pretty_expected = {hex(k): v for k, v in sorted(expected.items())} | |
| raise SystemExit( | |
| f'unexpected flash layout: expected {pretty_expected!r}, got {pretty_actual!r}') | |
| flash_evidence = {} | |
| for offset, relative in sorted(expected.items()): | |
| candidate = build / relative | |
| if not candidate.is_file(): | |
| raise SystemExit(f'flash file {relative!r} at {hex(offset)} is missing') | |
| size = candidate.stat().st_size | |
| if size <= 0: | |
| raise SystemExit(f'flash file {relative!r} at {hex(offset)} is empty') | |
| flash_evidence[hex(offset)] = {'path': relative, 'bytes': size} | |
| required = [ | |
| build / 'arstack61850_esp32p4_sv_trial.bin', | |
| build / 'arstack61850_esp32p4_sv_trial.elf', | |
| build / 'arstack61850_esp32p4_sv_trial.map', | |
| build / 'bootloader/bootloader.bin', | |
| build / 'partition_table/partition-table.bin', | |
| build / 'flash_args', | |
| build / 'flasher_args.json', | |
| app / 'sdkconfig.defaults', | |
| app / 'partitions.csv', | |
| app / 'README.md', | |
| ] | |
| inventory = [] | |
| for candidate in required: | |
| if not candidate.is_file() or candidate.stat().st_size <= 0: | |
| raise SystemExit(f'required deployment file is missing or empty: {candidate}') | |
| inventory.append(f'{candidate.relative_to(app)}\t{candidate.stat().st_size} bytes') | |
| (qa / 'ARSTACK_BUILD_FILE_LIST.txt').write_text( | |
| '\n'.join(inventory) + '\n', encoding='utf-8') | |
| evidence = { | |
| 'status': 'FLASHABLE/READY', | |
| 'target': chip, | |
| 'flash_files': flash_evidence, | |
| 'authoritative_manifest': 'build/flasher_args.json', | |
| 'companion_flash_args': 'build/flash_args', | |
| 'sdkconfig_defaults': 'sdkconfig.defaults', | |
| 'brcb_partition_table': 'partitions.csv', | |
| 'brcb_flash_measurement': 'READY_NOT_MEASURED', | |
| } | |
| (qa / 'ARSTACK_BUILD_PROFILE.json').write_text( | |
| json.dumps(evidence, indent=2, sort_keys=True) + '\n', | |
| encoding='utf-8') | |
| print(json.dumps(evidence, indent=2, sort_keys=True)) | |
| PY | |
| ( | |
| cd "$app" | |
| sha256sum \ | |
| build/arstack61850_esp32p4_sv_trial.bin \ | |
| build/arstack61850_esp32p4_sv_trial.elf \ | |
| build/bootloader/bootloader.bin \ | |
| build/partition_table/partition-table.bin \ | |
| build/flash_args \ | |
| build/flasher_args.json \ | |
| ci-artifacts/ARSTACK_BUILD_PROFILE.json \ | |
| ci-artifacts/ARSTACK_BUILD_FILE_LIST.txt \ | |
| sdkconfig.defaults \ | |
| partitions.csv \ | |
| README.md > ci-artifacts/SHA256SUMS | |
| ) | |
| echo "FLASHABLE/READY: ESP32-P4 flasher manifest, BRCB partition layout and firmware set verified." | |
| - name: Upload failed Gate-C diagnostics | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: esp32p4-gate-c-diagnostics-${{ github.event.pull_request.head.sha || github.sha }} | |
| if-no-files-found: warn | |
| retention-days: 7 | |
| path: | | |
| ports/esp_idf/sv_trial_app/ci-artifacts/ARSTACK_BUILD_FILE_LIST.txt | |
| ports/esp_idf/sv_trial_app/ci-artifacts/ARSTACK_BUILD_PROFILE.json | |
| ports/esp_idf/sv_trial_app/ci-artifacts/SHA256SUMS | |
| ports/esp_idf/sv_trial_app/build/flasher_args.json | |
| ports/esp_idf/sv_trial_app/build/flash_args | |
| ports/esp_idf/sv_trial_app/build/arstack61850_esp32p4_sv_trial.bin | |
| ports/esp_idf/sv_trial_app/build/bootloader/bootloader.bin | |
| ports/esp_idf/sv_trial_app/build/partition_table/partition-table.bin | |
| ports/esp_idf/brcb_flash_probe_app/build/flasher_args.json | |
| ports/esp_idf/brcb_flash_probe_app/build/arstack61850_esp32p4_brcb_flash_probe.bin | |
| ports/esp_idf/brcb_flash_probe_app/build/partition_table/partition-table.bin | |
| - name: Upload ESP32-P4 BRCB flash probe firmware | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: esp32p4-brcb-flash-probe-${{ github.event.pull_request.head.sha || github.sha }} | |
| if-no-files-found: error | |
| retention-days: 14 | |
| path: | | |
| ports/esp_idf/brcb_flash_probe_app/build/arstack61850_esp32p4_brcb_flash_probe.bin | |
| ports/esp_idf/brcb_flash_probe_app/build/arstack61850_esp32p4_brcb_flash_probe.elf | |
| ports/esp_idf/brcb_flash_probe_app/build/arstack61850_esp32p4_brcb_flash_probe.map | |
| ports/esp_idf/brcb_flash_probe_app/build/bootloader/bootloader.bin | |
| ports/esp_idf/brcb_flash_probe_app/build/partition_table/partition-table.bin | |
| ports/esp_idf/brcb_flash_probe_app/build/flash_args | |
| ports/esp_idf/brcb_flash_probe_app/build/flasher_args.json | |
| ports/esp_idf/brcb_flash_probe_app/sdkconfig.defaults | |
| ports/esp_idf/brcb_flash_probe_app/partitions.csv | |
| ports/esp_idf/brcb_flash_probe_app/README.md | |
| - name: Upload ESP32-P4 flashable firmware | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: esp32p4-sv-trial-firmware-${{ github.event.pull_request.head.sha || github.sha }} | |
| if-no-files-found: error | |
| retention-days: 14 | |
| path: | | |
| ports/esp_idf/sv_trial_app/build/arstack61850_esp32p4_sv_trial.bin | |
| ports/esp_idf/sv_trial_app/build/arstack61850_esp32p4_sv_trial.elf | |
| ports/esp_idf/sv_trial_app/build/arstack61850_esp32p4_sv_trial.map | |
| ports/esp_idf/sv_trial_app/build/bootloader/bootloader.bin | |
| ports/esp_idf/sv_trial_app/build/partition_table/partition-table.bin | |
| ports/esp_idf/sv_trial_app/build/flash_args | |
| ports/esp_idf/sv_trial_app/build/flasher_args.json | |
| ports/esp_idf/sv_trial_app/ci-artifacts/ARSTACK_BUILD_PROFILE.json | |
| ports/esp_idf/sv_trial_app/ci-artifacts/ARSTACK_BUILD_FILE_LIST.txt | |
| ports/esp_idf/sv_trial_app/ci-artifacts/SHA256SUMS | |
| ports/esp_idf/sv_trial_app/sdkconfig.defaults | |
| ports/esp_idf/sv_trial_app/partitions.csv | |
| ports/esp_idf/sv_trial_app/README.md |