mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00
platform/qemu/virt: Dynamically calculate xlen
The QEMU virt machine can be either 32 or 66 bit. Don't hard code the CPU bit length and instead let the compiler determine it. Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:

committed by
Anup Patel

parent
b4c72deba9
commit
5a91fec1a8
3
Makefile
3
Makefile
@@ -116,6 +116,9 @@ endif
|
|||||||
AS = $(CC)
|
AS = $(CC)
|
||||||
DTC = dtc
|
DTC = dtc
|
||||||
|
|
||||||
|
# Guess the compillers xlen
|
||||||
|
OPENSBI_CC_XLEN = `expr substr \`$(CC) -dumpmachine\` 6 2`
|
||||||
|
|
||||||
# Setup compilation commands flags
|
# Setup compilation commands flags
|
||||||
CFLAGS = -g -Wall -Werror -nostdlib -fno-strict-aliasing -O2
|
CFLAGS = -g -Wall -Werror -nostdlib -fno-strict-aliasing -O2
|
||||||
CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
||||||
|
@@ -9,8 +9,17 @@
|
|||||||
|
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
platform-cppflags-y =
|
platform-cppflags-y =
|
||||||
platform-cflags-y =-mabi=lp64 -march=rv64imafdc -mcmodel=medany
|
# If we know the compillers xlen use it below
|
||||||
platform-asflags-y =-mabi=lp64 -march=rv64imafdc -mcmodel=medany
|
ifeq ($(OPENSBI_CC_XLEN), 32)
|
||||||
|
platform-cflags-y =-mabi=ilp$(OPENSBI_CC_XLEN) -march=rv$(OPENSBI_CC_XLEN)imafdc
|
||||||
|
platform-asflags-y =-mabi=ilp$(OPENSBI_CC_XLEN) -march=rv$(OPENSBI_CC_XLEN)imafdc
|
||||||
|
endif
|
||||||
|
ifeq ($(OPENSBI_CC_XLEN), 64)
|
||||||
|
platform-cflags-y =-mabi=lp$(OPENSBI_CC_XLEN) -march=rv$(OPENSBI_CC_XLEN)imafdc
|
||||||
|
platform-asflags-y =-mabi=lp$(OPENSBI_CC_XLEN) -march=rv$(OPENSBI_CC_XLEN)imafdc
|
||||||
|
endif
|
||||||
|
platform-cflags-y += -mcmodel=medany
|
||||||
|
platform-asflags-y += -mcmodel=medany
|
||||||
platform-ldflags-y =
|
platform-ldflags-y =
|
||||||
|
|
||||||
# Common drivers to enable
|
# Common drivers to enable
|
||||||
|
@@ -12,6 +12,8 @@ platform-cppflags-y =
|
|||||||
# -mabi=lp64 -march=rv64imafdc -mcmodel=medany
|
# -mabi=lp64 -march=rv64imafdc -mcmodel=medany
|
||||||
# For a 32 bits platform, this will likely be:
|
# For a 32 bits platform, this will likely be:
|
||||||
# -mabi=lp32 -march=rv32imafdc -mcmodel=medlow
|
# -mabi=lp32 -march=rv32imafdc -mcmodel=medlow
|
||||||
|
# You can also use the Makefile variable OPENSBI_CC_XLEN for the xlen
|
||||||
|
# See the QEMU virt machine for an example of this
|
||||||
platform-cflags-y = -mabi=lp64 -march=rv64imafdc -mcmodel=medany
|
platform-cflags-y = -mabi=lp64 -march=rv64imafdc -mcmodel=medany
|
||||||
platform-asflags-y = -mabi=lp64 -march=rv64imafdc -mcmodel=medany
|
platform-asflags-y = -mabi=lp64 -march=rv64imafdc -mcmodel=medany
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user