-
Notifications
You must be signed in to change notification settings - Fork 194
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 wrapper for SD/SDIO/SDMMC driver and vFS #422
Conversation
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.
Thanks for the PR!
Am I heading in the right direction ?
You did a great start we surly will get there!
For the SDMMC support we need to introduce some gated compilation. To my understanding, currently - SDMMC host hardware is only present in esp32 / esp32s3. Other devices such as a esp32c6 uses the SDIO api. The esp-idf docu is a bit confusing on this point. For a first hind you can look at the failed CI runs, that complain that for the specific risc targets the API is not there.
We could feature gate by esp variants directly or use some of the down handed information from esp-idf like SOC_SDMMC_HOST_SUPPORTED flag.
If you first only want to work on the sdmmc part is fine, but it would be extra nice if you could use the sdspi_host api as a fallback for targets that does not support sdmmc. Edit: you already provide both apis ❤️ so its just a matter of gating the sdmmc variant correctly. In concrete i talk about this sdmmc api vs this sdspi api
In either case we would gate the sdmmc api in sd module part you created, so we dont brake targets that dosn't have it.
can you have a look at the |
Well, I'm having trouble finding documentation on how the cfg flags of target capabilities are defined. It seems they are exported from ESP IDF |
What is going on with the CI ? There's an issue with ldproxy installation. |
wired unrelated install error / i restarted the workflow |
The correct one should be something like Regarding the other CI error with respect to "use alloc::ffi::CString;" : We also use alloc flags for stuff that uses heap allocation - this is done so that the hal can technically build on no_std. Its mostly used as a dev helper to mark things explicitly for us where heap allocs occure on our site. You would also need gates here. |
Has the binding between rust's |
@AlixANNERAUD Not yet. Sorry for being slow with my feedback. Will return some more today. |
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.
Sorry for the delay! Holidays over here. :)
src/sd/host.rs
Outdated
all(esp_idf_version_major = "5", esp_idf_version_minor = "0"), | ||
all(esp_idf_version_major = "5", esp_idf_version_minor = "1"), | ||
)))] // For ESP-IDF v5.2 and later | ||
pub enum DelayPhase { |
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.
1 - Create a submodule pub mod config
and move DelayPhase
in there
2 - #[derive(Debug, Default, Copy, Clone, Eq, PartialEq)]
and pick which item in the enum should be the default, if there is a meaningful default. Otherwise do not derive Debug
3 - as isize
? Why?
4 - If you look at other drivers, we often implement e.g. From<sdmmc_delay_phase_t>
for DelayPhase
.
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.
- Ok but why deriving
Default
? It doesn't makes sense here ? - Since Rust enums appear to be encoded as
isize
whilesdmmc_delay_phase_t
is ac_uint
, casting becomes necessary.
@AlixANNERAUD I'll merge this shortly, but might do a round of final renames/changes post commit - hope you don't mind. For one, this code is not |
1 similar comment
@AlixANNERAUD I'll merge this shortly, but might do a round of final renames/changes post commit - hope you don't mind. For one, this code is not |
Thank you very much for your help, it's really kind of you to have taken the time to assist me. I've added the missing |
Thanks for pushing the PR through! |
my tf card init faild on esp32-s3 use this example . |
Hi,
According to issue #420 .
Am I heading in the right direction ?