Commit Graph

162 Commits

Author SHA1 Message Date
Jesse Braham
c63f40f412
Actually enforce clippy lints in CI (#767)
* Actually enforce clippy lints in CI

* Fix a couple clippy lints in `esp-riscv-rt`

* Fix a couple clippy lints for `esp32c6-lp-hal`
2023-08-30 10:30:36 -07:00
Dániel Buga
92a2cc7c31
Update to embassy-executor 0.3 (#756) 2023-08-29 10:39:17 -07:00
Dániel Buga
e082d47a87
Multicore-aware executors (#723)
* Implement multicore-aware executors

* Add examples

* Use pre-defined config to import SystemPeripheral

* Use static_cell::make_static
2023-08-28 10:05:42 -07:00
Jesse Braham
ae455ed8a7
Switch RISC-V MSRV to nightly release channel (#725)
* Use `nightly` release for MSRV check

* Un-pin the `log` package version
2023-08-15 06:39:36 -07:00
Björn Quentin
bbe1e5df59
ESP32-C6 LP CORE delay and basic gpio (#715)
* ESP32-C6 LP CORE delay and basic gpio

* CHANGELOG.md, build LP examples in release mode
2023-08-12 14:04:25 +00:00
Jesse Braham
64556da803
Create the esp32c6-lp-hal package (#714)
* Create the `esp32c6-lp-hal` package

* Update CHANGELOG
2023-08-10 09:48:46 -07:00
onsdagens
d6d5e0c86b
Adding direct vector table hooking support for RISC-V's (#621)
* direct vectoring support added

* provide minimal handlers for hooking the vector table directly

* changed direct vectoring interrupt enable interface to map to CPU interrupt

* direct vectoring interrupt nesting

* removed unused dependency

* added tentative c2 and c6 support for direct vector table hooking

* added direct vectoring examples

* added direct vectoring examples

* updated changelog

* added direct vectoring to CI

* Added H2 support and example, moved helpers to esp-hal-common

* Added H2 direct vectoring example to CI

* Removed remnants of removed feature

* C6 and H2 examples fixed

* C6 and H2 examples fixed

* C6 and H2 examples fixed

* Comment fixed

* Added preemption flag to RT

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
2023-08-01 16:28:40 +01:00
Dániel Buga
adeb3c67c8
Documentation fixes (#668)
* Rustdoc improvements

* Format efuse bracketed names as code

* Fix SPI docs
2023-07-24 20:16:48 +01:00
Jesse Braham
31f7b974fd
Ensure that documentation can be generated for all packages in CI (#659)
* Make documentation buildable again

* Ensure that documentation can be generated for all packages in CI
2023-07-17 07:33:58 -07:00
Sergio Gasquez Arcos
a80f919102 Create issue_handler.yml 2023-06-22 05:37:24 -07:00
Jesse Braham
55169346f2 Fix the octal_psram example for ESP32-S3, check example in CI 2023-06-22 02:27:27 -07:00
Jesse Braham
463ff7137a
CI updates (#599)
* Add `esp-riscv-rt` package to `clippy-riscv` and `rustfmt` checks

* Update `esp32h2-hal` job to check all examples
2023-06-19 07:16:37 -07:00
Scott Mabin
8361ca308c
Move esp-riscv-rt into esp-hal (#578)
* Move esp-riscv-rt into esp-hal

* Add changelog entry
2023-06-07 08:15:47 -07:00
Jesse Braham
d86300f799
Add all SPI examples for the ESP32-H2 (#549)
* Update the `GDMA` driver to support the ESP32-H2

* Update the `SPI` driver to support the ESP32-H2

* Add `SPI` examples for ESP32-H2

* Update CHANGELOG

* Remove copy-pasted references to ESP32-C6

* Update GPIO pins used in SPI examples, add `qspi_flash` example

* Update SPI clock configuration to produce correct clock rate

* Correct comment regarding clock source frequency

Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>

* H2: Add PLL_48M_CLK src to ClockControl and RawClocks

* H2: Use PLL_48M_CLK as SPI clk src

* H2: cleanup commented block in SPI driver

* H2: update docs comment in embassy_spi example

* fmt

* Add a new line in embassy_spi example

---------

Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>
Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com>
2023-05-31 09:49:13 +02:00
Jesse Braham
748512f849
Add interrupt-related examples for the ESP32-H2 (#557)
* Add interrupt-related examples for the ESP32-H2

* Update CI workflow to actually check `interrupt_preemption` examples
2023-05-25 09:22:26 -07:00
Sergio Gasquez Arcos
14ac8c3c80
Initial support for RMT in ESP32-H2 (#556)
* feat:  Enable RMT peripheral

* feat:  Rename RMT GPIOs

* feat:  Add clock source, ram size and ram start

* feat:  Rename GPIOs

* feat:  Add pulse_control example

* fix: 🐛 Fix example clock

* feat:  Initial support for H2

* fix: 📝 Fix typo

* ci:  Enable check on H2

* build: 📌 Update esp-pac revision, use fork

* docs: 📝 Update example documentation

* docs: 📝 Add todo

* docs: 📝 Update changelog

* feat:  Add ram example

* build: 📌 Update H2 PAC

* docs: 📝 Remove todo
2023-05-23 10:14:17 -07:00
Jesse Braham
661a9de5eb
Add some miscellaneous examples for the ESP32-H2 (#548)
* Add some miscellaneous examples for the ESP32-H2

* Update the CHANGELOG
2023-05-17 07:13:47 -07:00
Sergio Gasquez Arcos
e2442f2d47
Initial support for I2C in ESP32-H2 (#538)
* feat:  Enable i2c peripheral

* feat:  Add I2cExt1 for H2

* feat:  Initial i2c support

* feat:  Add i2c examples

* ci:  Add embassy_i2c check

* ci: 🐛 Fix features

* docs: 📝 Update changelog

* feat:  Add read_efuse example
2023-05-15 16:20:01 +02:00
bjoernQ
068a6453de Fix the PR template 2023-05-11 11:22:42 +02:00
Jesse Braham
b43516682e
Add async support to the I2C driver (#519)
* Small refactor to extract functions for setting up reads/writes

* Implement async capabilities for `I2C` driver

* Add async I2C examples for each supported chip

* Update CHANGELOG
2023-05-10 10:38:16 -07:00
Sergio Gasquez
f2b12b79bb ci: 📌 Unpin nightly version 2023-05-10 07:56:10 -07:00
bjoernQ
d221fe2d65 Add changelog check in CI 2023-05-10 16:35:07 +02:00
bjoernQ
b77d05f009 Add a PR template 2023-05-10 08:35:42 +02:00
Kirill Mikhailov
ad0b4e4bef Update CI
Comment direct-boot test, still only buildable, but requires fixes for Real HW
2023-05-08 08:03:08 -07:00
Kirill Mikhailov
7d72acb2d7 Added WDT support for ESP32-H2 (#511)
* Added init function

* Populated enums

* Adding enums

* Add TODO (according to IDF update)

* Added WDT support for ESP32-H2

* Updated hello_world example

* Add two examples for both watchdog and RTC watchdog

* Add specific bit initialization for TIMG0 and TIMG1

* Cleaning the code

* adjusting for rustfmt

* uncommented direct-boot feature test in CI
2023-05-08 08:03:08 -07:00
Jesse Braham
c3b4e83846 Add initial ADC/GPIO implementation for ESP32-H2 (#494)
* Add `esp32h2-hal` package to the VS Code workspace and CI workflow

* Add initial (not quite complete) implementation of GPIO/ADC for ESP32-H2
2023-05-08 08:03:08 -07:00
Scott Mabin
1731169112
Async serial write (#510)
* Initial async_{write|flush} implementations

- ESP32C3 + UART0 example

* Support UART1 & UART2

* Add examples for all chips

* reduce number of wakers depending on uart count
2023-05-05 09:05:15 -07:00
Björn Quentin
13acedf69a
ESP32: Initial PSRAM Support (#506)
* ESP32: Initial PSRAM Support

* Update CHANGELOG, fmt
2023-05-04 12:21:24 +01:00
bjoernQ
56a6910780 Pin nightly to 2023-03-09 to workaround a problem with embedded-hal-async in CI 2023-04-17 08:18:31 +02:00
Jesse Braham
20cdf81bd6 Check the esp-hal-smartled package in CI
This does *not* verify MSRV or clippy at this time
2023-03-10 08:06:11 -08:00
Jesse Braham
5747ddee14
Extract the esp-hal-smartled package (#429)
* Extract the `esp-hal-smartled` package

This (finally) eliminates the `esp_hal_common::utils` module!

* Remove all references to the old `smartled` feature from CI
2023-03-10 10:36:07 +00:00
Gustavo Henrique Nihei
453a7ac3f0
[ESP32-C3] Restore MCUboot build after moving to esp-riscv-rt (#417)
* esp32c3-hal: Fix operations on EXTMEM peripheral

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* esp32c3-hal: Restore MCUboot build after moving to esp-riscv-rt

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* esp32c3-hal: Fix location of .data linker output section

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

* ci: Enable MCUboot build for ESP32-C3

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>

---------

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-03-01 14:10:35 +00:00
Jesse Braham
d293d9f162
Add support for the ESP32-C6 (#392)
* Create the `esp32c6-hal` package

* Teach `esp-hal-common` about the ESP32-C6

* Get a number of peripheral drivers building for the ESP32-C6

bckup

initial clocks_ii

* Create the `esp32c6-hal` package

C6: update

* Simplify and fix the linker script

update

* C6: add I2S

* Create the `esp32c6-hal` package

* Teach `esp-hal-common` about the ESP32-C6

* Get a number of peripheral drivers building for the ESP32-C6

bckup

initial clocks_ii

* Create the `esp32c6-hal` package

* C6: update

* Simplify and fix the linker script

* update

* C6: add I2S

* update

* C6 Interrupts

* C6: Update build.rs, linker scripts and initial examples

* C6: RMT

* Fix interrupt handling

* Fix `ClockControl::configure`

* C6: revert to I2S0 instead of just I2S

* C6: rebase and update

* RTC not buildable

* Implement RWDT and SWD disable

* C6: working LEDC

* C6: working RMT

* C6: add aes

* C6: add mcpwm

* C6: add rtc_cntln - not finished

* C6: update and formatting

* C6: add pcnt

* C6: add examples and format

* Remove inline assembly, fix interrupts and linker scripts

* Remove unused features, update cargo config for atomic emu, misc cleanup

* Get ADC building and example "working" (as much as it ever does)

* Remove a bunch of unused constants which were copied from ESP-IDF

* The `mcpwm` example now works correctly

* Get `TWAI` peripheral driver building for C6

* Clean up the `rtc_cntl` module and get all the other HALs building again

* Add the C6 to our CI workflow

* Fix various things that have been missed when rebasing

Still missing a few examples (`clock_monitor`, `embassy_spi`, `ram`)

* C6: Small updates in wdt (#1)

* C6: Update WDT

* C6: Update examples with WDT update

* Update `esp-println` dependency to fix build errors

* Fix formatting issues causing pre-commit hook to fail

* Get some more examples working

* Working `ram` example

* Sync with changes in `main` after rebasing

* Working `embassy_spi` example

* Use a git dependency for the PAC until we publish a release

* Fix I2S for ESP32-C6

* Fix esp32c6 direct boot (#4)

* Add direct boot support for C6

* Fix direct boot for c6

- Actually copy into rtc ram
- remove dummy section that is no longer needed (was just a waste of
  flash space)
- Move RTC stuff before the no load sections

* Update RWDT and refactor RTC (#3)

* C6: Update RWDT and add example, refactor RTC and add not-really-good example

* Update based on review comments, resolve bunch of warnings and run cargo fmt

* Update C6 esp-pacs rev commit

* Fix clocks_ll/esp32c6.rs

* Fix riscv interrupts

* Remove clock_monitor example for now

* RAM example works in direct-boot mode

* Add a TODO for &mut TIMG0 and cargo fmt

* Fix linker script after a bad rebase

* Update CI and Cargo.toml embassy required features

* use riscv32imac-unknown-none-elf target for C6 in CI

* change default target to riscv32imac-unknown-none-elf

* add riscv32imac-unknown-none-elf target to MSRV job

* another cleanup

---------

Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de>
Co-authored-by: Jesse Braham <jesse@beta7.io>

* Make required changes to include new `RADIO` peripheral

* Use published versions of PAC and `esp-println`

* Use the correct target extensions (`imac`)

* Fix the super watchdog timer, plus a few more examples

* Fix UART clock configuration

* Make sure to sync UART registers when configuring AT cmd detection

* Disable APM in direct-boot mode

* Address a number of review comments

* Fix `SPI` clocks and `rtc_watchdog` example  (#6)

* fix SPI clocks

* run cargo fmt

* Add comment about used default clk src

* Fix rtc_watchdog example in BL mode

* run cargo fmt

* Update rtc_watchdog example that it works in DB mode

* README and example fixes/cleanup

* Add I2C peripheral enable and reset

* Fix `ApbSarAdc` configuration in `system.rs`

---------

Co-authored-by: bjoernQ <bjoern.quentin@mobile-j.de>
Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com>
Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
Co-authored-by: Scott Mabin <scott@mabez.dev>
2023-02-27 09:15:44 -08:00
Scott Mabin
3f7181fece
Async SPI (#385)
* ground work for async dma (gdma only atm)

* Add async DMA (GDMA) - esp32c3/esp32c2

* Add Async SPI impl for esp32c3/c2

* Remove private modules from DMA

* add async spi example for esp32c3

* Switch to assoc wakers instead of a static array

* add support for esp32/esp32s2

* add support for esp32s3

* run fmt

* add c2 example, fix CI

* Remove redundant comments
2023-02-08 11:02:03 +00:00
Sergio Gasquez Arcos
e65cacee58
Fix CI warnings (#379)
* ci: ️ Replace `actions-rs/toolchain` by `dtolnay/rust-toolchain`

* ci: ⬆️ Bump `actions/checkout`

* ci: ⬆️ Bump `Swatinem/rust-cache`
2023-02-02 06:59:28 -08:00
Scott Mabin
0eac22eba1
Async: GPIO (#333)
* Add `is_listening` to `Pin` trait

* Add `Wait` impl for Gpio Input

* Add GPIO wait example for C3

* Ensure correct bank is accessed in interrupt

* Add esp32c2 wait example

* Add esp32s3 wait example

* Add esp32s2 wait example

* Add esp32 wait example

* Run fmt

* Add example to cargo tomls

* Add top level docs for embassy examples

* Mention the higher MSRV for async in the README

---------

Co-authored-by: Jesse Braham <jesse@beta7.io>
2023-01-27 10:44:08 -08:00
Jesse Braham
832f9ef4d4
Refactor the clock module, provide ROM functions via linker scripts (#353)
* Refactor `clock` and `clocks_ll` into a common module

* Add a ROM function linker script to each HAL and provide some functions

* Use the provided ROM functions instead of transmuting addresses

* Fix CI workflow for ESP32-S2
2023-01-23 07:12:33 -08:00
Jesse Braham
4d036c38e0 Use the latest xtensa-toolchain version 2023-01-11 08:22:18 -08:00
Jesse Braham
23690a4472 Rework the CI workflow 2023-01-09 08:52:30 -08:00
Scott Mabin
452fde2c12
Peripheral ref/gpio (#323)
* Implement Peripheral for all GPIO pins

* Update i2c & i2s to use the new gpio peripherals ref

* gpio pref: usb

* gpio pref: pulse control (RMT)

* gpio pref: spi

* gpio pref: uart

* gpio pref: ledc

* gpio pref: mcpwm

* fixup smartleds to use new pulse controller traits

* dump msrv

* bump rust-version in cargo tomls
2022-12-19 14:40:29 +00:00
Jesse Braham
54e8eaf185 Use latest xtensa-toolchain version for all CI jobs 2022-12-14 01:38:58 -08:00
Jesse Braham
2632421d86 Add a job to verify formatting 2022-12-12 07:02:29 -08:00
Scott Mabin
0000d46ac5 Embassy init updates:
- Rename timg feature to timg0 to better refect which TG is being used
- Use the time_driver::TimerType in the signature of init to fix #268
- Update examples
- Fix CI features
- Add timg0 cfg to build.rs
2022-12-08 06:36:42 -08:00
Scott Mabin
9064177e99
Initial embassy support (#225)
* wip: timg embassy driver

- read_raw on timg renamed to now()
- timg initialized and stored in static for use in the embassy driver
- timg sets alarm value
- untested whether alarms actually trigger

* TIMG timer driver for esp32, esp32s3

- Adds the timg timer block as a time driver for embassy
- Not enabled on the C3 as it only has one timer block, better to use
  systimer
- s2 example added but can't build due to atomic requirements in
  futures-core

* Add S2 atomic support with emulation, fixup embassy support for the S2

* Move executor & static-cell to dev deps. Make eha optional

* Add c2 support, run fmt

* Update to crates.io embassy releases

* Update eha

* update timg time driver to new trait

* Remove exception feature of esp-backtrace and use the user handler for backtracing

* Add async testing workflow

* Update systick example

* Fix S2 examples

* Update xtensa-toolchain

* set rustflags for s2 target

* Disable systick for esp32s2 until we can fix the noted issues

* review improvements

- Fix intr prio array being off by one
- emabssy time prio interrupt set to max prio
- use cfg instead of feature for systick detection

* Update example time delays
2022-11-09 08:04:38 -08:00
Jesse Braham
e040b55fd9 Check each supported chip with the direct-boot feature enabled as well 2022-10-31 10:18:22 -07:00
Jesse Braham
e2b2d55bf8 Fix a bunch of cfg gates, use published version of PAC 2022-10-12 12:25:15 -07:00
Jesse Braham
5ddfacb1c6 Re-enable RTC in remaining examples, fix linker scripts, fix CI 2022-10-12 10:01:13 -07:00
Jesse Braham
c55ef277d8 Add the ESP32-C2 to the CI workflow, update README 2022-10-11 10:12:42 -07:00
Jesse Braham
797d9b5e02 Minor CI tweaks 2022-08-30 11:32:31 -07:00
Jesse Braham
6f20358124
Update the Cargo manifests and top-level README (#168)
* Add the `rust-version` key to each Cargo manifest

* Normalize dependencies and features in each Cargo manifest

* Enable all features in CI when checking examples

* Update the top-level README
2022-08-25 09:20:05 -07:00
Scott Mabin
be184a552d
critical_section implementations & esp_backtrace (#151)
* CS impl

* use CS Mutex in C3 examples

* use CS Mutex in S2 examples

* Update esp32 example

* run fmt

* Update S3 examples

* Remove uses of unsafe where no longer required

* use esp_backtrace in examples

* fix import & fmt once more

* Bump MSRV to 1.60.0

Co-authored-by: Jesse Braham <jesse@beta7.io>
2022-08-22 20:02:28 +01:00
Jesse Braham
82371f526c Add jobs to the CI workflow to verify the MSRV 2022-08-03 17:12:18 +02:00
Scott Mabin
1789780d06
Xtensa vectored interrupts (#103)
* Xtensa interrupt vectoring: peripheral source

- Initial Xtensa vectoring, updated esp32 gpio example to use new interrupt macro.
- Only peripheral sources supported.
- Only level one priority supported.
- CPU & Edge interrupts still need to be handled.

* Xtensa interrupt vectoring: CPU & EDGE

- Add support for handling CPU interrupts and edge interrupts
- PR required to xtensa-lx-rt for CPU handlers

* Xtensa interrupt vectoring: Priority

- Finally implement priortization
- Only three priorities available at the moment. Xtensa programmer guide
  discourages using highpri interrupts in Rust/C. Guide also mentions
  using software priortization to increase the number of Priorities
  available

* support CPU interrupts, using patch xtensa-lx-rt

* Update example

* Add support & examples for the s2 & s3 too

* Fix formatting and missing imports

* Run interrupt handling in ram, optionally run the vector handler in ram in the examples

* Use xtensa_lx::Mutex CS when enabling interrupts

* Run clippy on each target

* Remove redundant features

* Fix C3 builds

* make enable unsafe. Add note about preallocated interrupts in vectored mode.

* Remove `INTERRUPT_LEVELS` static

The interrupt levels static introduces a few issues
  - A lock is needed when configuring interrupts to keep
    INTERRUPT_LEVELS in a consistent state
  - Interrupts enabled from outside the Rust domain wouldn't be
    serviced, this is the case with the wifi blobs

To remove it, the prioty configuration is now calculated dynamically in
the interrupt handler. Essentially INTERRUPT_LEVELS is now created once
the interrupt triggers. It has some benefits, such as only having to
look at interrupts configured on the current core, not both, but there
is of course an overhead with doing this in the interrupt.

* Allow raw interrupts on levels 4-7, whilst also supporting vectoring on levels 1-3

* rename core number features

* Fix examples and formatting

* use xtensa-lx-rt release, update pacs

* Support passing the trap frame into interrupt handlers

* cfg away the #[interrupt] macro when not using vectoring

* rename enable to map

move vectored feature to chip specific hals

* export vectored functions

- rename `enable_with_priority` to `enable`
- add docs for interrupt macro

* Update all examples to use vectored interrupts
2022-07-25 07:12:34 -07:00
Jesse Braham
a5bdab7316 Update the CI to include the hello_rgb example in checks again 2022-07-20 10:44:04 -07:00
Jesse Braham
b7e84bc7fd Update CI workflow now that we aren't in a workspace 2022-05-31 10:17:13 -07:00
Jesse Braham
80e22ba508 Enforce clippy lints in CI 2022-05-05 14:18:09 +02:00
Jesse Braham
3cb276838e Update xtensa-toolchain action and fix build errors 2022-04-28 16:15:32 +02:00
Jesse Braham
1f033f4e65 If one device fails in CI, do not cancel the checks for others in the matrix 2022-03-29 09:33:39 -07:00
bjoernQ
545f997b07 Support ESP32S3 2022-02-16 15:44:06 +00:00
bjoernQ
0039996e8e Remove obsolete FIXME comment, check ESP32S2 in CI builds 2022-02-14 18:04:48 +00:00
Jesse Braham
9bbe5e0987 Allow for CI runs to be manually dispatched 2022-01-13 09:08:55 -08:00
Jesse Braham
61bd8ee8d4 Add a CI workflow to check the examples for each package 2022-01-07 16:35:59 -08:00