[RFC] RTEMS Waf Clang support

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Mar 16 12:15:09 UTC 2020


On 16/03/2020 13:09, Hesham Almatary wrote:

> On Mon, 16 Mar 2020 at 11:53, Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
>> On 16/03/2020 12:39, Hesham Almatary wrote:
>>
>>> Hi Sebastian,
>>>
>>> I have pushed a few commits to my repo to support building RTEMS with
>>> Clang/LLVM for RISC-V. Here are the changes [1]. Since I'm still
>>> learning about Waf and the build system, I'd appreciate your input.
>>> Most importantly, I want to know what's the right way to set "target"
>>> and "xlen" variables.
>>>
>>> [1] https://github.com/CTSRD-CHERI/rtems/compare/967b62464bf39602f8b0f2baf57617ad74c3643d...aa73f72b929856efdb41f9f8582263b5395a3276
>> You need a new option, e.g.
>>
>> spec/build/cpukit/RTEMS-BUILD-CPUKIT-OPTXLEN.yml
>>
>> It should be enabled by clang and riscv:
>>
>> enabled-by:
>>     and:
>>     - clang
>>     - riscv
>>
>> The option must be evaluated before the tool settings:
>>
>> order: -1000
>>
> Yes, I thought of that too. But I need to define XLEN to empty or
> something for other architectures too since I use it in
> RTEMS-BUILD-CPUKIT-OPTCLANG:
Does it not default to the empty string if it is not defined?
>
>> - set-value: --target=${ARCH}${XLEN}-unknown-rtems${__RTEMS_MAJOR__}
>> - substitute: null
>> - env-append: ABI_FLAGS
> How should each RISC-V BSP assign XLEN? I thought of a few ways:
> 1) to make each BSP yml file do it, or
> 2) to script it for RISC-V and extract it from the march value,
> 3) to assign it in a single file and, similar to how
> RISC-V-BUILD-BSP-RISC-V-ABI currently works, assign it per variant.

I would do it similar to:

spec/build/bsps/riscv/riscv/RTEMS-BUILD-BSP-RISCV-RISCV-ABI.yml

You can use regular expressions for the matching variant, e.g.

default: ''
default-by-variant:
- value: '32'
   variants:
   - riscv/rv32.*
- value: '64'
   variants:
   - riscv/rv64.*



More information about the devel mailing list