1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

25 Commits

Author SHA1 Message Date
Marian Buschsieweke
d59977c563
makefiles/arch/riscv.inc.mk: update RISC-V target triple
The CI now uses `riscv-none-elf` over the previous (and technically
incorrect) `riscv-none-embed`. In addition, we no longer probe for
host toolchains with the incorrect target triple, as the source
providing it has long declared the toolchain with the incorrect
triple as obsolete.
2024-02-12 20:40:30 +01:00
Marian Buschsieweke
287280f882
makefiles/arch/riscv.inc.mk: Always provide TARGET_ARCH_LLVM
This fixes issues with `make compile-commands`, as this by default
generates clangd/LLVM compatible flags. Without `TARGET_ARCH_LLVM`
exported, this will fall back to `TARGET_ARCH`, which is different
for LLVM and GCC.
2023-12-05 11:03:01 +01:00
Marian Buschsieweke
55e223353a
makefiles/arch/riscv.inc.mk: speed up toolchain detection
- Use a sane (a.k.a. simply expanded) variable for the `$(TARGET_ARCH)`
  instead of an insane (a.k.a. recursive expended) variable
    - The toolchain detection will now happen only once, rather than
      each and every time `$(TARGET_ARCH)` is referenced
- Use a single call to `which` rather than one per possible target
  triple

Fixes https://github.com/RIOT-OS/RIOT/issues/19788
2023-07-03 15:56:54 +02:00
Marian Buschsieweke
e0a81fe945
makefiles/arch/riscv.inc.mk: Fix with BUILD_IN_DOCKER
With RISC-V being a relatively young toolchain, a lot of inconsistencies
between different toolchains are to be found that differ in the target
triple and the flags supported. This build system performs run-time
tests to detect the toolchain and supported flags.

With `BUILD_IN_DOCKER=1` issues arise, as this checks are performed
outside of the docker container. However, the host may have no RISC-V
toolchain installed or a different toolchain, so there is little reason
in performing this detection then. Instead, a hard coded target triple
and supported flags are provided when using `BUILD_IN_DOCKER=1`.
2022-09-27 10:43:39 +02:00
chrysn
7ee66ad219 makefiles/cargo: Drop duplicate workaround remnants 2022-07-09 20:45:51 +02:00
Marian Buschsieweke
8c369a8d29
buildsystem: Improve RISC-V compilation handling with newer toolchain
Use -misa-spec=2.2 on newer toolchains, which allows passing the same
-march value to both the linker and the compiler even when binutils and
GCC support difference ISA specs.
2022-05-13 10:54:30 +02:00
Marian Buschsieweke
8eb3692b9d
makefiles/arch/riscv.inc.mk: improve error message
When no toolchain could be detected, provide a friendly message
instead.
2022-04-19 15:51:31 +02:00
Marian Buschsieweke
c89331f93b
build system: Detect more RISC-V target triples
Omitting the middle part of `riscv32-none-elf` is apparently legal and
done by Arch Linux.
2022-04-14 19:25:36 +02:00
Marian Buschsieweke
10f65f1631
build system: Fix compilation for RISC-V with newer GCC
A backward incompatible change in the RISC-V resulting in instructions
previously included by rv32imac to only be available with
rv32imac_zicsr. All RISC-V CPUs supported by RIOT are hence either
considered as rv32imac (from the old ISA spec point of view) or as
rv32imac_zicsr (from the new ISA spec point of view). This adds a
simple test if GCC understands rv32imac_zicsr and uses it then as march,
but uses rv32imac as march if not.
2022-04-14 16:52:48 +02:00
chrysn
a2e1b92e1d makefiles: Define RUST_TARGET for use with Cargo / Rust
For RISC-V and Cortex-M-not-3, triples are known and have worked in some
configuration, but do not work at the moment and stay disabled until the
reference platforms (native, M3) have been established well.
2021-12-14 12:55:13 +01:00
Benjamin Valentin
b4dc8a5366 makefiles: RISC-V: prefer target triple from riotdocker 2021-11-04 10:02:04 +01:00
Martine Lenders
13cc189a8a
Revert "Remove which from shell invocations" 2021-09-03 11:27:03 +02:00
chrysn
6b50033766 makefiles: Replace which with command -v
As the POSIX documentation[1] of `command -v` guarantees that on error
there will be no output (and there will be output in the other cases),
the tests in Makefiles were simplified to test for output equality to
the empty string.

Redirects swallowing error outputs were removed, as the command produces
no error output there (as recommended at [2]).

Existing uses of `command` are simplified as well.

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html
[2]: https://salsa.debian.org/debian/debianutils/-/blob/master/debian/NEWS
2021-09-02 16:30:46 +02:00
56165d22a4
arch/riscv: use natural malign-data type 2021-02-25 12:50:52 +01:00
Sören Tempel
125e4b54c1 fe310: Support the LLVM toolchain (i.e. compilation with clang)
This requires -nostartfiles to be only passed to the linker, not the
compiler, as it is a linker flag and passing it to the compiler causes a
clang warning to be emitted.

Additionally, clang does not seem to support `-mcmodel=medlow` and
`-msmall-data-limit=8` but these options do not seem strictly necessary
to me anyhow thus they are deactivated conditionally when using clang.
2020-10-07 07:37:52 +00:00
2692957c0e
riscv_common: Refactor common fe310 code to riscv_common 2021-02-05 09:32:19 +01:00
Leandro Lanzieri
aaf4a738f9
makefiles/arch/riscv: redirect error message to /dev/null 2020-12-17 15:23:21 +01:00
Marian Buschsieweke
feee507bf9
makefiles/arch/riscv.inc.mk: Detect target triple
This improves the target triple detection logic to include all possible target
triples of compilers that might be able to generate our binaries.
2020-11-06 20:53:28 +01:00
Marian Buschsieweke
d9e495fe83
build system: use riscv-none-elf as triplet
Use riscv-none-elf instead of legacy riscv-none-embed as target triplet for
RISC-V development. However, if ricsv-none-elf is not present, try
riscv64-unknown-elf and riscv-none-embed instead. If the legacy riscv-none-embed
is used, a warning is printed.
2020-09-15 11:18:33 +02:00
Marian Buschsieweke
7c1949341e
build system: Overwrite TARGET_ARCH per arch
Add `TARGET_ARCH_<ARCH>` for each architecture (e.g. `TARGET_ARCH_CORTEX` for
Cortex M) to allow users to overwrite the target triple for a specific arch
from ~/.profile or ~/.bashrc (or the like) without overwriting it for all others
as well.
2020-09-08 22:28:41 +02:00
c7a3219ddb
make: remove useless export of TARGET_ARCH 2020-02-25 09:42:12 +01:00
7c121000ce
make/riscv: remove use of export for LINKFLAGS 2020-01-02 09:51:20 +01:00
1193b0b1f8 cpu/fe310: change default optimization to "-Os"
Also moves the option to CFLAGS_OPT.
2019-10-21 11:27:21 +02:00
Gaëtan Harter
34f69245c3
makefiles: do not locally export compilation variables
These are already exported by `makefiles/vars.inc.mk`.
It is a prerequisite to allow handling compilation without global exports.
2019-08-29 10:35:36 +02:00
kenrabold
7d1d5e77d8 cpu/fe310: add RISC-V cpu FE310
New CPU FE310 from SiFive based on RISC-V architecture

build: add makefile for RISC-V builds

Makefile for builds using RISC-V tools
2018-05-29 15:21:45 -07:00