2325 Commits

Author SHA1 Message Date
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
Dániel Buga
fbe8ddc954
Move AnalogPin's impl out of the macro (#3668) 2025-06-24 10:51:27 +00:00
Dániel Buga
d8f7ded78c
Run rustfmt as part of the host tests (#3683) 2025-06-24 09:57:32 +00:00
Dániel Buga
077fc22305
Remove paste! from the gpio! macro (#3666)
* Remove paste from the gpio macro

* Remove unnecessary optional from macro
2025-06-23 14:57:04 +00:00
Dániel Buga
1cd3a28954
Move IO_MUX signals to metadata (#3663)
* Generate Input/OutputSignal enums

* Deduplicate alternate function tables

* Don't misuse instance config for pins and signals
2025-06-23 14:43:17 +00:00
Dániel Buga
85877f6731
Minor TWAI cleanup (#3679)
* Deduplicate twai register access

* Clean up
2025-06-23 14:42:37 +00:00
Dániel Buga
e82328c2cf
Ignore zed config (#3681) 2025-06-23 14:17:50 +00:00
Dániel Buga
9507fa38b4
Move smaller GPIO properties to metadata (#3657)
* Move other GPIO properties

* Redo USB pins as pin capability

* Deduplicate interrupt status enum

* Remove unnecessary interrupt enable bits on S2

* Update S2 PAC and remove manual io_mux hackery

* Generate io_mux function from metadata
2025-06-23 12:45:21 +00:00
Dániel Buga
29ac33f2a0
Disallow log and defmt at the same time (#3675) 2025-06-23 12:44:21 +00:00
Gabriel Hansson
b21ae76176
refactor: consolidate esp-riscv-rt symbols into hal-defaults.x (#3671)
* refactor(esp-hal/ld): consolidate riscv startup and interrupt handler symbols to `hal-defaults.x`

* refactor(esp-hal/ld): consolidate riscv `__global_pointer$` to `hal-defaults.x`

* refactor(esp-hal/ld): consolidate riscv `_start_trap` to `hal-defaults.x`

* refactor(esp-hal/ld): consolidate riscv `_mp_hook` to `hal-defaults.x`

* refactor(esp-hal/ld): consolidate riscv `_setup_interrupts` to `hal-defaults.x`

* refactor(esp-hal/ld): consolidate riscv `__post_init` to `hal-defaults.x`

* chore(esp-hal/ld): remove duplicate interrupt0 alias definition in esp32c6.x
2025-06-23 11:08:11 +00:00
Gabriel Hansson
a3ebab6b5b
chore(esp-hal/ld): remove riscv debug.x (#3672) 2025-06-23 10:23:25 +00:00
Dániel Buga
581eec517e
Do not enable static_cell/nightly (#3676) 2025-06-23 09:43:11 +00:00
Scott Mabin
c19f5fd159
Fix docs.rs builds (#3665)
* fix docs.rs builds

* add workflow to check docs-rs builds before release
2025-06-20 08:04:17 +00:00
Dániel Buga
b98631570f
Move GPIO pin properties to metadata (#3656)
* Reorganize esp-metadata

* Move GPIO properties to metadata

* Fix AF enum variants, remove need for paste for them
2025-06-20 07:45:49 +00:00
Björn Quentin
4be232dea4
Docs landing page (#3654)
* Add resources to docs landing page

* Tweak widths

* Fix scrollbar

* Address review comments

* Adjust margin

* Next suggestion
2025-06-19 11:07:46 +00:00
Dániel Buga
9f71e08940
Remove NUM_PINS (#3658)
* Remove the need for NUM_PINS

* Update semver baseline
2025-06-19 11:07:05 +00:00
Juraj Sadel
228d1384c1
fix nightly ci (#3662) 2025-06-19 08:43:50 +00:00
Kirill Mikhailov
6be98e5a00
Adjust links in the monorepo (#3655) 2025-06-18 10:28:37 +00:00
Dániel Buga
75ac7ead62
Delete esp-build (#3645)
* Delete esp-build

* Delete redundant clone
2025-06-18 09:33:16 +00:00
Dániel Buga
772a64a90a
Allow renaming esp-hal (#3653) 2025-06-18 09:29:03 +00:00
Björn Quentin
f5938579a7
Adjust links (#3652) 2025-06-18 07:50:10 +00:00
Dániel Buga
2438d03b21
Simplify generated code to save on build time, yeet a few dependencies (#3643)
* Reduce use of iter::chain

* Cache all symbols

* Trim xtensa-lx-rt deps

* Remove unused dep

* Replace chrono with jiff

* Yeet minijinja

* Save a bit on toml_edit

* Disable some default features

* Disable regex log filters

* Reduce xtensa-lx-rt build script

* Remove unnecessary dependencies

* Remove darling

* Update embedded-test

* lol

* Clean up

* Only validate loaded config once

* fmt

* Changelog
2025-06-17 20:35:00 +00:00
Dániel Buga
150b57f03f
Compare functions by their address (#3650)
* Compare functions by their address

* Remove traits
2025-06-17 16:43:51 +00:00
Dániel Buga
6e74add2a0
Deduplicate ESP32Reset (#3651) 2025-06-17 16:43:39 +00:00
Benedikt
0f343a26e8
RMT: Use MemSize newtype (#3648)
memsize variables sometimes means memory size in blocks, and sometimes
in number of codes. Having a dedicated type helps to make the meaning
obvious and replaces explicit conversion by simple method calls, also
avoiding many integer casts and explicit accesses to the rmt.channel_ram_size
property.

There is no user-visible change, this is only to ease development.
2025-06-17 13:35:45 +00:00
Björn Quentin
b87cd34456
Define configs in YAML files (#3504)
* Define configs in YAML files

* Fix error message string

* Cleanup

* Fix rebase

* Experiment: Value is String

* More i64 -> i128

* More i64 -> i128

* yml -> yaml

* Clippy

* Expect

* Test more

* Explicit `trunc`

* fmt

* Typo

* `is_tooling` -> `ignore_feature_gates`

* Fix

* Briefly explain the config format

* Evaluate conditions in order, first match wins

* Address review

* Move evalexpr I128 support into separate file
2025-06-17 08:13:15 +00:00
Dániel Buga
891a5a4a8c
Move some more peripherals to metadata (#3633)
* Remove gpio bank 1 symbol

* Remove intr status width symbols

* Allow virtual periphs, redo ADC/DAC
2025-06-17 08:10:12 +00:00
Dániel Buga
e05d588f72
Save time on default xtask build (#3647) 2025-06-16 15:02:29 +00:00
Dániel Buga
f71127446b
Remove proc-macros-error2 (#3646) 2025-06-16 15:00:17 +00:00
Dániel Buga
8cf0fc7153
Test -Zstack-protector (#3636)
* Test -Zstack-protector

* Pass config as inline TOML to cargo

* Try to fix failing test
2025-06-16 12:05:21 +00:00
Björn Quentin
57dede24e1
Fix S3-PSRAM mapping with later bootloaders (#3637)
* Fix S3-PSRAM mapping with later bootloaders

* CHANGELOG.md

* Panic if `cache_dbus_mmu_set` fails
2025-06-16 12:00:37 +00:00
Dániel Buga
0579805d12
Add #[enable_doc_switch] (#3630) 2025-06-16 12:00:16 +00:00
Dániel Buga
c29c436be5
Prefix peripheral cfg symbols with chip_has_* (#3628)
* Prefix peri cfg with `soc_has_`

* Clean up ETM
2025-06-16 08:13:28 +00:00
Dániel Buga
3e6b85bf30
Update i2c/spi instance info (#3627)
* Add instances to drivers

* Move AnyI2c

* Move AnySpi and DataMode

* Generate new semver baseline
2025-06-13 13:56:52 +00:00