mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-28 07:30:26 +09:00
riscv: add Kconfig entries for the code model
RISC-V has two code models, medium low (medlow) and medium any (medany). Medlow limits addressable memory to a single 2 GiB range between the absolute addresses -2 GiB and +2 GiB. Medany limits addressable memory to any single 2 GiB address range. By default, medlow is selected for U-Boot on both 32-bit and 64-bit systems. The -mcmodel compiler flag is selected according to the Kconfig configuration. Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de> [bmeng: adjust to make medlow the default code model for U-Boot] Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
parent
1f2e948d6d
commit
8176ea4d58
@ -44,6 +44,24 @@ config ARCH_RV64I
|
|||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Code Model"
|
||||||
|
default CMODEL_MEDLOW
|
||||||
|
|
||||||
|
config CMODEL_MEDLOW
|
||||||
|
bool "medium low code model"
|
||||||
|
help
|
||||||
|
U-Boot and its statically defined symbols must lie within a single 2 GiB
|
||||||
|
address range and must lie between absolute addresses -2 GiB and +2 GiB.
|
||||||
|
|
||||||
|
config CMODEL_MEDANY
|
||||||
|
bool "medium any code model"
|
||||||
|
help
|
||||||
|
U-Boot and its statically defined symbols must be within any single 2 GiB
|
||||||
|
address range.
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
config RISCV_ISA_C
|
config RISCV_ISA_C
|
||||||
bool "Emit compressed instructions"
|
bool "Emit compressed instructions"
|
||||||
default y
|
default y
|
||||||
|
@ -17,8 +17,15 @@ endif
|
|||||||
ifeq ($(CONFIG_RISCV_ISA_C),y)
|
ifeq ($(CONFIG_RISCV_ISA_C),y)
|
||||||
ARCH_C = c
|
ARCH_C = c
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(CONFIG_CMODEL_MEDLOW),y)
|
||||||
|
CMODEL = medlow
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_CMODEL_MEDANY),y)
|
||||||
|
CMODEL = medany
|
||||||
|
endif
|
||||||
|
|
||||||
ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI)
|
ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \
|
||||||
|
-mcmodel=$(CMODEL)
|
||||||
|
|
||||||
PLATFORM_CPPFLAGS += $(ARCH_FLAGS)
|
PLATFORM_CPPFLAGS += $(ARCH_FLAGS)
|
||||||
CFLAGS_EFI += $(ARCH_FLAGS)
|
CFLAGS_EFI += $(ARCH_FLAGS)
|
||||||
|
Loading…
Reference in New Issue
Block a user