diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 253c3531ce2..d10ef773d9c 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -40,6 +40,7 @@ config CPU_ARCEM4 bool default y select CPU_ARCV2 + select ATOMIC_OPERATIONS_C help This option signifies the use of an ARC EM4 CPU @@ -273,19 +274,6 @@ config ARCH_HAS_NANO_FIBER_ABORT # omit prompt to signify a "hidden" option default n -config ARC_ATOMIC_ASM - bool - default n - depends on !CPU_ARCEM4 - help - Say y if the processor supports atomic assembly instructions: - LLOCK and SCOND. - - Say n if not sure. - - Note that these instructions are not supported on ARC EM family - processors. - endmenu diff --git a/arch/arc/core/Makefile b/arch/arc/core/Makefile index 87d795b9f21..a0ba3823fbc 100644 --- a/arch/arc/core/Makefile +++ b/arch/arc/core/Makefile @@ -15,10 +15,8 @@ obj-y += prep_c.o \ obj-$(CONFIG_IRQ_OFFLOAD) += irq_offload.o obj-$(CONFIG_ERRNO) += errno.o -ifeq ($(CONFIG_ARC_ATOMIC_ASM),y) +ifneq ($(CONFIG_ATOMIC_OPERATIONS_C),y) obj-y += atomic.o -else -obj-y += atomic_native.o endif obj-$(CONFIG_IRQ_VECTOR_TABLE_BSP) += irq_vector_table.o diff --git a/kernel/nanokernel/Kconfig b/kernel/nanokernel/Kconfig index 5d7aa07aab9..4e7c4d45c4c 100644 --- a/kernel/nanokernel/Kconfig +++ b/kernel/nanokernel/Kconfig @@ -106,4 +106,13 @@ config ERRNO include errno.h provided by the C library (libc) to use the errno symbol. The C library must access the per-thread errno via the _get_errno() symbol. +config ATOMIC_OPERATIONS_C + bool + default n + help + Use atomic operations routines that are implemented entirely + in C by locking interrupts. Selected by architectures which either + do not have support for atomic operations in their instruction + set, or haven't been implemented yet during bring-up. + endmenu diff --git a/kernel/nanokernel/Makefile b/kernel/nanokernel/Makefile index 944a770e033..9369fde11a3 100644 --- a/kernel/nanokernel/Makefile +++ b/kernel/nanokernel/Makefile @@ -17,3 +17,4 @@ obj-$(CONFIG_NANO_TIMERS) += nano_timer.o obj-$(CONFIG_KERNEL_EVENT_LOGGER) += event_logger.o obj-$(CONFIG_KERNEL_EVENT_LOGGER) += kernel_event_logger.o obj-$(CONFIG_RING_BUFFER) += ring_buffer.o +obj-$(CONFIG_ATOMIC_OPERATIONS_C) += atomic_c.o diff --git a/arch/arc/core/atomic_native.c b/kernel/nanokernel/atomic_c.c similarity index 98% rename from arch/arc/core/atomic_native.c rename to kernel/nanokernel/atomic_c.c index 2730d7d7f6c..1a1076dceda 100644 --- a/arch/arc/core/atomic_native.c +++ b/kernel/nanokernel/atomic_c.c @@ -16,9 +16,9 @@ */ /** - * @file Atomic ops for ARC EM + * @file Atomic ops in pure C * - * This module provides the atomic operators for ARC EM family processors + * This module provides the atomic operators for processors * which do not support native atomic operations. * * The atomic operations are guaranteed to be atomic with respect @@ -30,7 +30,7 @@ #include #include -#include +#include /** *