This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 525fcb4a4572b17316b57aad569bff08066a31fd
Author: liwenxiang1 <[email protected]>
AuthorDate: Mon Apr 14 15:35:14 2025 +0800

    drivers/segger: move g_segger_lock to segger.c
    
    Signed-off-by: liwenxiang1 <[email protected]>
---
 drivers/segger/CMakeLists.txt |  2 ++
 drivers/segger/Make.defs      |  1 +
 drivers/segger/note_sysview.c |  6 ------
 drivers/segger/segger.c       | 37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/drivers/segger/CMakeLists.txt b/drivers/segger/CMakeLists.txt
index 53ff66cffa..cbdc9d31c2 100644
--- a/drivers/segger/CMakeLists.txt
+++ b/drivers/segger/CMakeLists.txt
@@ -48,6 +48,8 @@ endif()
 if(CONFIG_SEGGER_RTT)
   nuttx_add_kernel_library(RTT)
 
+  target_sources(RTT PRIVATE segger.c)
+
   set(RTT_SRCS SystemView/SEGGER/SEGGER_RTT.c)
 
   if(CONFIG_SEGGER_RTT_SECTION)
diff --git a/drivers/segger/Make.defs b/drivers/segger/Make.defs
index 44b0b6ff52..c4ddc05bce 100644
--- a/drivers/segger/Make.defs
+++ b/drivers/segger/Make.defs
@@ -24,6 +24,7 @@ TARGET_ZIP =
 SGDIR      = segger
 
 ifeq ($(CONFIG_SEGGER_RTT),y)
+  CSRCS += segger/segger.c
   CSRCS += segger/SystemView/SEGGER/SEGGER_RTT.c
 
   CFLAGS += -Wno-shadow -Wno-pointer-to-int-cast
diff --git a/drivers/segger/note_sysview.c b/drivers/segger/note_sysview.c
index 7872287822..17424c4bd5 100644
--- a/drivers/segger/note_sysview.c
+++ b/drivers/segger/note_sysview.c
@@ -158,12 +158,6 @@ static struct note_sysview_driver_s g_note_sysview_driver =
   }
 };
 
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-spinlock_t g_segger_lock = SP_UNLOCKED;
-
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
diff --git a/drivers/segger/segger.c b/drivers/segger/segger.c
new file mode 100644
index 0000000000..24c9c124b9
--- /dev/null
+++ b/drivers/segger/segger.c
@@ -0,0 +1,37 @@
+/****************************************************************************
+ * drivers/segger/segger.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/sched.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+spinlock_t g_segger_lock = SP_UNLOCKED;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/

Reply via email to