zhangyu-duck opened a new pull request, #21660:
URL: https://github.com/apache/nuttx/pull/21660

   ## Summary
   
   Extend the common atomic interfaces and add TriCore support with fallbacks 
for missing operation widths.
   
   - Add pointer-sized atomic operations and a release/acquire compare-exchange 
variant.
   - Add inline atomic support for the generic IRQ path and TriCore, including 
memory-order barriers.
   - Add inline `__sync_*` support through the common definition macro.
   - Add weak spinlock fallbacks for atomic widths not provided by the 
architecture.
   
   ## Impact
   
   This affects the common atomic interfaces, the generic IRQ atomic 
implementation, and TriCore atomic support. Other architectures retain 
toolchain-provided operations where available and use the weak fallback only 
for operations that still require an external implementation.
   
   ## Testing
   
   Builds passed on the current HEAD:
   
   - `triboard_tc4x9_com:nsh`: pass, no compiler warnings.
   - `qemu-armv7a:nsh`: pass, no compiler warnings.
   - `rv-virt:nsh` (RV32): pass; the linker retains its existing LOAD segment 
RWX permission warning.
   
   A temporary hello test called `__atomic_fetch_add()` for 1/2/4/8-byte 
values. Final ELF disassembly, symbols, and linker maps verified which 
implementation was selected for each width:
   
   - **TriCore TC4:** the toolchain emitted external calls for all four widths. 
The final link selected the TriCore arch implementation for 4 bytes and the 
spinlock fallback for 1/2/8 bytes.
   - **ARM Cortex-A7:** the toolchain inlined all four widths using the 
corresponding exclusive-load/store instructions. No spinlock fallback was 
selected for these calls.
   - **RISC-V RV32:** the toolchain inlined 1/2-byte operations with 
`lr.w/sc.w` and 4-byte operations with `amoadd.w.aq`. Only the 8-byte operation 
used the spinlock fallback.
   
   Temporarily disabling the spinlock implementation produced the expected 
RISC-V link error:
   
   ```text
   undefined reference to `__atomic_fetch_add_8'
   ```
   
   Restoring the fallback made the link pass again. These were build, 
disassembly, and link-selection checks; no board or QEMU runtime atomic test 
was performed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to