ARC: Add support for ARC HS family of CPU cores
The ARC HS is a family of high performance CPUs from Synopsys
capable of running wide range of applications from heavy DPS
calculation to full-scale OS.
Still as with other ARC cores ARC HS might be tailored to
a particular application.
As opposed to EM cores ARC HS cores always have support of unaligned
data access and by default GCC generates such a data layout with
so we have to always enable unaligned data access in runtime otherwise
on attempt to access such data we'd see "Unaligned memory exception".
Note we had to explicitly mention CONFIG_CPU_ARCEM=y in
all current defconfigs as CPU_ARC{EM|HS} are now parts of a
choice so we cannot simply select ether option in board's Kconfig.
And while at it change "-mmpy-option" of ARC EM to "wlh1"
which is the same as previously used "6" but matches
Programmer's Reference Manual (PRM) and is more human-friendly.
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index fc29a65..a22c31e 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -12,17 +12,25 @@
config ARCH
default "arc"
-menu "ARC processor options"
+choice
+ prompt "ARC core family"
+ default CPU_ARCEM
config CPU_ARCEM
- bool
- default y
+ bool "ARC EM cores"
select CPU_ARCV2
select ATOMIC_OPERATIONS_C
help
This option signifies the use of an ARC EM CPU
-endmenu
+config CPU_ARCHS
+ bool "ARC HS cores"
+ select CPU_ARCV2
+ select ATOMIC_OPERATIONS_BUILTIN
+ help
+ This option signifies the use of an ARC HS CPU
+
+endchoice
menu "ARCv2 Family Options"
@@ -119,7 +127,8 @@
config ARC_USE_UNALIGNED_MEM_ACCESS
bool "Enable unaligned access in HW"
default n if CPU_ARCEM
- depends on (CPU_ARCEM && !ARC_HAS_SECURE)
+ default y if CPU_ARCHS
+ depends on (CPU_ARCEM && !ARC_HAS_SECURE) || CPU_ARCHS
help
ARC EM cores w/o secure shield 2+2 mode support might be configured
to support unaligned memory access which is then disabled by default.
diff --git a/boards/arc/em_starterkit/Kconfig.defconfig b/boards/arc/em_starterkit/Kconfig.defconfig
index 332f166..c2e53f4 100644
--- a/boards/arc/em_starterkit/Kconfig.defconfig
+++ b/boards/arc/em_starterkit/Kconfig.defconfig
@@ -5,9 +5,6 @@
config BOARD
default "em_starterkit"
-config CPU_ARCEM
- default y
-
if GPIO
config GPIO_DW
diff --git a/boards/arc/em_starterkit/em_starterkit_defconfig b/boards/arc/em_starterkit/em_starterkit_defconfig
index 09fc757..ceb7616 100644
--- a/boards/arc/em_starterkit/em_starterkit_defconfig
+++ b/boards/arc/em_starterkit/em_starterkit_defconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_ARC=y
+CONFIG_CPU_ARCEM=y
CONFIG_SOC_EMSK=y
CONFIG_SOC_EMSK_EM9D=y
CONFIG_BOARD_EM_STARTERKIT=y
diff --git a/boards/arc/em_starterkit/em_starterkit_em11d_defconfig b/boards/arc/em_starterkit/em_starterkit_em11d_defconfig
index 52c89a9..a4ff67f 100644
--- a/boards/arc/em_starterkit/em_starterkit_em11d_defconfig
+++ b/boards/arc/em_starterkit/em_starterkit_em11d_defconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_ARC=y
+CONFIG_CPU_ARCEM=y
CONFIG_SOC_EMSK=y
CONFIG_SOC_EMSK_EM11D=y
CONFIG_BOARD_EM_STARTERKIT=y
diff --git a/boards/arc/em_starterkit/em_starterkit_em7d_defconfig b/boards/arc/em_starterkit/em_starterkit_em7d_defconfig
index 45731549..316aca2 100644
--- a/boards/arc/em_starterkit/em_starterkit_em7d_defconfig
+++ b/boards/arc/em_starterkit/em_starterkit_em7d_defconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_ARC=y
+CONFIG_CPU_ARCEM=y
CONFIG_SOC_EMSK=y
CONFIG_SOC_EMSK_EM7D=y
CONFIG_BOARD_EM_STARTERKIT=y
diff --git a/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig b/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig
index 2b41c70..546f207 100644
--- a/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig
+++ b/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_ARC=y
+CONFIG_CPU_ARCEM=y
CONFIG_SOC_EMSK=y
CONFIG_SOC_EMSK_EM7D=y
CONFIG_BOARD_EM_STARTERKIT=y
diff --git a/boards/arc/iotdk/Kconfig.defconfig b/boards/arc/iotdk/Kconfig.defconfig
index 1a73936..88b5100 100644
--- a/boards/arc/iotdk/Kconfig.defconfig
+++ b/boards/arc/iotdk/Kconfig.defconfig
@@ -5,7 +5,4 @@
config BOARD
default "iotdk"
-config CPU_ARCEM
- default y
-
endif # BOARD_IOTDK
diff --git a/boards/arc/iotdk/iotdk_defconfig b/boards/arc/iotdk/iotdk_defconfig
index 686b126..63e8dad 100644
--- a/boards/arc/iotdk/iotdk_defconfig
+++ b/boards/arc/iotdk/iotdk_defconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_ARC=y
+CONFIG_CPU_ARCEM=y
CONFIG_SOC_ARC_IOT=y
CONFIG_BOARD_IOTDK=y
CONFIG_XIP=n
diff --git a/cmake/gcc-m-cpu.cmake b/cmake/gcc-m-cpu.cmake
index 9a57282..f2d44b3 100644
--- a/cmake/gcc-m-cpu.cmake
+++ b/cmake/gcc-m-cpu.cmake
@@ -32,5 +32,7 @@
set(GCC_M_CPU em4_dmips)
elseif(CONFIG_CPU_EM4_FPUDA)
set(GCC_M_CPU em4_fpuda)
+ elseif(CONFIG_CPU_ARCHS)
+ set(GCC_M_CPU hs)
endif()
endif()
diff --git a/soc/arc/snps_nsim/CMakeLists.txt b/soc/arc/snps_nsim/CMakeLists.txt
index 0b53364..d010e15 100644
--- a/soc/arc/snps_nsim/CMakeLists.txt
+++ b/soc/arc/snps_nsim/CMakeLists.txt
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
-zephyr_compile_options(-mcpu=${GCC_M_CPU} -mno-sdata -mmpy-option=6)
+zephyr_compile_options(-mcpu=${GCC_M_CPU} -mno-sdata)
+zephyr_compile_options_ifdef(CONFIG_CPU_ARCEM -mmpy-option=wlh1)
+zephyr_compile_options_ifdef(CONFIG_CPU_ARCHS -mmpy-option=plus_qmacw)
zephyr_compile_options_ifdef(CONFIG_FLOAT -mfpu=fpuda_all)
zephyr_sources(