Skip to content

Commit

Permalink
ARC: build: allow users to specify -mcpu
Browse files Browse the repository at this point in the history
kernel build system used to add -mcpu for each ARC ISA as default.
These days there are versions and varaints of ARC HS cores some of which
have specific -mcpu options to fine tune / optimize generated code.

So allow users/external build systems to specify their own -mcpu

This will be used in future patches for HSDK-4xD board support which
uses specific -mcpu to utilize dual issue scheduling of the core.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
[abrodkin/vgupta: rewrote changelog]
  • Loading branch information
Eugeniy Paltsev authored and Vineet Gupta committed Jun 16, 2020
1 parent 97d0b5d commit 0bdd6e7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
9 changes: 9 additions & 0 deletions arch/arc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ config ARC_CPU_HS

endchoice

config ARC_TUNE_MCPU
string "Override default -mcpu compiler flag"
default ""
help
Override default -mcpu=xxx compiler flag (which is set depending on
the ISA version) with the specified value.
NOTE: If specified flag isn't supported by current compiler the
ISA default value will be used as a fallback.

config CPU_BIG_ENDIAN
bool "Enable Big Endian Mode"
help
Expand Down
21 changes: 19 additions & 2 deletions arch/arc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,25 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-)
endif

cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38

tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mA7
tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38

ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
cflags-y += $(tune-mcpu-def-y)
else
tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU))
tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu))
ifeq ($(tune-mcpu-ok),y)
cflags-y += $(tune-mcpu)
else
# The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
# (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option.
$(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)')
cflags-y += $(tune-mcpu-def-y)
endif
endif


ifdef CONFIG_ARC_CURR_IN_REG
# For a global register defintion, make sure it gets passed to every file
Expand Down

0 comments on commit 0bdd6e7

Please sign in to comment.