2308 Commits

Author SHA1 Message Date
Sergio Gasquez Arcos
d28bf16777
Resolve C-EXAMPLE: Gpio and I2c (#3746)
* docs: C-example for i2c

* docs: C-example for gpio

* feat: Mark Flex as unstable

* docs: Remove outdate fixmes

* fix: Clippy lint

* docs: Add time doc examples

* docs: Dont hide imports

* docs: Add link to Peripheral section

* docs: Avoid unsafe when posible

* feat: Generate api baseline
2025-07-07 14:21:05 +00:00
Dániel Buga
ad445752ae
Add clean and build timings to xtask (#3759)
* Add --timings

* Add alias to clean all packages

* Update readme

* Add alias
2025-07-07 13:03:39 +00:00
Dániel Buga
9b59942824
Use MD5 from ROM (#3758) 2025-07-07 12:12:19 +00:00
Sergio Gasquez Arcos
4f7b46df27
docs: Add app desc macro examples (#3750) 2025-07-04 12:48:56 +00:00
Dániel Buga
86e006b601
Rework how peripheral singletons are generated (#3747)
* Handle GPIOs as stable peripherals

* Define interrupts in create_peripheral

* Remove the rest of paste from the peripherals macro

* Move create_peripheral calls out of peripherals!

* Merge macros

* Merge peripherals files

* Delete the peripheral module

* Replace the peripherals macro with for_each generated code

* Do not generate code directly in GPIO metadata
2025-07-04 12:15:12 +00:00
Dániel Buga
68b992f6d6
Add macro to let rustfmt format code blocks in doc comments (#3744)
* Add insert_doc_snippet proc macro

* Replace placeholders

* Allow defining (conditional) replacements

* Use unstable features for module-level docs

* Document the new macro

* Rename macro

* Lint

* Remove nonsense code block check, change syntax

* Remove redundant doc_switch macro
2025-07-04 08:25:37 +00:00
Scott Mabin
ce469d3fd2
make peripheral module private (#3745)
* make peripheral module private

* update api baseline
2025-07-03 15:57:42 +00:00
Dániel Buga
c6df02190b
Use 1.88 & bump HAL MSRV (#3742)
* Update MSRV to 1.88

* Clean up lints

* Generate new baseline

* Bump MSRV of xtensa-lx-rt

* Do not try to replace in semver baseline, bump dependent msrvs

* Changelog
2025-07-03 13:44:27 +00:00
Dániel Buga
583be70559
Allow hooking into the executor (#3737)
* Allow hooking into the executor

* Attempt to test that the callback API is not dysfunctional
2025-07-03 09:17:34 +00:00
Sergio Gasquez Arcos
f8b43a9ca9
Resolve C-EXAMPLE: Spi (#3743)
* docs: Resolve C-example for spi

* style: Update format
2025-07-03 09:15:51 +00:00
Dániel Buga
517b5ccbe2
Make cargo xfmt respect the format config (#3739)
* Make cargo xfmt respect the format config

* Make sure comments and doc code have the same width
2025-07-03 08:18:02 +00:00
Dániel Buga
9146407573
Fix and extend pin layouts (#3726)
* Fix ESP32 pin layout

Co-authored-by: rmsyn <github@weathered-steel.dev>

* Tabulate ESP32

* Fix C2 pin layout

* Fix C3 pin layout

* Fix C6 pin layout

Co-authored-by: rmsyn <github@weathered-steel.dev>

* Note AF availability on IoMuxSignal

* Add mising AFs to H2

* Remove unavailable pins

* Add mising signals to S2

* Add mising signals to S3

* Changelog

* Update semver baseline

---------

Co-authored-by: rmsyn <github@weathered-steel.dev>
2025-07-02 13:16:48 +00:00
Dániel Buga
a7798f6902
Tweak config table (#3734)
* Tweak config table

* Restore active condition on xtal-frequenc

* Print values using display hint

* Fix clippy lints
2025-07-02 10:11:54 +00:00
Björn Quentin
b76a738263
Improve esp-wifi cfg docs (#3733) 2025-07-02 08:53:48 +00:00
Dániel Buga
21f1d89f15
Generate peripherals macro call & remove paste (#3713)
* Expand peripheral metadata

* Generate peripherals macro call

* Remove paste from peripherals

* Add missing peris

* Fix ETM and TRACE0 naming

* Remove redundant tsens symbol

* Remove RTCIO stuff from h2

* Rename S2 RTC_CNTL

* Add missing SYSCON back to S2

* Do not mark the GPIO singleton stable

* Treat unlisted drivers as not available

* Assign stability based on driver info

* Fmt

* Remove unused info
2025-07-01 19:31:21 +00:00
Björn Quentin
54c073fcd2
Prepare changelog (#3731)
* Prepare changelog

* Check for esp-rom-sys CHANGELOG
2025-07-01 16:03:45 +00:00
Björn Quentin
8fffa6ccec
esp-config TUI (#3649)
* Introduce esp-config TUI

* Validate more

* Improve chip-selection, support alternate config.toml files

* Minor improvements

* Clippy --fix

* Do crate-level checks on every change

* de-dup

* Address review comments

* Address review comments

* Remove the safety-belt
2025-07-01 15:14:26 +00:00
Dániel Buga
8c4878cb03
Refactor AssistDebug symbols (#3730) 2025-07-01 14:42:27 +00:00
Dániel Buga
d315816680
Fix broken link (#3729) 2025-07-01 14:08:49 +00:00
Dániel Buga
745cfd71b6
de-paste! the any_peripheral macro (#3699)
* Stop using paste in any_peripheral

* Drop unused macro

* Generate a delegate macro for any-peripheral dispatching

* Fix up PDMA
2025-07-01 13:48:40 +00:00
Björn Quentin
cc2083fd1a
Introduce esp-rom-sys crate (#3688)
* Move ROM function definitions to esp-hal-rom crate

* Patch ESP32 ROM-functions, use it in esp-storage

* Allow placing additional code in IRAM

* esp-storage depends on esp-hal-rom

* Move ROM function wrappers from esp-hal to esp-hal-rom

* Make bootloader-support crate use CRC ROM function

* Minor polishing

* changelogs

* Make CI green

* Define (some) spiflash ROM functions in esp-hal-rom

* Lint

* Avoid duplicate definition of `__assert_func`

* Rename to `esp-rom-sys`

* Mention versioning this crate in the README

* Fixes

* Check self-version

* Docs

* Clippy

* Check if version bump is allowed

* Unconditionally place spiflash ROM function patches (if present) in rwtext

* Cleanup

* Change how unacceptable version bump requests are detected

* Initial version 0.1.0

* Docs

* Use correct version

* Force esp-rom-sys bumps to patch

* Fix
esp-rom-sys-v0.1.0
2025-07-01 13:05:01 +00:00
Sergio Gasquez Arcos
f0913769d4
Resolve C-EXAMPLE: Uart (#3712)
* feat: Add examples to Uart

* feat: Simplify doc examples based on review comments

* feat: Use `uart` as variable name and use UART0

* feat: Remove empty lines

* feat: Include initialization lines

* docs: Add general into_blocking/async examples
2025-07-01 12:49:15 +00:00
Dániel Buga
72fd9a0c74
Fix mcpwm docs (#3727) 2025-07-01 11:26:37 +00:00
Dániel Buga
175f4a16b6
Extract SPI metadata (#3702)
* Extract SPI M/S metadata

* Clean up additional instance trait

* Further SPI cleanups, add OSPI pin setters

* Re-generate semver baseline

* Fix typo
2025-07-01 11:13:26 +00:00
Gabriel Hansson
9eadaa147f
Adjust ESP32-S2 and ESP32-S3 memory region lengths to reflect those defined in ESP-IDF (#3709)
* fix(esp-hal/ld): adjust esp32s2 SRAM size from 188K to 184K

* fix(esp-hal/ld): extend esp32s2 heap size from 130.5K to 136K

* fix(esp-hal/ld): reduce esp32s3 SRAM size with 1K

* docs(changelog): add esp-rs#3709 entry
2025-07-01 08:17:41 +00:00
Dániel Buga
0e8bc25b70
Fix defmt timestamp (#3725) 2025-07-01 06:59:32 +00:00
Dániel Buga
b2a8d6bcee
Move UART instance info to esp-metadata (#3698)
* Move UART instance info to esp-metadata

* Fix typo
2025-06-30 16:38:15 +00:00
Dániel Buga
1d30c2e425
Place I2C async interrupt handler into ram, wait for bus_busy to actually clear (#3722)
* Place I2C async interrupt handler into ram

* Wait for bus_busy to go away

* Changelog
2025-06-30 16:12:33 +00:00
Dániel Buga
b11d810d97
Tweak and make use of the old bind_X_interrupt functions (#3689)
* Rename bind_interrupt functions

* Generate enable/disable functions, remove redundant irq mapping from metadata

* Clean up PARL_IO

* Refactor SPI master, I2S, Uart

* Update USB_DEVICE
2025-06-30 15:28:42 +00:00
Dániel Buga
03a3b6f5d6
Simplify peripheral resets (#3720)
* Update PAC to fix naming inconsistencies, simplify reset code

* Update PAC and simplify

* Remove mcpwm1 reset

* Fix gen register name

* Fixup

* Finalize PAC rev
2025-06-30 15:09:21 +00:00
Gabriel Hansson
541240b460
chore(esp-hal/ld): include metadata.x with the other shared sections (#3673) 2025-06-30 15:07:57 +00:00
Gabriel Hansson
a8af564313
Minor linker script touchups. (#3717)
* refactor(esp-hal/ld): inline `rodata_desc.x`

* refactor(esp-hal/ld): consolidate `.trap` section definition
2025-06-30 13:19:02 +00:00
Gabriel Hansson
cc199a26f3
fix: increase esp32 DRAM by 16K (#3703)
* fix: increase esp32 DRAM by 16K

* docs(changelog): add #3703 entry
2025-06-30 12:09:44 +00:00
Sergio Gasquez Arcos
cf26bf0bea
Update xtensa-toolchain (#3719)
* ci: Test xtensa-toolchain

* ci: Use xtensa-toolchain@v1.6
2025-06-30 11:28:03 +00:00
Björn Quentin
0137fbb5c4
xtask: msrv-bump (#3708)
* Add bump-msrv command

* Make regex dependency optional

* Adjustments

* Make bump-msrv a release sub-command

* Don't assume to bump MSRV for all packages always

* Check

Check

* Re-arrange code

* Remove controversial CLI-switch
2025-06-30 10:29:46 +00:00
Dániel Buga
0f73826a81
Add toolchain arg to more commands (#3714) 2025-06-30 10:27:59 +00:00
Dániel Buga
101de4eab8
Cleanup esp-metadata (#3686)
* Clean up esp-metadata a bit

* Update esp-metadata/src/cfg/gpio.rs

Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>

* Document public API, arrange structs better

---------

Co-authored-by: Juraj Sadel <jurajsadel@gmail.com>
2025-06-30 08:16:22 +00:00
Dániel Buga
9d452a108f
Move USB device pin info to metadata (#3685)
* Allow else in impl_for_pin_type

* Move USB pin workaround info to metadata

* Simplify pin attr collection
2025-06-27 15:13:24 +00:00
Sergio Gasquez Arcos
0c948eb53e
Stability for stack guard configs (#3711)
* fix: Stability for stack guard configs

* docs: Udpate changelog
2025-06-27 10:14:01 +00:00
Benedikt
84bb51215d
RMT: Small cleanups (#3701)
* RMT: make rmt::Error non_exhaustive

It probably should have been in the first place: It seems reasonable
that new variants might be added, such as in this patch series. The
Error enum also covers the entire RMT API (e.g. both rx and tx), such
that it's probably mostly not useful to match all variants anyway.

* RMT: remove spurious read of ch_tx_thr_event in rx code

esp32 and esp32s2 don't have ch_rx_thr_event, since they don't support
wrapping rx

* RMT: remove an unnecessary Iterator.take() that was a no-op
2025-06-26 12:23:05 +00:00
Scott Mabin
4b4a5cd7fb
Update links fields in various packages based on #2589 (#3697) 2025-06-26 09:36:02 +00:00
Dániel Buga
e0b613dd3d
Run MSRV checks with the correct toolchain (#3691)
* Run MSRV checks with the correct toolchain

* .
2025-06-26 08:58:22 +00:00
Dániel Buga
5c0469d98c
Use one more bit for bus clearing (#3696) 2025-06-26 06:39:34 +00:00
Dániel Buga
d91806197d
Don't check default priority (#3693) 2025-06-25 14:20:14 +00:00
Björn Quentin
99042a7d60
Don't lie about the MSRV (#3692)
* Don't lie about the MSRV

* Don't mention MSRV in xtensa-lx-* docs
2025-06-25 11:20:52 +00:00
Dániel Buga
1e71341922
Mention persisting memory during deep sleep (#3690) 2025-06-25 06:41:03 +00:00
Dániel Buga
c72889a73d
Generate i2c instances from metadata (#3678) 2025-06-24 12:18:22 +00:00
Benedikt
c71cbcd2c3
RMT: Refactor driver internals (less macros, type-erased channels) (#3505)
* RMT: Move some methods from (Tx|Rx)ChannelInternal to ChannelInternal

Adds a new `ChannelInternal` trait implemented on `Channel`s, which
bundles some methods that conceptually make sense for both rx and tx
channels (whether the implementation is exactly the same is
chip-specific).
This avoids a small amount of code duplication.

* RMT: Define input/output signals via a const array

Allowing a default implementation of the getter functions in the ChannelInternal
trait, and more importantly, paving the way for type-erased channels
(where it will become necessary to map Channel number to signal at runtime).

The array is indexed by ch_index, i.e. the index of the channel among
channels of the same type (for devices with separate rx/tx channels).

* RMT: move some `Sized` bounds from methods to trait

To avoid repetition. There's no downside, since the trait is only
implemented for a single type anyway, which is Sized.

These traits are user-visible, but since they can't be implemented by users,
and this only makes the bounds stricter, it should require not changes
to user code.

* RMT: Use composition with ConstChannelAccess, reduces macro usage

instead of an extension trait implemened via the impl_*_channel macros.
This reduces macro usage, making the code easier to reason about, and it also
paves the way for type-erased channels by adding a second implementation
of RawChannelAccess.

This touches many lines, but is a fairly mechanical change that should
be easier to review by ignoring whitespace changes.

Previously, channel architecture was as follows:

- `Channel` is parameterized by a const generic `CHANNEL: u8` number
- low-level hardware operations are implemented via the
  *ChannelInternal traits directly on `Channel`. This is done via the
  `impl_*x_channel` macros to account for the different channel
  capabilities (rx/tx only or rx+tx)

This PR changes this to:

- `Channel` contains an `Raw: RawChannelAccess<Dir=Rx|Tx>` where `Rx`
  and `Tx` are ZSTs used as markers for a channel configured for a given
  direction.
- low-level operations are implemented on the `Raw` type, depending on
  a bound on RawChannelAccess::Dir
- the `Raw` types can only be constructed safely from the
  `ChannelCreator`, which ensures that only valid combinations of channel
  number and `Dir=Rx|Tx` can exist.
- currently, the only implementation of `RawChannelAccess` is
  `ConstChannelAccess`, which has a `CHANNEL: u8` const generic
  parameter, just as `Channel` did before. Thus, the compiler should be
  able to inline and const-propagate code just as before.

These new types are user-visible. Thus, if code directly names `Channel`
types, it needs to be adapted. If it just uses a method chain such as
`rmt.channelX.configure(...).transmit(...)`, no changes should be
required.

* RMT: rm (Rx|Tx)ChannelCreatorAsync, use mode generic on (Rx|Tx)ChannelCreator

this de-duplicates some code,
and may be useful to implement user code (e.g. setup functions) that is
independent of DriverMode

* RMT: Rewrite pending_interrupt_for_channel using indexed PAC accessors

This deduplicates some code. I've also changed the return type
(usize -> u8) for better consistency, since channel indices are generally
typed as u8.

* RMT: add DynChannelAccess as basis for type-erased channels

Channels can now be `degrade`d to their type-erased variants.

* RMT: Move around some code

The channel definition used to be somewhere in the middle of channel
implementation. There's no change to the code other than its location.

* RMT: slightly more readable subsclicing

* RMT: Move some chip-specific code to a cfg_if! switch

There's no reason for these to reside in separate modules, and this
restructuring meshes well with moving the Rmt definition to a macro as
well, which will be done next.

* RMT: Declare Rmt struct via macro to avoid repetition

Reduces boilerplate at the cost of a somewhat complex macro.

* RMT: Move RmtState

Which was previously in the middle of channel implementation, but
conceptually is more global to the module, thus more natural define
earlier.

* RMT: explicity mark a few private functions in submodule as pub(super)

* RMT: use DynChannelAccess::conjure to simplify async_interrupt_handler

If the compiler decides to unroll the loops, the resulting code should
be essentially the same. Otherwise, it should be more compact. In any
case, from a developer point of view, this is much more concise and
removes one chip-specific case.

* RMT: Use type-erased channels for some HIL tests

* RMT: don't reset clock divider in start_tx

This seems to fix flaky loopback tests where tx/rx pulse code length
differs by 1.

This matches IDF, which also doesn't reset channels on each transmit
operation, but only once on channel creation, and when a sync_manager is
used (which the Rust driver doesn't support, and which would also need
to be handled differently anyway).

* RMT: implement degrade() even if the channel is already type-erased

This makes wrapping channels in custom structs slightly more convenient
since it allows taking any channel and type-erasing it in that structs
constructor.

* RMT: rename (Rx|Tx)ChannelCreator methods to avoid trait disambiguation problems

For devices with channels that support both Rx and Tx, Rust cannot
disambiguate the trait at the call site (because it doesn't look at the
argument types to do so).

Renaming the methods avoids that. The alternative is to use
fully-qualified names to call the trait methods (i.e. left-side
turbofish), or to import the traits only in a limited scope. Both are
much more verbose than the _rx/_tx suffixes to method names.

* RMT: add basic async HIL test

* RMT: remove overcomplicated WithMode trait from tests

according to a suggestion by @bugadani

---------

Co-authored-by: Scott Mabin <scott@mabez.dev>
2025-06-24 12:11:05 +00:00
Björn Quentin
88151e78f9
Fix incorrect usage of MaybeUninit (#3677)
* Fix incorrect usage of MaybeUninit

* CHANGELOG.md

* Run tests in CI

* Address review comments

* Fix wrong path

* Less transmutes

* Don't use link_section on MacOS

* Fix a search+replace gone wrong

* Fix unaligned write buffer, make sure we test all relevant branches

* Fix
2025-06-24 10:54:27 +00:00
Dániel Buga
d7622ff8c3
More gpio macro tweaks (#3669)
* Split up loop

* Generate io_type calls

* Unify various if-pin-implements macros into two generated ones

* Remove unused syntax from the gpio macro
2025-06-24 10:52:28 +00:00