Skip to content

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

Open
teamprof wants to merge 1 commit into
apache:masterfrom
teamprof:master
Open

Define atomic macros for C++ project to fix nuttx/spinlock.h compilat…#19754
teamprof wants to merge 1 commit 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

@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

No memory changes detected for:

@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 :-)

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