Skip to content

Conversation

jimmyzhe
Copy link
Contributor

@jimmyzhe jimmyzhe commented Oct 1, 2025

This PR is depends on #93697 (the new RISC-V custom CSR Kconfig).

Add support for Andes toolchain which include Andes custom GCC, Clang compilers and other tools. It centralizes Andes-specific compiler, linker flags that previously under zephyr/soc/vendor into zephyr/cmake/toolchain.

Currently support ast-v5_3_3 and later for Linux and MinGW-based Windows toolchains. Cygwin-based Windows toolchains (e.g., ast-v5_3_3-release-windows) are not supported

Pre-build Toolchain: Andes-Development-Kit
Document: Product Documentation -> download Andes Programming Guide for ISA V5. (need to fill some email, name information to download PDF).

After download and extract toolchain, set these environment variables to use Andes toolchain, for example:

 ZEPHYR_TOOLCHAIN_VARIANT=[ande|andes-clang]
 ANDES_TOOLCHAIN_PATH=/path/to/nds32le-elf-mculib-v5

Add support for the Andes GCC/Clang (andes/andes-clang) compiler.
Both inherit the generic GCC/Clang flags with the following adjustments:

Andes GCC:
1. Set RISC-V -march with the Andes suffix (_xandes).
2. Enable Andes-specific machine options (e.g. -mexecit, -mext-dsp).

Andes Clang:
1. Apply the same -march suffix and machine options as Andes GCC.
2. Recognize the prefix 'riscv[32|64]-elf-clang' intead of 'clang'.
3. For Clang < 17, strip unsupported _zicsr/_zifencei from -march.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
Add support for the Andes GCC / Andes Clang toolchains.
Enable by setting:
- ZEPHYR_TOOLCHAIN_VARIANT=[andes|andes-clang]
- ANDES_TOOLCHAIN_PATH=/path/to/nds32le-elf-newlib-v5

Detect Andes toolchain name using matching:
  nds[32|64]le-elf-[newlib|mculib]-[v5|v5e|v5f|v5d]

Where ISA=nds[32|64]le, libc=[newlib|mculib], ISA/ABI=[v5|v5e|v5f|v5d].

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
@jimmyzhe jimmyzhe force-pushed the cmake-toolchain-andes branch from 5628d8b to 3637a0d Compare October 1, 2025 08:37
Add documentation for the Andes toolchain support both GCC and Clang.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
@jimmyzhe jimmyzhe force-pushed the cmake-toolchain-andes branch from 3637a0d to 171d80a Compare October 1, 2025 11:18
Copy link

sonarqubecloud bot commented Oct 1, 2025

@jimmyzhe jimmyzhe marked this pull request as ready for review October 1, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants