diff --git a/soc/openisa/rv32m1/CMakeLists.txt b/soc/openisa/rv32m1/CMakeLists.txt index cd65ea9d628..fcfda5f17ed 100644 --- a/soc/openisa/rv32m1/CMakeLists.txt +++ b/soc/openisa/rv32m1/CMakeLists.txt @@ -2,14 +2,10 @@ # # SPDX-License-Identifier: Apache-2.0 -if(CONFIG_SOC_OPENISA_RV32M1_RI5CY) - if (CONFIG_RISCV_GENERIC_TOOLCHAIN) - zephyr_compile_options(-march=rv32imc_zicsr_zifencei) - else() - zephyr_compile_options(-march=rv32imcxpulpv2) - endif() -elseif(CONFIG_SOC_OPENISA_RV32M1_ZERO_RISCY) - zephyr_compile_options(-march=rv32imc_zicsr_zifencei) +# Let's rely on `-march` being generated by the CMake script based on which `CONFIG_RISCV_ISA_EXT_*` +# options are y-selected; provide full arch string with the custom extension otherwise. +if(CONFIG_SOC_OPENISA_RV32M1_RI5CY AND NOT CONFIG_RISCV_GENERIC_TOOLCHAIN) + zephyr_compile_options(-march=rv32imcxpulpv2) endif() zephyr_sources(