diff --git a/.github/workflows/build_at.yml b/.github/workflows/build_at.yml index 2c08c8d..4de3c00 100644 --- a/.github/workflows/build_at.yml +++ b/.github/workflows/build_at.yml @@ -49,3 +49,102 @@ jobs: grep esp_wifi_remote_init ${dir}sample.map | grep libwifi_remote_over_at.a || exit 1 echo -e "esp_wifi_remote_init linked from libwifi_remote_over_at" done + + + build_wrmt_over_at_slave: + if: contains(github.event.pull_request.labels.*.name, 'at') || github.event_name == 'push' + name: Build WRMT-AT Slave + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Checkout esp-protocols + uses: actions/checkout@v3 + with: + repository: espressif/esp-protocols + ref: mqtt_cxx-v0.5.0 + path: protocols + - name: Checkout idf + uses: actions/checkout@v3 + with: + repository: espressif/esp-idf + ref: 8ad0d3d8f2faab752635bee36070313c47c07a13 + path: idf + - name: Build modem_sim from esp-protocols + shell: bash + run: | + export IDF_PATH=$GITHUB_WORKSPACE/idf + ${IDF_PATH}/install.sh + cd $GITHUB_WORKSPACE/protocols/common_components/modem_sim + ./install.sh PLATFORM_ESP32C6 ESP32C6-4MB 22 23 + source export.sh + idf.py build + ${GITHUB_WORKSPACE}/ci/clean_build_artifacts.sh build + zip -qur artifacts.zip build + mv artifacts.zip ${GITHUB_WORKSPACE}/ + - uses: actions/upload-artifact@v4 + with: + name: wrmt_over_at_slave + path: artifacts.zip + if-no-files-found: error + + build_wrmt_over_at_host: + name: Build WRMT-AT Host + strategy: + matrix: + idf_ver: ["latest"] + runs-on: ubuntu-latest + container: espressif/idf:${{ matrix.idf_ver }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Build with IDF-${{ matrix.idf_ver }} + shell: bash + run: | + ${IDF_PATH}/install.sh --enable-ci + . ${IDF_PATH}/export.sh + cd ./components/esp_wifi_remote/examples/mqtt + # Add wifi_remote_over_at dependency to idf_component.yml (manually with override_path) + echo -e " wifi_remote_over_at:\n version: '*'\n override_path: ../../../../wifi_remote_over_at" >> main/idf_component.yml + idf.py build -D SDKCONFIG_DEFAULTS=custom.sdkconfig.at + ${GITHUB_WORKSPACE}/ci/clean_build_artifacts.sh build + zip -qur artifacts.zip build + - uses: actions/upload-artifact@v4 + with: + name: wrmt_over_at_host + path: ./components/esp_wifi_remote/examples/mqtt/artifacts.zip + if-no-files-found: error + + run_example: + # Skip running on forks since it won't have access to secrets + if: github.repository == 'espressif/esp-wifi-remote' + name: AT target test + needs: + - build_wrmt_over_at_slave + - build_wrmt_over_at_host + strategy: + matrix: + idf_ver: ["latest"] + runs-on: [self-hosted, wifi-remote] + container: + image: python:3.11-bookworm + options: --privileged # Privileged mode has access to serial ports + env: + TEST_DIR: components/esp_wifi_remote/examples + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: wrmt_over_at_host + path: ${{ env.TEST_DIR }}/mqtt/ + - uses: actions/download-artifact@v4 + with: + name: wrmt_over_at_slave + path: ${{ env.TEST_DIR }}/server/ + - name: Run Test + working-directory: ${{ env.TEST_DIR }} + run: | + python -m pip install pytest-embedded-serial-esp pytest-embedded-idf pytest-rerunfailures pytest-timeout pytest-ignore-test-results + unzip server/artifacts.zip -d server/ + unzip mqtt/artifacts.zip -d mqtt/ + python -m pytest --log-cli-level DEBUG --target esp32c6,esp32p4 diff --git a/ci/clean_build_artifacts.sh b/ci/clean_build_artifacts.sh new file mode 100755 index 0000000..b3d139c --- /dev/null +++ b/ci/clean_build_artifacts.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +shopt -s extglob # enable extended globs for selective cleanup +BUILD_DIR=$1 +rm -rf $BUILD_DIR/!(*.bin|*.elf|*.map|bootloader|config|partition_table|customized_partitions|flasher_args.json|download.config|factory) +if [ -d $BUILD_DIR/bootloader ]; then rm -rf $BUILD_DIR/bootloader/!(*.bin); fi +if [ -d $BUILD_DIR/partition_table ]; then rm -rf $BUILD_DIR/partition_table/!(*.bin); fi +shopt -u extglob # disable extended globs diff --git a/components/esp_wifi_remote/examples/mqtt/custom.sdkconfig.at b/components/esp_wifi_remote/examples/mqtt/custom.sdkconfig.at new file mode 100644 index 0000000..caa62eb --- /dev/null +++ b/components/esp_wifi_remote/examples/mqtt/custom.sdkconfig.at @@ -0,0 +1,8 @@ +CONFIG_IDF_TARGET="esp32p4" +CONFIG_ESP_WIFI_REMOTE_LIBRARY_CUSTOM=y +CONFIG_ESP_WIFI_SSID="local_mosquitto" +CONFIG_ESP_WIFI_PASSWORD="local_mosquitto_password" +CONFIG_WIFI_RMT_AT_UART_TX_PIN=47 +CONFIG_WIFI_RMT_AT_UART_RX_PIN=48 +CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y +CONFIG_BROKER_URL="mqtt://192.168.4.1" diff --git a/components/esp_wifi_remote/examples/pytest_eppp.py b/components/esp_wifi_remote/examples/pytest_eppp.py index d6c19bc..1d477b8 100644 --- a/components/esp_wifi_remote/examples/pytest_eppp.py +++ b/components/esp_wifi_remote/examples/pytest_eppp.py @@ -21,6 +21,8 @@ def test_wifi_remote_eppp(dut: Tuple[IdfDut, IdfDut]) -> None: # Check for wifi station connected event (different for hosted and eppp) if dut[1].app.sdkconfig.get('ESP_WIFI_REMOTE_LIBRARY_HOSTED') is True: server.expect('slave_rpc: Sta mode connected', timeout=100) + elif dut[1].app.sdkconfig.get('ESP_WIFI_REMOTE_LIBRARY_CUSTOM') is True: + server.expect('Got IPv4 event: Interface', timeout=100) else: server.expect('rpc_server: Received WIFI event 4', timeout=100) client.expect('MQTT_EVENT_CONNECTED', timeout=100) diff --git a/components/wifi_remote_over_at/.cz.yaml b/components/wifi_remote_over_at/.cz.yaml index ae51f1e..d7666f7 100644 --- a/components/wifi_remote_over_at/.cz.yaml +++ b/components/wifi_remote_over_at/.cz.yaml @@ -3,6 +3,6 @@ commitizen: bump_message: 'bump(at): $current_version -> $new_version' pre_bump_hooks: python ../../ci/changelog.py wifi_remote_over_at tag_format: wifi_rmt_at-v$version - version: 0.1.0 + version: 0.2.0 version_files: - idf_component.yml diff --git a/components/wifi_remote_over_at/CHANGELOG.md b/components/wifi_remote_over_at/CHANGELOG.md index bac13f1..0c3e7c2 100644 --- a/components/wifi_remote_over_at/CHANGELOG.md +++ b/components/wifi_remote_over_at/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [0.2.0](https://github.com/espressif/esp-wifi-remote/commits/wifi_rmt_at-v0.2.0) + +### Features + +- Add target test for wrmt-over-at ([44b9830](https://github.com/espressif/esp-wifi-remote/commit/44b9830)) + ## [0.1.0](https://github.com/espressif/esp-wifi-remote/commits/wifi_rmt_at-v0.1.0) ### Features diff --git a/components/wifi_remote_over_at/README.md b/components/wifi_remote_over_at/README.md index 5bc5f7a..f20f349 100644 --- a/components/wifi_remote_over_at/README.md +++ b/components/wifi_remote_over_at/README.md @@ -5,3 +5,26 @@ This component has no public API, it only provides definitions of `esp_wifi_remote` functions. It uses `esp_modem` as a host implementation, and `esp-at` at the communication coprocessor side. + +## Build the host side + +`esp_wifi_remote` does not provide a backend selection for `wifi_remote_over_at` directly. You need to choose "custom implementation" and add this component to the project dependencies. +- set `CONFIG_ESP_WIFI_REMOTE_LIBRARY_CUSTOM=y` +- run `idf.py add-dependency wifi_remote_over_at` + +## Build the slave side + +The slave side uses `modem_sim` component from https://github.com/espressif/esp-protocols repository. +To build it, download: +- ESP-IDF v5.4@8ad0d3d8 +- esp-protocols mqtt_cxx-v0.5.0 + +### Configure ESP-AT +- `cd common_components/modem_sim` +- `./install.sh [platform] [module] [tx-pin] [rx-pin]` + - for example `./install.sh PLATFORM_ESP32C6 ESP32C6-4MB 22 23` for esp32c6 on the P4-C6 board +- `source export.sh` + +### Build, flash, monitor + +- `idf.py build flash monitor` diff --git a/components/wifi_remote_over_at/idf_component.yml b/components/wifi_remote_over_at/idf_component.yml index 7834727..b98e7fa 100644 --- a/components/wifi_remote_over_at/idf_component.yml +++ b/components/wifi_remote_over_at/idf_component.yml @@ -1,4 +1,4 @@ -version: 0.1.0 +version: 0.2.0 url: https://github.com/espressif/esp-wifi-remote/tree/master/components/wifi_remote_over_at description: AT based implementation of wifi_remote APIs license: Apache-2.0