# SPDX-License-Identifier: Apache-2.0

zephyr_library()

zephyr_library_sources(
	thread.c
	thread_entry_wrapper.S
	cpu_idle.S
	fatal.c
	fault.c
	fault_s.S
	irq_manage.c
	timestamp.c
	isr_wrapper.S
	regular_irq.S
	switch.S
	prep_c.c
	reset.S
	vector_table.c
	)

zephyr_library_sources_ifdef(CONFIG_CACHE_FLUSHING cache.c)
zephyr_library_sources_ifdef(CONFIG_ARC_FIRQ fast_irq.S)

zephyr_library_sources_if_kconfig(irq_offload.c)
zephyr_library_sources_ifdef(CONFIG_ATOMIC_OPERATIONS_CUSTOM atomic.c)
add_subdirectory_ifdef(CONFIG_ARC_CORE_MPU mpu)
zephyr_library_sources_ifdef(CONFIG_USERSPACE userspace.S)

# SPDX-License-Identifier: Apache-2.0

zephyr_library()

zephyr_library_sources(
	thread.c
	thread_entry_wrapper.S
	cpu_idle.S
	fatal.c
	fault.c
	fault_s.S
	irq_manage.c
	timestamp.c
	isr_wrapper.S
	regular_irq.S
	switch.S
	prep_c.c
	reset.S
	vector_table.c
	)

zephyr_library_sources_ifdef(CONFIG_CACHE_FLUSHING cache.c)
zephyr_library_sources_ifdef(CONFIG_ARC_FIRQ fast_irq.S)

zephyr_library_sources_if_kconfig(irq_offload.c)
zephyr_library_sources_ifdef(CONFIG_ATOMIC_OPERATIONS_CUSTOM atomic.S)
add_subdirectory_ifdef(CONFIG_ARC_CORE_MPU mpu)
zephyr_library_sources_ifdef(CONFIG_USERSPACE userspace.S)

Fix selection of custom atomic ops
ARC: Fix selection of custom atomic ops

Up until now only ARC EM family has been supported in Zephyr
which don't support atomic operations other than
compare-and-excange, so custom atomic ops with load-locked(LLOCK)/
store-conditional(SCOND) were never used that's how we never
realised CONFIG_ATOMIC_OPERATIONS_CUSTOM points to the wrong file:
"atomic.c" while real implementation is in "atomic.S".

Fix that now.

Signed-off-by: Wayne Ren <d5c6d7c4aa45e53f819f17870783d153a32ba7d0@synopsys.com>
Signed-off-by: Alexey Brodkin <1fa739873496c8c0c1b521f2061ee5fa4a0306e8@synopsys.com>
