From 7b294c4ab965378cdfa07448531d75c1cf2b89d5 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Mon, 25 May 2026 14:40:49 +0200 Subject: [PATCH] fix(esp_hw_support): move linux spinlock.h to esp_hw_support/include/linux Moved the linux spinlock.h stub into esp_hw_support/include/linux. esp_hw_support's INCLUDE_DIRS already places include/linux before include, so the correct include files are picked up for the linux target. - Drop the FreeRTOS-Kernel-SMP linux spinlock.h duplicate. - rv_decode_test: use PRIV_REQUIRES esp_hw_support instead of hardcoding component include paths. --- .../rv_decode/main/CMakeLists.txt | 2 +- .../include/linux}/spinlock.h | 0 .../portable/linux/include/spinlock.h | 59 ------------------- 3 files changed, 1 insertion(+), 60 deletions(-) rename components/{freertos/FreeRTOS-Kernel/portable/linux/include => esp_hw_support/include/linux}/spinlock.h (100%) delete mode 100644 components/freertos/FreeRTOS-Kernel-SMP/portable/linux/include/spinlock.h diff --git a/components/esp_gdbstub/test_gdbstub_host/rv_decode/main/CMakeLists.txt b/components/esp_gdbstub/test_gdbstub_host/rv_decode/main/CMakeLists.txt index 3ddae3eb532..a1d645542cd 100644 --- a/components/esp_gdbstub/test_gdbstub_host/rv_decode/main/CMakeLists.txt +++ b/components/esp_gdbstub/test_gdbstub_host/rv_decode/main/CMakeLists.txt @@ -5,10 +5,10 @@ idf_component_register(SRCS "../../../private_include" "../../../include" "../../../src/port/riscv/include" - "../../../../esp_hw_support/include" "../../../../soc/esp32c3/include" "../../../../esp_common/include" "../../../../riscv/include" + PRIV_REQUIRES esp_hw_support WHOLE_ARCHIVE) # Currently 'main' for IDF_TARGET=linux is defined in freertos component. diff --git a/components/freertos/FreeRTOS-Kernel/portable/linux/include/spinlock.h b/components/esp_hw_support/include/linux/spinlock.h similarity index 100% rename from components/freertos/FreeRTOS-Kernel/portable/linux/include/spinlock.h rename to components/esp_hw_support/include/linux/spinlock.h diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/include/spinlock.h b/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/include/spinlock.h deleted file mode 100644 index 99514d5cac0..00000000000 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/include/spinlock.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/* - * This file provides only very simple stubs to build IDF-based FreeRTOSes which use spinlocks on Linux. - */ -#pragma once - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define SPINLOCK_FREE 0xB33FFFFF -#define SPINLOCK_WAIT_FOREVER (-1) -#define SPINLOCK_NO_WAIT 0 -#define SPINLOCK_INITIALIZER {.owner = SPINLOCK_FREE,.count = 0} -#define CORE_ID_REGVAL_XOR_SWAP (0xCDCD ^ 0xABAB) - -/** - * @brief Spinlock object - * Owner: - * - Set to 0 if uninitialized - * - Set to portMUX_FREE_VAL when free - * - Set to CORE_ID_REGVAL_PRO or CORE_ID_REGVAL_AP when locked - * - Any other value indicates corruption - * Count: - * - 0 if unlocked - * - Recursive count if locked - * - * @note The simulator is single-core, hence, it doesn't have a proper spinlock implementation. - * @note Keep portMUX_INITIALIZER_UNLOCKED in sync with this struct - */ -typedef struct { - uint32_t owner; - uint32_t count; -}spinlock_t; - -static inline void __attribute__((always_inline)) spinlock_initialize(spinlock_t *lock) -{ -} - -static inline bool __attribute__((always_inline)) spinlock_acquire(spinlock_t *lock, int32_t timeout) -{ - return true; -} - -static inline void __attribute__((always_inline)) spinlock_release(spinlock_t *lock) -{ -} - -#ifdef __cplusplus -} -#endif