Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Apr 26, 2024
0 parents commit 5a37326
Show file tree
Hide file tree
Showing 18 changed files with 1,278 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[build]
#target = "riscv32imc-esp-espidf"
target = "xtensa-esp32-espidf"

[target.xtensa-esp32-espidf]
linker = "ldproxy"
rustflags = ["--cfg", "espidf_time64"]

[target.xtensa-esp32s2-espidf]
linker = "ldproxy"
rustflags = ["--cfg", "espidf_time64"]

[target.xtensa-esp32s3-espidf]
linker = "ldproxy"
rustflags = ["--cfg", "espidf_time64"]

[target.riscv32imc-esp-espidf]
linker = "ldproxy"
rustflags = ["--cfg", "espidf_time64"]

[target.riscv32imac-esp-espidf]
linker = "ldproxy"
rustflags = ["--cfg", "espidf_time64"]

[env]
ESP_IDF_SDKCONFIG_DEFAULTS = ".github/configs/sdkconfig.defaults"
ESP_IDF_VERSION = "v5.1.2"

[unstable]
build-std = ["std", "panic_abort"]
35 changes: 35 additions & 0 deletions .github/configs/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y
CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y

# Examples often require a larger than the default stack size for the main thread and for the sysloop event task.
CONFIG_ESP_MAIN_TASK_STACK_SIZE=20000
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=8192
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=8192

# Go figure...
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=4096

# Enable WS support
CONFIG_HTTPD_WS_SUPPORT=y

# SPI Ethernet demo
CONFIG_ETH_SPI_ETHERNET_DM9051=y
CONFIG_ETH_SPI_ETHERNET_W5500=y
CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL=y

## Uncomment to enable Classic BT
CONFIG_BT_ENABLED=y
CONFIG_BT_BLUEDROID_ENABLED=y
CONFIG_BT_CLASSIC_ENABLED=y
CONFIG_BTDM_CTRL_MODE_BLE_ONLY=n
CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=y
CONFIG_BTDM_CTRL_MODE_BTDM=n
CONFIG_BT_A2DP_ENABLE=y
CONFIG_BT_HFP_ENABLE=y
CONFIG_BT_HFP_CLIENT_ENABLE=y
CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI=y
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
CONFIG_BT_BLE_50_FEATURES_SUPPORTED=y

# Support for TLS with a pre-shared key.
#CONFIG_ESP_TLS_PSK_VERIFICATION=y
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: CI

on:
push:
branches:
- master
pull_request:
schedule:
- cron: "50 6 * * *"
workflow_dispatch:

env:
rust_toolchain: nightly
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
compile:
name: Compile
runs-on: ubuntu-latest
strategy:
matrix:
target:
- riscv32imc-esp-espidf
- xtensa-esp32-espidf
- xtensa-esp32s2-espidf
- xtensa-esp32s3-espidf
idf-version:
- v4.4.6
- v5.1.2
- v5.2
steps:
- name: Setup | Checkout
uses: actions/checkout@v3

- name: Setup | Rust
if: matrix.target == 'riscv32imc-esp-espidf'
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ env.rust_toolchain }}
components: rustfmt, clippy, rust-src

- name: Install Rust for Xtensa
if: matrix.target != 'riscv32imc-esp-espidf'
uses: esp-rs/[email protected]
with:
default: true

- name: Build | Fmt Check
run: cargo fmt -- --check

- name: Build | Clippy
env:
ESP_IDF_VERSION: ${{ matrix.idf-version }}
ESP_IDF_SDKCONFIG_DEFAULTS: "${{ github.workspace }}/.github/configs/sdkconfig.defaults"
RUSTFLAGS: "${{ startsWith(matrix.idf-version, 'v5') && '--cfg espidf_time64' || '' }}"
run: cargo clippy --features nightly,experimental --no-deps --target ${{ matrix.target }} -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort -- -Dwarnings

- name: Build | Compile
env:
ESP_IDF_VERSION: ${{ matrix.idf-version }}
ESP_IDF_SDKCONFIG_DEFAULTS: "${{ github.workspace }}/.github/configs/sdkconfig.defaults"
RUSTFLAGS: "${{ startsWith(matrix.idf-version, 'v5') && '--cfg espidf_time64' || '' }}"
run: cargo build --target ${{ matrix.target }} -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort

- name: Build | Compile, experimental, nightly, no_std
env:
ESP_IDF_VERSION: ${{ matrix.idf-version }}
ESP_IDF_SDKCONFIG_DEFAULTS: "${{ github.workspace }}/.github/configs/sdkconfig.defaults"
RUSTFLAGS: "${{ startsWith(matrix.idf-version, 'v5') && '--cfg espidf_time64' || '' }}"
run: cargo build --no-default-features --features nightly,experimental --target ${{ matrix.target }} -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort

