Skip to content

gnu: Add legacy Zephyr compatibility #989

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

keith-packard
Copy link
Contributor

@keith-packard keith-packard commented Jul 31, 2025

In setup.sh, add option to create symlinks from gnu/ so that paths match previous SDK versions.

In Zephyr-sdkConfig.cmake, set ZEPHYR_TOOLCHAIN_VARIANT to zephyr/gnu only when Zephyr sets ZEPHYR_TOOLCHAIN_VARIANT_COMPILER_SUPPORT before finding the SDK module. This will require a change to Zephyr, which is unfortunate. Ideally, we'd use some existing mechanism to detect when to make this switch.


Fixes #851

In setup.sh, add option to create symlinks from gnu/ so that
paths match previous SDK versions.

In Zephyr-sdkConfig.cmake, set ZEPHYR_TOOLCHAIN_VARIANT to zephyr/gnu
only when Zephyr sets ZEPHYR_TOOLCHAIN_VARIANT_COMPILER_SUPPORT before
finding the SDK module. This will require a change to Zephyr, which is
unfortunate. Ideally, we'd use some existing mechanism to detect when to
make this switch.

Signed-off-by: Keith Packard <[email protected]>
@@ -117,6 +118,8 @@ user_prompt()
# Environment Configurations
ask_yn "Register Zephyr SDK CMake package" && do_cmake_pkg="y"

ask_yn "Old zephyr version compatibility" && do_old_zephyr="y"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ask_yn "Old zephyr version compatibility" && do_old_zephyr="y"
ask_yn "Create symbolic links for old Zephyr compatibility" && do_old_zephyr="y"

@@ -69,6 +69,7 @@ usage()
echo " all Install all GNU toolchains"
echo " -l Install LLVM toolchain"
echo " -h Install host tools"
echo " -o Old zephyr version compatibility"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo " -o Old zephyr version compatibility"
echo " -o Create symbolic links matching the old SDK layout for old Zephyr (<= 4.2) compatibility"

Comment on lines +313 to +314
ln -sr gnu/* . || assert_rc "ERROR: Creating toolchain links" 50
ln -sr cmake/zephyr/gnu/* cmake/zephyr || assert_rc "ERROR: Creating cmake links" 50
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to symlink hosttools/* to . for host tools.

Copy link
Member

@stephanosio stephanosio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, "compatibility" is probably not the best choice of word here since SDK 1.0.0 is not meant to be "compatible" with Zephyr <= 4.2.

Maybe, s/compatibility/bisectability/ ?

Comment on lines -16 to +20
set(ZEPHYR_TOOLCHAIN_VARIANT "zephyr/gnu")
if(DEFINED ZEPHYR_TOOLCHAIN_VARIANT_COMPILER_SUPPORT)
set(ZEPHYR_TOOLCHAIN_VARIANT "zephyr/gnu")
else()
set(ZEPHYR_TOOLCHAIN_VARIANT "zephyr")
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Zephyr-sdkConfig.cmake, set ZEPHYR_TOOLCHAIN_VARIANT to zephyr/gnu only when Zephyr sets ZEPHYR_TOOLCHAIN_VARIANT_COMPILER_SUPPORT before finding the SDK module. This will require a change to Zephyr, which is unfortunate. Ideally, we'd use some existing mechanism to detect when to make this switch.

What about using Zephyr version?

SDK 1.0.0 support will be available from Zephyr 4.3.0 (well, 4.2.99/main at this time), so we can set the default ZEPHYR_TOOLCHAIN_VARIANT=zephyr when Zephyr_VERSION VERSION_LESS 4.2.99

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

Successfully merging this pull request may close these issues.

Installing Zephyr-sdk v0.18.0-alpha2 breaks bisectability.
2 participants