Skip to content

Commit

Permalink
H2: Add BLE support (#352)
Browse files Browse the repository at this point in the history
* H2: Add BLE support

* fix ci

* fix ci 2

* Add H2 into test scripts

* update to latest changes

* revert smoltcp change

* Update smoketest.bat

Co-authored-by: Scott Mabin <scott@mabez.dev>

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
  • Loading branch information
JurajSadel and MabezDev authored Dec 6, 2023
1 parent d46dfc4 commit 5e4b215
Show file tree
Hide file tree
Showing 28 changed files with 1,344 additions and 23 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
builds:
strategy:
matrix:
chip: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c6"]
chip: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c6", "esp32h2"]

runs-on: ubuntu-latest
steps:
Expand All @@ -58,50 +58,66 @@ jobs:
- uses: Swatinem/rust-cache@v2

- name: build
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }}
- name: build (common features)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --features=async,wifi,esp-now,embassy-net,log,${{ matrix.chip }}-hal/embassy-time-timg0
- name: build (common features + defmt)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --no-default-features --features=async,wifi,esp-now,embassy-net,defmt,${{ matrix.chip }}-hal/embassy-time-timg0
- name: build (all possible network options)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && for combo in {ipv4,},{ipv6,},{tcp,},{udp,},{igmp,},{dhcpv4,} ; do cargo b${{ matrix.chip }} --release --no-default-features --features=wifi,wifi-logs,$combo ; done
- name: build (access_point)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=access_point --features=wifi
- name: build (access_point_with_sta)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=access_point_with_sta --features=wifi
- name: build (dhcp)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=dhcp --features=wifi
- name: build (bench)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=bench --features=wifi
- name: build (static_ip)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=static_ip --features=wifi
- name: build (esp_now)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=esp_now --features=esp-now
- name: build (embassy_esp_now)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=embassy_esp_now --features=async,esp-now,${{ matrix.chip }}-hal/embassy-time-timg0
- name: build (embassy_esp_now_duplex)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=embassy_esp_now_duplex --features=async,esp-now,${{ matrix.chip }}-hal/embassy-time-timg0
- name: build (embassy_dhcp)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=embassy_dhcp --features=async,wifi,embassy-net,${{ matrix.chip }}-hal/embassy-time-timg0
- name: build (embassy_bench)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=embassy_bench --features=async,wifi,embassy-net,${{ matrix.chip }}-hal/embassy-time-timg0
- name: build (embassy_access_point)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=embassy_access_point --features=async,wifi,embassy-net,${{ matrix.chip }}-hal/embassy-time-timg0
- name: build (embassy_access_point_with_sta)
if: ${{ matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=embassy_access_point_with_sta --features=async,wifi,embassy-net,${{ matrix.chip }}-hal/embassy-time-timg0

- name: build (common features + ble)
if: ${{ matrix.chip != 'esp32s2' }}
if: ${{ matrix.chip != 'esp32s2' && matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --features=async,wifi,ble,esp-now,embassy-net,log,${{ matrix.chip }}-hal/embassy-time-timg0
- name: build (common features + ble + defmt)
if: ${{ matrix.chip != 'esp32s2' }}
if: ${{ matrix.chip != 'esp32s2' && matrix.chip != 'esp32h2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --no-default-features --features=async,wifi,ble,esp-now,embassy-net,defmt,${{ matrix.chip }}-hal/embassy-time-timg0
- name: build (ble)
if: ${{ matrix.chip != 'esp32s2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=ble --features=ble
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=ble --no-default-features --features=ble
- name: build (embassy_ble)
if: ${{ matrix.chip != 'esp32s2' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=embassy_ble --features=async,ble,${{ matrix.chip }}-hal/embassy-time-timg0
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=embassy_ble --no-default-features --features=async,ble,${{ matrix.chip }}-hal/embassy-time-timg0
- name: build (coex)
if: ${{ matrix.chip == 'esp32' || matrix.chip == 'esp32s3' || matrix.chip == 'esp32c3' }}
run: cd esp-wifi && cargo b${{ matrix.chip }} --release --example=coex --features=wifi,ble,coex
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmt = "=0.3.5"
esp32c3-hal = { version = "0.13.0", default-features = false }
esp32c2-hal = { version = "0.11.0", default-features = false }
esp32c6-hal = { version = "0.6.0", default-features = false }
esp32h2-hal = { version = "0.4.0", default-features = false }
esp32-hal = { version = "0.16.0", default-features = false }
esp32s3-hal = { version = "0.13.0", default-features = false }
esp32s2-hal = { version = "0.13.0", default-features = false }
Expand Down Expand Up @@ -61,6 +62,7 @@ esp32-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "22f14fd" }
esp32c2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "22f14fd" }
esp32c3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "22f14fd" }
esp32c6-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "22f14fd" }
esp32h2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "22f14fd" }
esp32s2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "22f14fd" }
esp32s3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "22f14fd" }
esp-hal-common = { git = "https://github.com/esp-rs/esp-hal.git", rev = "22f14fd" }
1 change: 1 addition & 0 deletions esp-wifi-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ esp32 = []
esp32c2 = []
esp32c3 = []
esp32c6 = []
esp32h2 = []
esp32s2 = []
esp32s3 = []

Expand Down
25 changes: 25 additions & 0 deletions esp-wifi-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ fn main() -> Result<()> {
configure_linker_for_chip(&out, "esp32c6")?;
copy_libraries(&out)?;
}
#[cfg(feature = "esp32h2")]
{
configure_linker_for_chip(&out, "esp32h2")?;
copy_libraries(&out)?;
}
#[cfg(feature = "esp32s2")]
{
configure_linker_for_chip(&out, "esp32s2")?;
Expand Down Expand Up @@ -197,6 +202,26 @@ fn copy_libraries(out: &PathBuf) -> Result<()> {
Ok(())
}

#[cfg(feature = "esp32h2")]
fn copy_libraries(out: &PathBuf) -> Result<()> {
copy_file(out, "libs/esp32h2/libble_app.a", "libble_app.a")?;
copy_file(out, "libs/esp32h2/libbtbb.a", "libbtbb.a")?;
copy_file(out, "libs/esp32h2/libcoexist.a", "libcoexist.a")?;
copy_file(out, "libs/esp32h2/libphy.a", "libphy.a")?;
copy_file(
out,
"libs/esp32h2/libwpa_supplicant.a",
"libwpa_supplicant.a",
)?;

println!("cargo:rustc-link-lib={}", "ble_app");
println!("cargo:rustc-link-lib={}", "btbb");
println!("cargo:rustc-link-lib={}", "phy");
println!("cargo:rustc-link-lib={}", "wpa_supplicant");

Ok(())
}

#[cfg(feature = "esp32s2")]
fn copy_libraries(out: &PathBuf) -> Result<()> {
copy_file(out, "ld/esp32s2/rom_functions.x", "esp32s2_rom_functions.x")?;
Expand Down
Loading

0 comments on commit 5e4b215

Please sign in to comment.