mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
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.
This commit is contained in:
parent
ab0e118d10
commit
a2e1b92e1d
@ -80,6 +80,7 @@ config CPU_CORE_CORTEX_M3
|
||||
bool
|
||||
select CPU_ARCH_ARMV7M
|
||||
select CPU_CORE_CORTEX_M
|
||||
select HAS_RUST_TARGET
|
||||
|
||||
config CPU_CORE_CORTEX_M33
|
||||
bool
|
||||
@ -90,12 +91,14 @@ config CPU_CORE_CORTEX_M4
|
||||
bool
|
||||
select CPU_ARCH_ARMV7M
|
||||
select CPU_CORE_CORTEX_M
|
||||
select HAS_RUST_TARGET
|
||||
|
||||
config CPU_CORE_CORTEX_M4F
|
||||
bool
|
||||
select CPU_ARCH_ARMV7M
|
||||
select CPU_CORE_CORTEX_M
|
||||
select HAS_CORTEXM_FPU
|
||||
select HAS_RUST_TARGET
|
||||
|
||||
config CPU_CORE_CORTEX_M7
|
||||
bool
|
||||
|
@ -18,26 +18,38 @@ ifneq (,$(filter $(CPU_CORE),cortex-m4f cortex-m7))
|
||||
endif
|
||||
|
||||
# Set CPU_ARCH depending on the CPU_CORE
|
||||
#
|
||||
# RUST_TARGET is only used when building Rust code; any users need to require
|
||||
# the `rust_target` feature to esnure things are checked properly.
|
||||
ifeq ($(CPU_CORE),cortex-m0)
|
||||
CPU_ARCH := armv6m
|
||||
#RUST_TARGET = thumbv6m-none-eabi
|
||||
else ifeq ($(CPU_CORE),cortex-m0plus)
|
||||
CPU_ARCH := armv6m
|
||||
#RUST_TARGET = thumbv6m-none-eabi
|
||||
else ifeq ($(CPU_CORE),cortex-m23)
|
||||
CPU_ARCH := armv8m
|
||||
else ifeq ($(CPU_CORE),cortex-m3)
|
||||
CPU_ARCH := armv7m
|
||||
RUST_TARGET = thumbv7m-none-eabi
|
||||
else ifeq ($(CPU_CORE),cortex-m33)
|
||||
CPU_ARCH := armv8m
|
||||
else ifeq ($(CPU_CORE),cortex-m4)
|
||||
CPU_ARCH := armv7m
|
||||
RUST_TARGET = thumbv7em-none-eabi
|
||||
else ifeq ($(CPU_CORE),cortex-m4f)
|
||||
CPU_ARCH := armv7m
|
||||
RUST_TARGET = thumbv7em-none-eabihf
|
||||
else ifeq ($(CPU_CORE),cortex-m7)
|
||||
CPU_ARCH := armv7m
|
||||
else
|
||||
$(error Unkwnown cortexm core: $(CPU_CORE))
|
||||
endif
|
||||
|
||||
ifneq (,$(RUST_TARGET))
|
||||
FEATURES_PROVIDED += rust_target
|
||||
endif
|
||||
|
||||
FEATURES_PROVIDED += no_idle_thread
|
||||
|
||||
# This configuration enables modules that are only available when using Kconfig
|
||||
|
@ -62,6 +62,7 @@ config NATIVE_OS_LINUX
|
||||
select HAS_PERIPH_GPIO
|
||||
select HAS_PERIPH_GPIO_IRQ
|
||||
select HAS_PERIPH_SPI
|
||||
select HAS_RUST_TARGET if "$(OS_ARCH)" = "x86_64"
|
||||
|
||||
config NATIVE_OS_FREEBSD
|
||||
bool
|
||||
|
@ -18,6 +18,9 @@ FEATURES_PROVIDED += periph_hwrng
|
||||
FEATURES_PROVIDED += periph_pm
|
||||
FEATURES_PROVIDED += periph_pwm
|
||||
FEATURES_PROVIDED += periph_timer_periodic
|
||||
ifeq ($(OS) $(OS_ARCH),Linux x86_64)
|
||||
FEATURES_PROVIDED += rust_target
|
||||
endif
|
||||
FEATURES_PROVIDED += ssp
|
||||
|
||||
ifeq ($(OS),Linux)
|
||||
|
@ -10,3 +10,8 @@ ifneq (,$(filter periph_can,$(USEMODULE)))
|
||||
endif
|
||||
|
||||
TOOLCHAINS_SUPPORTED = gnu llvm afl
|
||||
|
||||
# Platform triple as used by Rust
|
||||
ifeq ($(OS) $(OS_ARCH),Linux x86_64)
|
||||
RUST_TARGET = i686-unknown-linux-gnu
|
||||
endif
|
||||
|
@ -12,6 +12,7 @@ config CPU_ARCH_RISCV
|
||||
select HAS_NEWLIB
|
||||
select HAS_PERIPH_CORETIMER
|
||||
select HAS_PICOLIBC if '$(RIOT_CI_BUILD)' != '1'
|
||||
#select HAS_RUST_TARGET
|
||||
select HAS_SSP
|
||||
|
||||
select MODULE_MALLOC_THREAD_SAFE if TEST_KCONFIG
|
||||
|
@ -8,6 +8,7 @@ FEATURES_PROVIDED += cpp
|
||||
FEATURES_PROVIDED += libstdcpp
|
||||
FEATURES_PROVIDED += newlib
|
||||
FEATURES_PROVIDED += periph_coretimer
|
||||
#FEATURES_PROVIDED += rust_target
|
||||
FEATURES_PROVIDED += ssp
|
||||
|
||||
# RISC-V toolchain on CI does not work properly with picolibc yet
|
||||
|
@ -42,6 +42,11 @@ config HAS_BACKUP_RAM
|
||||
help
|
||||
Indicates that Backup RAM is supported.
|
||||
|
||||
config HAS_RUST_TARGET
|
||||
bool
|
||||
help
|
||||
Indicates that a Rust target definition ("triple") is known.
|
||||
|
||||
config HAS_CPP
|
||||
bool
|
||||
help
|
||||
|
@ -54,3 +54,8 @@ CFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) $(CFLAGS_LINK)
|
||||
ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG)
|
||||
# export linker flags
|
||||
LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT) -nostartfiles -Wl,--gc-sections -static -lgcc
|
||||
|
||||
# Platform triple as used by Rust
|
||||
RUST_TARGET = riscv32imac-unknown-none-elf
|
||||
# Workaround for https://github.com/rust-lang/rust-bindgen/issues/1555
|
||||
CARGO_EXTRACFLAGS += --target=riscv32
|
||||
|
@ -45,6 +45,7 @@ define board_unsatisfied_features
|
||||
undefine CPU_ARCH
|
||||
undefine CPU_CORE
|
||||
undefine CPU_FAM
|
||||
undefine RUST_TARGET
|
||||
|
||||
include $(RIOTBASE)/Makefile.features
|
||||
# always select provided architecture features
|
||||
|
@ -6,6 +6,7 @@ export QQ # as Q, but be more quiet
|
||||
export QUIET # The parameter to use whether to show verbose makefile commands or not.
|
||||
|
||||
export OS # The operating system of the build host
|
||||
export OS_ARCH # The build host's hardware architecture
|
||||
|
||||
export APPLICATION # The application, set in the Makefile which is run by the user.
|
||||
export APPLICATION_MODULE # The application module name.
|
||||
|
Loading…
Reference in New Issue
Block a user