Skip to content
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

Target-specific autogen? Espressif in particular. #5883

Closed
gojimmypi opened this issue Dec 13, 2022 · 5 comments
Closed

Target-specific autogen? Espressif in particular. #5883

gojimmypi opened this issue Dec 13, 2022 · 5 comments
Assignees

Comments

@gojimmypi
Copy link
Contributor

Version

Latest master branch

Description

Current State

Currently there are several different mechanisms to use wolfSSL in the Espressif ESP-IDF. The most common is to have wolfSSL installed to the components directory of either the local project or the ESP-IDF directory.

One can run setup, which is certainly a reliable mechanism to copy only the required files, using typically just 10% of the entire repo size. The problem is that the installed library is then "disconnected" from GitHub.

I encountered a problem recently where my work was lost when making changes to wolfSSL in my current project (the components directory), the re-running setup which over-wrote the component contents. With no source control, there's an obvious difficulty in both detecting changes as well as refreshing to recent code.

Alternative Install

I also created a install_wolfssl.cmd that uses Git to fetch files with fetch --depth 1 and sparse checkout. Although it has some merits such as being common to Windows, Mac and Linux, I've not created a PR with it as it is still a multi-step install.

I'd like to simply have the install be a git clone and autogen then voila, it's working.

Proposed State

I'd like to update the wolfSSL autogen.sh to detect the ESP-IDF environment and add a few extra steps to turn a fresh clone of wolfSSL from the respective ./components directory into an operational Espressif component.

I'm considering adding something like this to the end of autogen.sh:

if [ -e "../../components/wolfssl/README.md" ]; then
    if [ "$IDF_PATH" == "" ]; then
        echo "It looks like autogen.sh is running from an Espressif component"
        echo "directory. However, the IDF_PATH is not set. If you would like"
        echo "to configure wolfSSL as an Espressif component, run the export."
    else
        echo "Found Espressif IDF_PATH=$IDF_PATH"
        echo "setup component makefiles here..."
    fi
else
    echo "Not an Espressif component"
fi

Any thoughts on this modification? The line starting at "setup component makefiles here" would be code to add CMake files and such to make the wolfSSL clone look and work like an Espressif component.

I'm looking for feedback before I actually implement this since there's nothing like it in the current autogen.

cc: @dgarske @kaleb-himes @JacobBarthelmeh

@douzzer
Copy link
Contributor

douzzer commented Jan 19, 2023

This sounds generally reasonable. Though echo "Not an Espressif component" doesn't sound like the right idea -- autogen.sh shouldn't emit distracting noise.

Also, the test -e "../../components/wolfssl/README.md" looks fidgity -- is there a more decisive test you could substitute for that, preferably with a path that has "espressif" in it, or something similarly obvious and specific?

@douzzer
Copy link
Contributor

douzzer commented Jan 19, 2023

Oh and another thought occurs to me -- it would be better to put any Espressif-specific logic in a separate file that's conditionally called by autogen.sh. I.e. the only Espressif-specific logic in autogen.sh would be the headline test for an Espressif target directory. And indeed, you could test for existence of that script as the test for targeting an Espressif tree.

For comparison, a while back I added some wolfSentry-specific logic in wolfssl/test.h and it's been a pain point ever since. If your Espressif work is in a separate repo, then the setup script for it can be in that repo, and you can just call that script from wolfssl/autogen.sh. Don't repeat my mistake :-)

@gojimmypi
Copy link
Contributor Author

Provided #6018 is merged, I think I'll abandon this idea of modification of the autogen.sh for an install.

The "it just works with no install" with a specially-crafted Cmakefiles.txt is by far more preferable.

@dgarske dgarske removed their assignment Jan 30, 2023
@gojimmypi
Copy link
Contributor Author

The intention of this PR was to minimize installation fuss for Espressif examples. Now that #6018 has been merged, there's no reason to clutter autogen.sh with installation setups.

The Espressif ESP-IDF examples now work immediately after a git clone https://github.com/wolfSSL/wolfssl.git command with no setup needed.

Note that other examples, such as wolfssl-examples/ESP32 and wolfssh-examples/Espressif will still need to have the components installed until updated with the latest components/wolfssl/CMakeLists.txt local project component files.

I'll leave this opened as a reminder.

@gojimmypi
Copy link
Contributor Author

I'm closing this issue as now obsolete and irrelevant.

Instead, I've created a local project CMakeLists.txt added in #6018 that allows for Espressif ESP-IDF projects to just work without any install or setup. See also #6118 that will allow for project-specific user_settings.h.

See examples:

Sneak peek: upcoming CMakeLists.txt

I've added wolfSSL/wolfssl-examples#385 and wolfSSL/wolfssh#514 as reminders to update those examples.

See #6234 for a roadmap of Espressif updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants