Open-CMSIS-Pack / devtools

Open-CMSIS-Pack development tools - C++
Apache License 2.0
69 stars 50 forks source link

[cbuild setup] list selectable compiler for a solution without specified `compiler:` node based on cdefault and registered toolchains #1576

Closed jkrech closed 1 week ago

jkrech commented 2 weeks ago

Describe The Problem To Be Solved Provide a list of selectable compiler (versions) for a toolchain agnostic CMSIS solution in *.cbuild-idx.yml based on "compilers listed in cdefault" and the compiler versions registered via environment variables.

Suggest A Solution

Extend cbuild setup command to deliver available toolchains for a project in the cbuild-idx.yml file when no toolchain is selected. The node is [select-toolchains:]([https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/YML-CBuild-Format.md#select-toolchains]](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/YML-CBuild-Format.md#select-toolchains%5D).

Refer to cbuild setup command for details.

Possible Implications

no longer use (or allow) compiler: selection in cdefault.yml for toolchain agnostic projects.

Related proposal: https://github.com/Open-CMSIS-Pack/devtools/issues/1507

ReinhardKeil commented 2 weeks ago

Process is slightly changed, see: https://github.com/ReinhardKeil/cmsis-toolbox/blob/main/docs/YML-Input-Format.md#select-compiler

jkrech commented 2 weeks ago

@ReinhardKeil can you please clarify that the select-compiler can only be used in cdefault.yml and csolution.yml files or is my understanding wrong?

brondani commented 1 week ago

Implemented in csolution in https://github.com/Open-CMSIS-Pack/devtools/pull/1581.

jkrech commented 1 week ago

using csolution nightly 2024-06-24: *.csolution.yml:

...
  select-compiler:
    - compiler: AC6
    - compiler: GCC
    - compiler: CLANG
    - compiler: IAR
 ...

Registered Toolchains are

>cbuild list toolchains
AC6@6.22.0
CLANG@18.1.3
GCC@13.2.1

running command:

cbuild Hello.csolution.yml 
error csolution: processing context 'Hello.Debug+AVH' failed
error csolution: processing context 'Hello.Release+AVH' failed
error csolution: compiler undefined, use '--toolchain' option or add 'compiler: <value>' to yml input, selectable values can be found in cbuild-idx.yml
error cbuild: exit status 1

cbuild-idx.yml:

  ...
  select-compiler:
    - compiler: AC6@6.22.0
    - compiler: GCC@13.2.1
    - compiler: CLANG@18.1.3
  ...