-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the ESP32-C6 #392
Conversation
FYI I tried looking at the direct boot errors but didn't actually run into any? Do you know how to reproduce? We should also make sure we apply the fix from #386 to the direct boot linker scripts too |
I can at least reproduce linker errors for the |
02c1756
to
4e09213
Compare
@MabezDev I think there's something funny going on with my dev environment, let me try again. |
bckup initial clocks_ii
C6: update
bckup initial clocks_ii
I tried all the examples we have for ESP32-C6 (only boot-loader mode). Not too bad but seems there are a few issues (some with the examples themselves and some with the driver, mostly clock related) These are my results adc.rs 🆗 |
Building on top of @bjoernQ's testing, with my latest commits here is the current status of testing:
✅ = working as expected I will update this table as I continue to test. Hopefully these remaining examples aren't too difficult to crack. I've tested most of the examples using
I've fixed the UART clocks, so we should be good to go there.
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little bit late, sorry! I found a few things I think we should address before merging :)
Self { | ||
phantom: PhantomData::default(), | ||
} | ||
} | ||
|
||
#[cfg(esp32c6)] | ||
fn enable_clock() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be using our already established PeripheralClockControl
struct instead of this one off function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are missing some peripherals for that PeripheralClockControl enable thing. For example, sha
, adc
, usb-serial-jtag
don't take a mutable reference to PeripheralClockControl - we can address all of them in a separate PR.
That's exactly how the example works - it just reads the state of the button after the delay. So while it is not a good example of how to write real-world code it works as expected then. |
Seems I found the problem with Update: it's here jessebraham#5 |
I fixed the DMA issues in direct-boot mode here: jessebraham#7 |
* 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
I think at this point all examples are functioning as expected, both using the This PR is still far from perfect, but I think the remaining problems are isolated enough that we can create issues for them and address them individually; I'm not sure how much more we stand to gain by nitpicking this PR. @bjoernQ and @MabezDev, let me know how you're feeling about the state of this PR, please. @JurajSadel, @bjoernQ, and @MabezDev, thanks for all the work on this over the last couple months! It's been quite the learning experience for us and hopefully this will be easier in the future as a result. |
I agree this is okay to get merged and the remaining issues should be addressed after the merge |
I think this is in a good enough spot for merging! The few odd bits can be solved later :). |
* 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 (esp-rs#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 (esp-rs#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 (esp-rs#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 <[email protected]> Co-authored-by: Jesse Braham <[email protected]> * 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 (esp-rs#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 <[email protected]> Co-authored-by: Juraj Sadel <[email protected]> Co-authored-by: Juraj Sadel <[email protected]> Co-authored-by: Scott Mabin <[email protected]>
* 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 (esp-rs#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 (esp-rs#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 <[email protected]> Co-authored-by: Jesse Braham <[email protected]> * 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 (esp-rs#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 <[email protected]> Co-authored-by: Juraj Sadel <[email protected]> Co-authored-by: Juraj Sadel <[email protected]> Co-authored-by: Scott Mabin <[email protected]>
This is still a work in progress, however we're nearing completion so I think it's ready enough to start getting some eyes on it.
Unfortunately there were some hiccups with the git history, so things are a bit messy there; I've tried to fix things as much as possible but there are still some oddities.
At this point I have tested all examples, and all are functional except for the following:
clock_monitor
i2s_sound
twai
The
twai
example is failing in the same way as the ESP32 and ESP32-S2, so we can likely hold off on completing this until #341 is resolved.Theesp_hal_common::rtc_cntl
andesp_hal_common::rtc_cntl::rtc
modules are still being worked on by @JurajSadel and will hopefully be completed soon; this will allow us to complete theclock_monitor
example.In addition to the above, I seem to be experiencing linker errors when trying to build any of theembassy_*
,pcnt_encoder
, orram
examples when using thedirect-boot
feature; they build fine without it. Not sure what's going on here.Thank you to all who have contributed to this work, looking forward to getting it merged :)
Closes #219
TODO
esp32c6
package and remove the git dependencyesp-println
andesp-backtrace
esp-backtrace
is adev-dependency
so we don't need to block on it; I've opened a PR adding C6 support here: Add support for the ESP32-C6 esp-backtrace#26clock_monitor
andexamples workingi2s_sound
clock_monitor
example will be fixed in a separate PR