Skip to content

Commit

Permalink
Use aarch64-unknown-none target when enable fp_simd
Browse files Browse the repository at this point in the history
  • Loading branch information
equation314 committed May 11, 2024
1 parent 4e41da5 commit 8e7daf6
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, clippy, rustfmt
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none-softfloat
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat
- name: Check rust version
run: rustc --version --verbose
- name: Clippy for the default target
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, llvm-tools
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none-softfloat
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- name: Build helloworld
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, llvm-tools
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none-softfloat
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- uses: ./.github/workflows/actions/setup-musl
Expand Down
21 changes: 17 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ else
APP_TYPE := c
endif

# Architecture, platform and target
# Architecture and platform
ifneq ($(filter $(MAKECMDGOALS),unittest unittest_no_fail_fast),)
PLATFORM_NAME :=
else ifneq ($(PLATFORM),)
Expand Down Expand Up @@ -97,20 +97,33 @@ ifeq ($(ARCH), x86_64)
# Don't enable kvm for WSL/WSL2.
ACCEL ?= $(if $(findstring -microsoft, $(shell uname -r | tr '[:upper:]' '[:lower:]')),n,y)
PLATFORM_NAME ?= x86_64-qemu-q35
TARGET := x86_64-unknown-none
BUS := pci
else ifeq ($(ARCH), riscv64)
ACCEL ?= n
PLATFORM_NAME ?= riscv64-qemu-virt
TARGET := riscv64gc-unknown-none-elf
else ifeq ($(ARCH), aarch64)
ACCEL ?= n
PLATFORM_NAME ?= aarch64-qemu-virt
TARGET := aarch64-unknown-none-softfloat
else
$(error "ARCH" must be one of "x86_64", "riscv64", or "aarch64")
endif

# Feature parsing
include scripts/make/features.mk

# Target
ifeq ($(ARCH), x86_64)
TARGET := x86_64-unknown-none
else ifeq ($(ARCH), riscv64)
TARGET := riscv64gc-unknown-none-elf
else ifeq ($(ARCH), aarch64)
ifeq ($(findstring fp_simd,$(FEATURES)),)
TARGET := aarch64-unknown-none-softfloat
else
TARGET := aarch64-unknown-none
endif
endif

export AX_ARCH=$(ARCH)
export AX_PLATFORM=$(PLATFORM_NAME)
export AX_SMP=$(SMP)
Expand Down
2 changes: 1 addition & 1 deletion modules/axhal/src/platform/aarch64_common/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ unsafe extern "C" fn _start() -> ! {
mov sp, x8
bl {switch_to_el1} // switch to EL1
bl {enable_fp} // enable fp/neon
bl {init_boot_page_table}
bl {init_mmu} // setup MMU
bl {enable_fp} // enable fp/neon
mov x8, {phys_virt_offset} // set SP to the high address
add sp, sp, x8
Expand Down
4 changes: 2 additions & 2 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
profile = "minimal"
channel = "nightly-2024-01-19"
components = ["rust-src", "llvm-tools-preview", "rustfmt", "clippy"]
targets = ["x86_64-unknown-none", "riscv64gc-unknown-none-elf", "aarch64-unknown-none-softfloat"]
components = ["rust-src", "llvm-tools", "rustfmt", "clippy"]
targets = ["x86_64-unknown-none", "riscv64gc-unknown-none-elf", "aarch64-unknown-none", "aarch64-unknown-none-softfloat"]
1 change: 0 additions & 1 deletion scripts/make/build.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Main building script

include scripts/make/cargo.mk
include scripts/make/features.mk

ifeq ($(APP_TYPE), c)
include scripts/make/build_c.mk
Expand Down
2 changes: 1 addition & 1 deletion scripts/make/build_c.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ifeq ($(findstring fp_simd,$(FEATURES)),)
CFLAGS += -mgeneral-regs-only
endif
else
ifeq ($(ARCH), riscv64)
ifneq ($(filter $(ARCH),riscv64 aarch64),)
# for compiler-rt fallbacks like `__divtf3`, `__multf3`, ...
libgcc := $(shell $(CC) -print-libgcc-file-name)
endif
Expand Down

0 comments on commit 8e7daf6

Please sign in to comment.