Skip to content

Commit

Permalink
Started adding ESP32-H2 support (esp-rs#482)
Browse files Browse the repository at this point in the history
* Update `esp-hal-procmacros` and `esp-hal-smartled` packages to support H2

* Get scaffolding in place to get `esp-hal-common` building with `esp32h2` feature

* Made some progress, some aside functions are already done, bbpll configure builds, problem with 3 registers

* More progress, all necessary functions are implemented (not every was verified). Next step - test on HW

* added bus update to  function

* add esp32h2-hal package

* remove offset for ROM (maybe temporarly)

* comment yet unimplemented includes

* Provided  (COMPLETELY NOT SURE if it's a real solution)

* defined interrupt_map_base

* fix typo

* Implemented boot_defaults and configure functions for clock

* Not providing _start_trap_rust_hal to the linker manually now

* Typo: delete comment

* Cleaning code(1): Removed unnecessary moves, registers, addresses, functions

* Remove irrelevant comments

* Enable interrupt peripherals

* Fix errors, wrong addresses and offsets. Added new CpuClock mode for esp32h2

* Added bus update, enabling and setting i2c mst clk frequency, deleted irrelevant comments

* fix CpuControl::start_app_core signature (esp-rs#466)

* Minor linker script additions

* Use correct linker script comment style

* get_wakeup_cause: fix comparison error

* Use 192 as mclk_multiple for 24-bit I2S

* use bitflags to decode wakeup cause (esp-rs#473)

* get_wakeup_cause: use bitflags instead of cast, &

* get_wakeup_cause: bitflags for other cpus

* rsa peripheral support (esp-rs#467)

* Added software interrupt API, examples for all of the MCUs

* Added software interrupt API, examples for all of the MCUs

* Pin nightly to 2023-03-09 to workaround a problem with embedded-hal-async in CI

* Fixed comments

* Fixed comments

* Fixed comments

* Get scaffolding in place to get `esp-hal-common` building with `esp32h2` feature

* Updated Cargo.toml

* Added esp32h2-hal and other ESP32-H2 to CI workflow

* Fix Cargo.toml and add a simple hello_world example

* ci: Fix indentation

* Update esp-backtrace version in Cargo.toml

* Adjust for rustfmt

* Adjust for rustfmt

* Adjust for rustfmt

* Deleted irrelevant comments, fixed wrong i2c_clock frequency

* Update esp-hal-common/Cargo.toml

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>

* Populated SocResetReason to get get_wakeup_cause function working

* Update esp-hal-common/src/clock/clocks_ll/esp32h2.rs

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>

* PAC has been updated, should be working now

---------

Co-authored-by: Jesse Braham <jesse@beta7.io>
Co-authored-by: dimpolo <33688001+dimpolo@users.noreply.github.com>
Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de>
Co-authored-by: Christopher Liebman <liebman@zod.com>
Co-authored-by: Josh Weberruss <joshua.weberruss@gmail.com>
Co-authored-by: sreehari prasad <52113972+matrixhead@users.noreply.github.com>
Co-authored-by: onsdagens <pawdzi-7@student.ltu.se>
Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>
Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
  • Loading branch information
10 people committed Apr 21, 2023
1 parent 450b2fd commit 8db23db
Show file tree
Hide file tree
Showing 23 changed files with 1,173 additions and 23 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
run: cd esp-hal-smartled/ && cargo +nightly-2023-03-09 check --features=esp32c3
- name: check (esp32c6)
run: cd esp-hal-smartled/ && cargo +nightly-2023-03-09 check --features=esp32c6
#- name: check (esp32h2)
# run: cd esp-hal-smartled/ && cargo +nightly-2023-03-09 check --features=esp3h2
# Check all Xtensa targets:
- name: check (esp32)
run: cd esp-hal-smartled/ && cargo +esp check --features=esp32,esp32_40mhz
Expand Down Expand Up @@ -180,6 +182,39 @@ jobs:
- name: check esp32c6-hal (async, spi)
run: cd esp32c6-hal/ && cargo +nightly-2023-03-09 check --example=embassy_spi --features=embassy,embassy-time-systick,async

esp32h2-hal:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@v1
with:
target: riscv32imac-unknown-none-elf
toolchain: nightly-2023-03-09
components: rust-src
- uses: Swatinem/rust-cache@v2

# Perform a full build initially to verify that the examples not only
# build, but also link successfully.
# We also use this as an opportunity to verify that the examples link
# for each supported image format.
- name: build esp32h2-hal (no features)
run: cd esp32h2-hal/ && cargo +nightly-2023-03-09 build --examples
- name: build esp32h2-hal (direct-boot)
run: cd esp32h2-hal/ && cargo +nightly-2023-03-09 build --examples --features=direct-boot
# Subsequent steps can just check the examples instead, as we're already
# confident that they link.
- name: check esp32h2-hal (common features)
run: cd esp32h2-hal/ && cargo +nightly-2023-03-09 check --examples --features=eh1,ufmt
# - name: check esp32h2-hal (async, systick)
# run: cd esp32h2-hal/ && cargo +nightly-2023-03-09 check --example=embassy_hello_world --features=embassy,embassy-time-systick
# - name: check esp32h2-hal (async, timg0)
# run: cd esp32h2-hal/ && cargo +nightly-2023-03-09 check --example=embassy_hello_world --features=embassy,embassy-time-timg0
# - name: check esp32h2-hal (async, gpio)
# run: cd esp32h2-hal/ && cargo +nightly-2023-03-09 check --example=embassy_wait --features=embassy,embassy-time-systick,async
# - name: check esp32h2-hal (async, spi)
# run: cd esp32h2-hal/ && cargo +nightly-2023-03-09 check --example=embassy_spi --features=embassy,embassy-time-systick,async

esp32s2-hal:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -264,6 +299,8 @@ jobs:
run: cd esp32c3-hal/ && cargo check --features=eh1,ufmt
- name: msrv (esp32c6-hal)
run: cd esp32c6-hal/ && cargo check --features=eh1,ufmt
- name: msrv (esp32h2-hal)
run: cd esp32h2-hal/ && cargo check --features=eh1,ufmt

msrv-xtensa:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -305,6 +342,8 @@ jobs:
run: cargo +stable clippy --manifest-path=esp32c3-hal/Cargo.toml -- --no-deps
- name: clippy (esp32c6-hal)
run: cargo +stable clippy --manifest-path=esp32c6-hal/Cargo.toml -- --no-deps
- name: clippy (esp32h2-hal)
run: cargo +stable clippy --manifest-path=esp32h2-hal/Cargo.toml -- --no-deps

clippy-xtensa:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -357,6 +396,8 @@ jobs:
run: cargo fmt --all --manifest-path=esp32c3-hal/Cargo.toml -- --check
- name: rustfmt (esp32c6-hal)
run: cargo fmt --all --manifest-path=esp32c6-hal/Cargo.toml -- --check
- name: rustfmt (esp32h2-hal)
run: cargo fmt --all --manifest-path=esp32h2-hal/Cargo.toml -- --check
- name: rustfmt (esp32s2-hal)
run: cargo fmt --all --manifest-path=esp32s2-hal/Cargo.toml -- --check
- name: rustfmt (esp32s3-hal)
Expand Down
8 changes: 4 additions & 4 deletions esp-hal-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ ufmt-write = { version = "0.1.0", optional = true }
# Each supported device MUST have its PAC included below along with a
# corresponding feature.
esp32 = { version = "0.23.0", features = ["critical-section"], optional = true }
esp32c2 = { version = "0.10.0", features = ["critical-section"], optional = true }
esp32c3 = { version = "0.13.0", features = ["critical-section"], optional = true }
esp32c6 = { version = "0.3.0", features = ["critical-section"], optional = true }
esp32h2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "3db0042", package = "esp32h2", features = ["critical-section"], optional = true }
esp32c2 = { version = "0.11.0", features = ["critical-section"], optional = true }
esp32c3 = { version = "0.14.0", features = ["critical-section"], optional = true }
esp32c6 = { version = "0.4.0", features = ["critical-section"], optional = true }
esp32h2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "0ee1cea", package = "esp32h2", features = ["critical-section"], optional = true }
esp32s2 = { version = "0.14.0", features = ["critical-section"], optional = true }
esp32s3 = { version = "0.18.0", features = ["critical-section"], optional = true }

Expand Down
10 changes: 7 additions & 3 deletions esp-hal-common/devices/esp32h2.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[device]
arch = "riscv"
arch = "riscv"
cores = "single_core"

peripherals = [
Expand All @@ -18,8 +18,8 @@ peripherals = [
# "i2c0",
# "i2c1",
# "i2s0",
# "interrupt_core0",
# "intpri",
"interrupt_core0",
"intpri",
# "io_mux",
# "ledc",
# "lp_ana",
Expand Down Expand Up @@ -58,4 +58,8 @@ peripherals = [
# "uart1",
# "uhci0",
# "usb_device",


# Additional peripherals defined by us (the developers):
"plic",
]
Loading

0 comments on commit 8db23db

Please sign in to comment.