zyfeier opened a new pull request, #21630:
URL: https://github.com/apache/nuttx/pull/21630

   ## Summary
   
     * Why: SCHED_NOTE_IP is implemented with GNU-specific language extensions
       (statement expressions, local labels and label-as-value), which not all
       compilers support - the TASKING toolchain, for example, cannot use it.
     * What: add an arch-provided up_getpc() inline that returns the current
       program counter, and use it in the sched_note.h wrappers instead of
       SCHED_NOTE_IP, so the instrumentation notes no longer depend on the
       GNU extension.
     * How: up_getpc() is added to the irq.h of every architecture (register
       read, a small asm sequence, or a call-and-pop trampoline; TriCore reads
       the PC core special function register, with the new TRICORE_CPU_PC
       csfr.h entry), and include/nuttx/arch.h documents the interface. The
       >14-arguments dispatch of sched_note_nprintf() is kept unchanged. The
       Z16 port uses ZDS II assembly (z16f_up_getpc.S) instead of inline asm,
       matching its toolchain. Note: the CEVA and Z16 implementations follow
       the in-tree assembly conventions but could not be compile-tested here
       (no public toolchain); the AVR, HCS12, M16C and LM32 variants were
       cross-checked against QEMU/binutils/GCC sources and in-tree assembly.
   
   ## Impact
   
     * Is new feature added? Is existing feature changed? YES - new up_getpc()
       arch interface; sched_note instrumentation becomes compiler-portable.
     * Impact on user (will user need to adapt to change)? NO
     * Impact on build (will build process change)? NO
     * Impact on hardware (will arch(s) / board(s) / driver(s) change)? NO -
       only header-level additions per arch (plus one Z16 assembly source).
     * Impact on documentation (is update required / provided)? NO
     * Impact on security (any sort of implications)? NO
     * Impact on compatibility (backward/forward/interoperability)? NO
   
   ## Testing
   
     I confirm that changes are verified on local setup and works as intended:
     * Build Host(s): Linux x86_64, tricore-elf-gcc 11.3.1 / TASKING SmartCode
       cctc v10.4, CMake 3.28.3 + Ninja
     * Target(s): triboard_tc4x9_com:nsh with CONFIG_SCHED_INSTRUMENTATION=y
       built with BOTH the GNU and the TASKING toolchain (this exercises the
       sched_note_* macro expansion with up_getpc()); plain
       triboard_tc4x9_com:nsh and a2g-tc397-5v-tft:nsh GNU builds.
   
     Testing logs (triboard_tc4x9_com:nsh + CONFIG_SCHED_INSTRUMENTATION=y,
     GNU make):
   
     ```
     LD: nuttx
     ```
   
     Testing logs (triboard_tc4x9_com:nsh + CONFIG_SCHED_INSTRUMENTATION=y,
     TASKING CMake/Ninja):
   
     ```
     ltc I402: activating file producing phase
     ltc I433: emitting object files (task1)
     ltc I434: emitting report files (task1)
     ```
   


-- 
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