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

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

commit c4b86b9db6fa510c517eaf0f95cf3932ad09f51d
Author: buxiasen <[email protected]>
AuthorDate: Mon Oct 20 23:37:33 2025 +0800

    bmp: get PERCPU_OFFSET from linkscript
    
    When chip have tcm etc, should use chip specific offset.
    If memory layout is sequential, offset should be percpu size and
    calculate by link script.
    
    Signed-off-by: buxiasen <[email protected]>
---
 include/nuttx/percpu.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/nuttx/percpu.h b/include/nuttx/percpu.h
index 9920a329bca..dcaba008de4 100644
--- a/include/nuttx/percpu.h
+++ b/include/nuttx/percpu.h
@@ -82,13 +82,13 @@
 
 /* Compile time percpu .data & .bss size */
 
-extern char _percpu_size[];
-#  define PERCPU_SIZE                  (size_t)_percpu_size
+extern char _percpu_offset[];
+#  define PERCPU_OFFSET                (size_t)_percpu_offset
 
 /* For BMP case per_cpu_var is not supported */
 
-#  define per_cpu_var_smp(v, c)        (*(FAR typeof(v) *)((unsigned long)&(v) 
+ PERCPU_SIZE * (c)))
-#  define this_cpu_var(v)              (*(FAR typeof(v) *)((unsigned long)&(v) 
+ PERCPU_SIZE * up_cpu_index()))
+#  define per_cpu_var_smp(v, c)        (*(FAR typeof(v) *)((unsigned long)&(v) 
+ PERCPU_OFFSET * (c)))
+#  define this_cpu_var(v)              (*(FAR typeof(v) *)((unsigned long)&(v) 
+ PERCPU_OFFSET * up_cpu_index()))
 #endif
 
 #ifdef CONFIG_SMP

Reply via email to