- name: Build | Compile, experimental, nightly, alloc
env:
ESP_IDF_VERSION: ${{ matrix.idf-version }}
ESP_IDF_SDKCONFIG_DEFAULTS: "${{ github.workspace }}/.github/configs/sdkconfig.defaults"
RUSTFLAGS: "${{ startsWith(matrix.idf-version, 'v5') && '--cfg espidf_time64' || '' }}"
run: cargo build --no-default-features --features nightly,experimental,alloc --target ${{ matrix.target }} -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort

- name: Setup | ldproxy
if: matrix.target == 'riscv32imc-esp-espidf'
run: |
curl -L https://github.com/esp-rs/embuild/releases/latest/download/ldproxy-x86_64-unknown-linux-gnu.zip -o $HOME/.cargo/bin/ldproxy.zip
unzip "$HOME/.cargo/bin/ldproxy.zip" -d "$HOME/.cargo/bin/"
chmod a+x $HOME/.cargo/bin/ldproxy
- name: Build | Examples
env:
ESP_IDF_VERSION: ${{ matrix.idf-version }}
ESP_IDF_SDKCONFIG_DEFAULTS: "${{ github.workspace }}/.github/configs/sdkconfig.defaults"
RUSTFLAGS: "${{ startsWith(matrix.idf-version, 'v5') && '--cfg espidf_time64' || '' }} ${{ '-C default-linker-libraries' }}"
WIFI_SSID: "ssid"
WIFI_PASS: "pass"
ESP_DEVICE_IP: "192.168.1.250"
GATEWAY_IP: "192.168.1.1"
GATEWAY_NETMASK: "24"
run: cargo build --examples --target ${{ matrix.target }} -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort
22 changes: 22 additions & 0 deletions .github/workflows/publish-dry-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PublishDryRun

on: workflow_dispatch

env:
rust_toolchain: nightly

jobs:
publishdryrun:
name: Publish Dry Run
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v3

- name: Setup | Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ env.rust_toolchain }}
components: rust-src
- name: Build | Publish Dry Run
run: export ESP_IDF_TOOLS_INSTALL_DIR=out; export ESP_IDF_SDKCONFIG_DEFAULTS=$(pwd)/.github/configs/sdkconfig.defaults; cargo publish --dry-run --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish

on: workflow_dispatch

env:
rust_toolchain: nightly
CRATE_NAME: esp-idf-svc

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
- name: Setup | Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ env.rust_toolchain }}
components: rust-src
- name: Login
run: cargo login ${{ secrets.crates_io_token }}
- name: Build | Publish
run: export ESP_IDF_TOOLS_INSTALL_DIR=out; export ESP_IDF_SDKCONFIG_DEFAULTS=$(pwd)/.github/configs/sdkconfig.defaults; cargo publish --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort
- name: Build Documentation
run: cargo doc --target riscv32imc-esp-espidf -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort; echo "<meta http-equiv=\"refresh\" content=\"0; url=esp_idf_svc\">" > target/riscv32imc-esp-espidf/doc/index.html; mv target/riscv32imc-esp-espidf/doc ./docs
- name: Deploy Documentation
if: ${{ github.ref == 'refs/heads/master' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force_orphan: true
publish_dir: ./docs
- name: Get the crate version from cargo
run: |
version=$(cargo metadata --format-version=1 --no-deps | jq -r ".packages[] | select(.name == \"${{env.CRATE_NAME}}\") | .version")
echo "crate_version=$version" >> $GITHUB_ENV
echo "${{env.CRATE_NAME}} version: $version"
- name: Tag the new release
uses: rickstaa/action-create-tag@v1
with:
tag: v${{env.crate_version}}
message: "Release v${{env.crate_version}}"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.vscode
/.embuild
/target
/Cargo.lock
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [?.??.?] - ????-??-??
29 changes: 29 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "esp-idf-matter"
version = "0.1.0"
authors = ["ivmarkov <[email protected]>"]
edition = "2021"
resolver = "2"
categories = ["embedded", "hardware-support"]
keywords = ["embedded", "svc", "idf", "esp-idf", "esp32"]
description = "Implementation of the embedded-svc traits for ESP-IDF (Espressif's IoT Development Framework)"
repository = "https://github.com/ivmarkov/esp-idf-matter"
license = "MIT OR Apache-2.0"
readme = "README.md"
build = "build.rs"
#documentation = "https://docs.esp-rs.org/esp-idf-svc/"
rust-version = "1.77"

[patch.crates-io]
esp-idf-svc = { path = "../esp-idf-svc" }
rs-matter = { path = "../rs-matter" }

[features]

[dependencies]
log = { version = "0.4", default-features = false }
esp-idf-svc = { version = "0.48", default-features = false, fatures = ["experimental"] }
rs-matter = { version = "0.1", default-features = false }

[build-dependencies]
embuild = "0.31.3"
Loading

0 comments on commit 5a37326

Please sign in to comment.