Skip to content

Define atomic macros for C++ project to fix nuttx/spinlock.h compilat… - #19754

Open
teamprof wants to merge 2 commits into
apache:masterfrom
teamprof:master
Open

Define atomic macros for C++ project to fix nuttx/spinlock.h compilat…#19754
teamprof wants to merge 2 commits into
apache:masterfrom
teamprof:master

Conversation

@teamprof

@teamprof teamprof commented Aug 8, 2026

Copy link
Copy Markdown

Issue

Fail to build Pi Pico NuttX C++ project with SMP feature as <nuttx/spinlock.h> is a C header that uses raw macro calls (atomic_cmpxchg_acquire(...)).

Summary

Failed to build a Pi Pico C++ project with SMP enabled due to the missing atomic marcos for nuttx/spinlock.h
Define atomic macros for C++ project to fix nuttx/spinlock.h compilation issue

Impact

Failed to build a Pi Pico (RP2040) C++ project with the SMP feature enabled. Notably, robust SMP support on the RP2040 is a key feature that encourages developers to choose NuttX over other RTOS options.

Testing

Follow the steps on https://github.com/teamprof/arduprof-template/tree/main/pico-nuttx-app to create a C++ project:
git clone --recurse-submodules https://github.com/teamprof/arduprof-template.gif
cd arduprof-template/pico-nuttx-app
ln -s ../src apps/arduprof
cd nuttx
./tools/configure.sh -l ../src/boards/arm/rp2040/raspberrypi-pico/configs/smp
make

Launch a Serial Terminal and connect to Pico's GPIO0/1 at 115200bps
Run "arduprof" under nsh in the terminal

Before
pico-smp-issue

After
pico-smp-fix

minicom screenshot of running on Pi Pico
run-pico-smp

acassis
acassis previously approved these changes Aug 8, 2026
@github-actions github-actions Bot added Area: OS Components OS Components issues Size: M The size of the change in this PR is medium labels Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

arduino-mega2560

  • flash: .text +138 B (+0.2%, 67,622 B / 262,144 B, total: 26% used)

esp32-devkitc

  • ROM: .flash.text -12 B (-0.0%, 124,396 B / 4,194,272 B, total: 3% used)
  • irom0_0_seg: .flash.text -12 B (-0.0%, 88,600 B / 3,342,304 B, total: 3% used)

hifive1-revb

  • flash: .text -56 B (-0.1%, 83,372 B / 4,194,304 B, total: 2% used)
  • sram: .bss +32 B (+0.8%, 3,964 B / 16,384 B, total: 24% used)

mirtoo

  • kseg0_progmem: .text -64 B (-0.1%, 67,476 B / 131,072 B, total: 51% used)

qemu-armv8a

  • Code: .rodata -306 B, .text.nxsched_release_tcb +8 B, .text.nxsig_timedwait +12 B, .text.nxtask_exit +12 B, .text.pthread_start -4 B, .text.uart_writev +28 B, .text.up_initial_state -4 B, .text.user_main -16 B (-0.7%, 316,716 B)
  • Data: .bss.g_idletcb +8 B (+0.0%, 76,977 B)

qemu-intel64

  • Code: .text -1,736 B (-0.0%, 8,657,184 B)
  • Data: .bss +64 B, .rodata -214 B (-0.1%, 120,593 B)

rx65n-rsk2mb

  • ROM: .text +32 B (+0.0%, 87,296 B / 2,097,152 B, total: 4% used)

s698pm-dkit

  • Code: .text +176 B (+0.0%, 363,952 B)

stm32-nucleo-f103rb

  • flash: .text -8 B (-0.0%, 34,016 B / 131,072 B, total: 26% used)

@acassis
acassis requested review from cederom and linguini1 August 9, 2026 16:27
@acassis

acassis commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@xiaoxiang781216 PTAL

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @teamprof :-)

@cederom

cederom commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Also please provide logs in a plaintext form not images..

something
like
this
for
example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: OS Components OS Components issues Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants