hujun260 opened a new pull request, #18006: URL: https://github.com/apache/nuttx/pull/18006
## Summary Consolidate stack alignment and kernel stack size macros from private architecture-specific headers to the public include/nuttx/irq.h header. This eliminates duplicate macro definitions across 17 different architecture families and enables generic kernel code to reference these core utilities without requiring architecture-internal header dependencies. ## Changes **Removed duplicate macros from 17 architecture-specific headers:** - Stack alignment macros (`STACK_ALIGN_MASK`, `STACK_ALIGN_DOWN`, `STACK_ALIGN_UP`) - Kernel stack size macro (`ARCH_KERNEL_STACKSIZE`) **Architecture files modified:** - `arch/arm/src/armv7-a/addrenv.h` - `arch/arm/src/common/arm_internal.h` - `arch/arm64/src/common/addrenv.h` - `arch/arm64/src/common/arm64_internal.h` - `arch/avr/src/avr32/avr32.h` - `arch/ceva/src/common/ceva_internal.h` - `arch/hc/src/common/hc_internal.h` - `arch/mips/src/common/mips_internal.h` - `arch/misoc/src/lm32/lm32.h` - `arch/misoc/src/minerva/minerva.h` - `arch/or1k/src/common/or1k_internal.h` - `arch/renesas/src/common/renesas_internal.h` - `arch/risc-v/src/common/riscv_internal.h` - `arch/sim/src/sim/sim_internal.h` - `arch/sparc/src/common/sparc_internal.h` - `arch/tricore/src/common/tricore_internal.h` - `arch/x86/src/common/x86_internal.h` - `arch/x86_64/src/intel64/intel64_initialstate.c` - `arch/xtensa/src/common/xtensa.h` - `arch/z16/src/common/z16_internal.h` - `arch/z80/src/common/z80_internal.h` **Added to public include/nuttx/irq.h:** - Generic stack alignment macro definitions - CONFIG_ARCH_KERNEL_STACK-aware kernel stack size macro ## Benefits & Technical Details **Code Consolidation**: Eliminates 21+ duplicate definitions of identical macros across different architectures, significantly improving maintainability and reducing the likelihood of divergence between architecture implementations. **Improved Code Accessibility**: Makes stack alignment utilities available to generic kernel code without requiring inclusion of architecture-internal headers, reducing coupling between generic and architecture-specific layers. **Consistency**: Ensures all architectures use identical semantics for stack alignment operations, improving code uniformity and predictability. **Cross-Architecture Support**: The consolidated macros work seamlessly across all 17+ supported architecture families: ARM, ARM64, AVR, CEVA, HC, MIPS, MISOC, OR1K, Renesas, RISC-V, SIM, SPARC, TriCore, x86, x86_64, Xtensa, Z16, and Z80. ## Testing - [x] Verified compilation for all supported architectures - [x] Confirmed stack alignment semantics remain unchanged - [x] Tested kernel stack allocation with CONFIG_ARCH_KERNEL_STACK enabled - [x] Validated address environment operations remain functional - [x] Verified macro definitions are accessible from generic kernel code ## Impact - **Architectures affected**: All 17+ supported architectures benefit from consolidated definitions - **API stability**: No external API changes; macros remain functionally identical - **Performance**: No performance impact; macros are purely preprocessor-level definitions - **Compatibility**: Fully backward compatible; existing code using these macros continues to work seamlessly --- **Stats**: 27 files changed, 13 insertions(+), 148 deletions(-) -- 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]
