Skip to content

arch/tricore: drop illd dependence for atomic - #19953

Open
zhangyu-duck wants to merge 2 commits into
apache:masterfrom
zhangyu-duck:tricore-atomic
Open

arch/tricore: drop illd dependence for atomic#19953
zhangyu-duck wants to merge 2 commits into
apache:masterfrom
zhangyu-duck:tricore-atomic

Conversation

@zhangyu-duck

@zhangyu-duck zhangyu-duck commented Aug 24, 2026

Copy link
Copy Markdown

Summary

This PR removes the TriCore atomic implementation's dependency on ILLD intrinsics and switches to the NuttX arch-atomic backend.

Patch 1: arch/tricore: drop illd dependence for atomic

  • Replace ILLD intrinsics (__swap, __ld32, __cmpAndSwap) with inline assembly functions (tricore_atomic_swap, tricore_atomic_cmpswap) in libs/libc/machine/tricore/arch_atomic.c
  • Remove the #include <IfxCpu_Intrinsics.h> dependency
  • Fix the expect parameter type to volatile void * to match the declaration in atomic.h

Patch 2: arch/tricore: use tricore arch-atomic-instruction version

  • Select LIBC_ATOMIC_ARCH for TriCore when not using Tasking toolchain, so that the tricore arch-atomic implementation is used instead of the toolchain builtin

Testing

Tested with TC4 (TC4da) build with GCC toolchain.

Replace ILLD intrinsics (__swap, __ld32, __cmpAndSwap) with inline
assembly functions (tricore_atomic_swap, tricore_atomic_cmpswap) to
remove the dependency on IfxCpu_Intrinsics.h.

Also fix the expect parameter type to use volatile void * to match
the declaration in atomic.h, avoiding type conflicts.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
Select LIBC_ATOMIC_ARCH for TriCore when not using Tasking toolchain,
so that the tricore arch-atomic implementation is used instead of
the toolchain builtin.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
@zhangyu-duck
zhangyu-duck marked this pull request as ready for review August 24, 2026 14:12
@github-actions github-actions Bot added Area: OS Components OS Components issues Size: S The size of the change in this PR is small labels Aug 24, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

arduino-mega2560

  • flash: .text +108 B (+0.2%, 64,394 B / 262,144 B, total: 25% used)

esp32-devkitc

  • ROM: .flash.text +80 B (+0.1%, 124,476 B / 4,194,272 B, total: 3% used)
  • irom0_0_seg: .flash.text +80 B (+0.1%, 88,680 B / 3,342,304 B, total: 3% used)

hifive1-revb

  • flash: .text +68 B (+0.1%, 83,376 B / 4,194,304 B, total: 2% used)

mirtoo

  • kseg0_progmem: .text +132 B (+0.2%, 67,008 B / 131,072 B, total: 51% used)

rx65n-rsk2mb

  • ROM: .text +64 B (+0.1%, 86,496 B / 2,097,152 B, total: 4% used)

s698pm-dkit

  • Code: .text +240 B (+0.1%, 363,648 B)

stm32-nucleo-f103rb

  • flash: .text +76 B (+0.2%, 34,116 B / 131,072 B, total: 26% used)
    No memory changes detected for:
  • qemu-armv8a
  • qemu-intel64

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: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants