On Sun, Oct 17, 2021 at 12:30 PM Tomasz CEDRO wrote:
> On Sun, Oct 17, 2021 at 1:06 AM Abdelatif Guettouche wrote:
> > The CROSSDEV variable will just have the name of the toolchain.  If we want
> > to add another toolchain we add another ifeq in
> > riscv/rv32im/Toolchains.defs.
>
> Thank you :-) I can see there are many variants of the RV. That would
> imply changing many files. Can we put that in some sort top level
> Toolchains.defs and then include that in machine variants
> configuration?
>
> Will try that and provide patches / pr :-)

I have found 1.5 solution :-)

One quick solution is to simply pass `CROSSDEV` to make: `make
-DCROSSDEV=riscv32-esp-elf-`.

Another half of the solution is to put autodetection mechanism like
this in `riscv/rv32im/Toolchains.defs`:

RVTOOLCHAINS := \
  riscv32-esp-elf-\
  riscv32-unknown-elf-\
  riscv64-none-elf-\
  riscv64-unknown-elf-

RVTOOLCHAINS_AVAILABLE := $(foreach rvtoolchain, $(RVTOOLCHAINS),\
  $(if $(shell which $(rvtoolchain)gcc), $(rvtoolchain) ) )

CROSSDEV ?= $(word 1,${RVTOOLCHAINS_AVAILABLE})
$(info "USING CROSSDEV: ${CROSSDEV}")

But this is not the acceptable solution as this Makefile is called
over and over during build, each time autodetecting available
toolchains slowing down the build process.

Where could we put that autodetection so its called only once?
`tools/configure.sh`?

Also it would be nice if that variable could be set / changed with
`make menuconfig`, so probably stored in `.config` ?

Work in progress :-)

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

Reply via email to