esp-rs / esp-idf-template

A "Hello, world!" template of a Rust binary crate for the ESP-IDF framework.
373 stars 44 forks source link

Add an conditional option to add esp-idf-svc/hal #87

Closed Vollbrecht closed 1 year ago

Vollbrecht commented 1 year ago

I think most people want also esp-idf-hal / svc crate when generating an std template. This PR adds the option to generate them only when selecting the std option + gives 3 option [No, default option, all options]

ivmarkov commented 1 year ago

JFYI neither the esp-idf-hal nor the esp-idf-svc crate require or need std. Of course, without std you can't spin a thread, but you can use unsafe freertos apis from esp-idf-sys or who knows - in future we might make the freertos-rust safe bindings working on top of esp idf... but yeah, without std the value of these crates is somewhat lower.

Vollbrecht commented 1 year ago

yeah, though it is true, before this patch, esp-idf-svc was( is) always included in the no_std arm but never in the std arm. Because i never worked with the hal in combination with no_std i opted to build this on top of the std arm and dont touch the other things. So the option to not included it or include all features would not apply to the no_std case right?

ivmarkov commented 1 year ago

esp-idf-svc was included in the no_std arm and not included in the std arm because with std, you can just use println! to say "Hello!" to the user. With no_std, your only other non-complicated option is ::log::info!, bit that guy happens to be implemented in esp-idf-svc hence why you needed the esp-idf-svc dep for no_std... See, not based on what crates the user is likely to need (we were minimalistic here), but what crates you need to send a one liner hello world over uart...