-
Notifications
You must be signed in to change notification settings - Fork 124
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
Support using ESP-IDF from the IDF_PATH variable #41
Comments
Working on that. |
Instead of checking for tooling on the path, I would suggest adding a new feature, let's say "system", to the existing "pio" and "native" features. If the "system" feature is species, the the installation should be skipped. If the tools are found on the path, then they can be used. If the tools are not present, however, I think it would be better fail immediately. I know that I often forget to activate the IDF environment before running a build. It would be undesirable and unexpected in that case to try to install a new version of the SDK and tools. |
Introducing another feature is not such a great idea for a variety of reasons. However if you really really want to configure it so that external tooling is always expected and never installed automatically, you can set |
What is the I understand that adding new features if not necessary is undesirable. However, it feels like the crate is a bit overloaded and is taking on two separate tasks: 1) generating bindings for the SDK, 2) installing and configuring the IDF tools. These two goals seem to be orthogonal to each other. Maybe if instead of adding a new feature, the My main, concern, however, was to add esp-idf-sys as a dependency on a CMake project and that seems to already be a supported use case with a little extra CMake configuration. |
Another use case for not installing the toolchain automatically is to allow projects to be built from within a Docker image that has all of the tools already installed as part of the base image. It would be undesirable and probably counterproductive to attempt to download and install another version of the toolchain. In this case it's probably the responsibility of the container to ensure that everything is properly installed and configured, but I wonder if there is anything else the crate could do to help prevent mistakes. |
Sorry, I really meant
It is also 3) building the EDP-IDF and 4) Generating linker flags for the Rust linking process of the binary crate. Now, I'm all for "single responsibility", "good architecture" and so on CS blah blah (please don't take offense!), but it is not that we have not tried to separate these tasks as much as reasonable. Please study the code (including embuild) and if you have concrete suggestions how to further split/modularize these otherwise closely inter-related tasks, I would gladly return feedback.
I hear you and I feel from purely CS point of view that might be the best option. Yet, we also have to think for whom we are optimizing the user experience. If I do what you are suggesting, then average Joe Embedded Hobbyist coming with only initial (if any) Rust experience and zero embedded programming knowledge (let alone ESP-IDF!) will have to type
Indeed. Now - to resonate a bit with your feelings that this crate is doing too many things including "5) support cmake-first bindings-only build", we can try to unify a bit the env variables the crate expects when called from a cmake-first build with those used for cargo-first build. I can't promise 100% unification, but I can give it a shot once I'm back. |
This use case would of course be supported by this PR. As for preventing mistakes, putting a And then again, aren't we optimizing the user experience of a niche use case and worsening the user experience of the main use case, where the user would just download Rust and Clang (if it is not already installed by the distro) and then let the crate do its job by downloading and doing whatever necessary automatically? |
Okay, that sounds great. We are currently exploring whether we should use a cargo-first approach, a CMake-first approach, or some other build architecture. It sounds like the
I see. There's a lot of extra work that a cargo-first build needs to do that a CMake-first build doesn't. Hopefully having these steps won't introduce too much build time overhead if we don't need them, since keeping build times as short as possible would be very valuable.
That's a good point, but I think you could still optimize the experience the first user experience by setting the default features (such as having Anyway, I think this is pretty low priority once there's an easy way of configuring the crate to use an already installed ESP-IDF environment.
Thanks. I think supporting the CMake-first use case will add a significant amount of value to this crate and anything that can help unify the two approaches will only help. |
That's a great idea. I think it's likely that we will want the actual directory to be configurable, but we could do something like setting What would the behavior be if an invalid path is set? Hopefully it would error out and not fallback to trying to download and install the tools. |
If the user has defined an
IDF_PATH
environment variable, thenative
build should use the ESP-IDF framework designated by that environment variable, rather than cloning and using a separate ESP-IDF GIT repo.More details:
install.sh
-ed andexport.sh
-ed:idf.py
is on$PATH
), thenative
builder should not install any additional tooling, setup Python virtual env and so on. It should assume, that the necessary tooling is already on the path (scope of Support for starting build in activated ESP-IDF environment #36 actually, which turns out to be a sub-task of this one)$PATH
, the installer should try to install it, based on the ESP-IDF instance pointed to by theIDF_PATH
variable, and then proceed with setting up a virtual Python environment specifically for the build and so on.The text was updated successfully, but these errors were encountered: