nuttx/libs/libc/machine/CMakeLists.txt
zhangyu117 b25f6f8a86 libc/machine: realize atomic based on hwspinlock
Implement atomic_lock/atomic_unlock using hwspinlock when
CONFIG_LIBC_ATOMIC_HWSPINLOCK is selected, and using up_irq_save/
up_irq_restore when CONFIG_LIBC_ATOMIC_IRQ is selected. Rename
arch_atomic_irq.c to arch_atomic.c.

The 64-bit atomic operations use spinlock (spin_lock_irqsave)
regardless of the selected backend, ensuring multi-core safety.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-08-27 11:13:29 +08:00

33 lines
1.2 KiB
CMake

# ##############################################################################
# libs/libc/machine/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################
add_subdirectory(${CONFIG_ARCH})
if(CONFIG_LIBC_ATOMIC_IRQ OR CONFIG_LIBC_ATOMIC_HWSPINLOCK)
target_sources(c PRIVATE arch_atomic.c)
endif()
target_sources(c PRIVATE arch_atomic64.c)
if(CONFIG_MM_KASAN)
target_sources(c PRIVATE arch_libc.c)
endif()