Shanks0224 opened a new pull request, #22603: URL: https://github.com/apache/nuttx/pull/22603
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary Four small fixes in the common Xtensa code: - **up_getpc()**: Xtensa has no special register for the PC, so `rsr %0, PC` does not assemble (`invalid register 'PC' for 'rsr' instruction`). up_getpc() is used by the sched_note printf/event macros, so every configuration that uses them fails to build. Load the address of a local label instead. - **up_enable_dcache()**: the "already enabled" check tested MEMCTL.InvEn, which only selects whether ways are invalidated when they are added. up_enable_icache() sets the same bit, so enabling the I-Cache first made up_enable_dcache() return without enabling the D-Cache. Check the D-Cache ways in use/allocatable fields instead. - **xtensa_intclear()**: arch/irq.h does not include `<assert.h>`, so its DEBUGASSERT() only builds when the including file already pulled `<assert.h>` in. No other architecture asserts in its public irq.h and an out-of-range number matches no branch, so drop the assertion. - **Kernel/double exception vectors**: with the debug option they ran `break 1, 0` / `break 1, 4` before the panic handler. Without a debugger, xtensa_debug_handler() reports an unhandled debug cause and returns to the same break, so the system loops there and never prints the crash dump. Go straight to the panic path. (#21986 makes the debug handler skip BREAK instructions; this change is still needed so that a crash reports immediately instead of first going through the debug exception.) ## Impact Xtensa only. The exception frame layout and the normal interrupt path are unchanged. Configurations that use sched_note printf or event macros now build. Cores that enable the I-Cache before the D-Cache now really enable the D-Cache. ## Testing Built with the Espressif toolchain used by CI (xtensa-esp-elf 14.2.0): - esp32-devkitc:nsh, esp32-devkitc:smp, esp32s2-saola-1:nsh, esp32s3-devkit:nsh, esp32s3-devkit:smp: build, no warnings. - esp32-devkitc:nsh + `CONFIG_SCHED_INSTRUMENTATION_DUMP=y CONFIG_DRIVERS_NOTE=y CONFIG_DRIVERS_NOTERAM=y CONFIG_EXAMPLES_NOTEPRINTF=y`: master: ``` include/arch/irq.h:295: Error: invalid register 'PC' for 'rsr' instruction ``` this PR: builds. ostest on the Espressif QEMU (esp-develop-9.0.0-20240606), esp32-devkitc:nsh + `CONFIG_ESP32_QEMU_IMAGE=y`: `ostest_main: Exiting with status 0` on master and with this PR. (`strto_test()` was skipped on both: on ESP32 `strtol()`/`strtoul()` come from the ROM newlib, which does not set the NuttX errno, so it asserts on master independently of this change.) Not tested on real hardware. -- 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]
