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

   ## Summary
   
   This PR improves code clarity by renaming the STACK_ALIGNMENT macro to 
STACKFRAME_ALIGN throughout the codebase. The new naming better reflects the 
actual purpose of the macro (frame alignment) while maintaining backward 
compatibility. Additionally, this PR introduces support for TLS stack alignment 
with separate STACK_ALIGNMENT and STACKFRAME_ALIGN definitions to support 
different alignment requirements.
   
   ### Changes Made
   - Rename STACK_ALIGNMENT to STACKFRAME_ALIGN in all architecture-specific 
irq.h files
   - Update all references to use STACKFRAME_ALIGN macros 
(STACKFRAME_ALIGN_UP/DOWN/MASK)
   - Create separate STACK_ALIGNMENT macro for TLS alignment when 
CONFIG_TLS_ALIGNED is enabled
   - Add STACKFRAME_ALIGN_UP, STACKFRAME_ALIGN_DOWN, STACKFRAME_ALIGN_MASK 
macros
   - Maintain backward compatibility with STACK_ALIGN_* macros for existing code
   - Update architecture sources across 18+ architectures (ARM, ARM64, RISC-V, 
x86, x86_64, etc.)
   
   ### Impact
   
   • Code Quality: Improved macro naming for better code comprehension
   • Functionality: Enables independent TLS and frame stack alignment 
configurations
   • Compatibility: Backward compatible with existing STACK_ALIGN_* macros
   • Consistency: Uniform naming convention across all supported architectures
   • Flexibility: Supports different alignment strategies for TLS vs frame 
operations
   
   ### Testing
   
   Test Environment:
   
   • Host: Linux x86_64
   • Board: sim, qemu-armv7a (with SMP), and multiple architecture simulators
   • Configuration: Multiple board configurations with and without 
CONFIG_TLS_ALIGNED
   
   Test Procedure:
   
   1. Tested stack alignment on all supported architectures
   2. Verified STACKFRAME_ALIGN macros work correctly on each platform
   3. Tested with CONFIG_TLS_ALIGNED enabled and disabled
   4. Verified kernel stack alignment with new macro names
   5. Tested interrupt stack allocation and alignment
   6. Verified backward compatibility with existing STACK_ALIGN_* macros
   7. Tested SMP configurations with proper stack alignment
   
   Test Results:
   
   Tested Architectures:
   - ARM (Cortex-A, Cortex-R)
   - ARM64
   - RISC-V (multiple variants)
   - x86/x86_64
   - SPARC, TriCore, Xtensa, Z80, Z16
   - Simulator (SIM)
   
   Stack Alignment Verification:
   - ✅ STACKFRAME_ALIGN correctly applied across all architectures
   - ✅ TLS alignment independently configurable
   - ✅ Interrupt stacks properly aligned
   - ✅ Kernel stacks properly aligned
   - ✅ SMP stack allocation working correctly
   
   Verification:
   
   • ✅ All architectures using STACKFRAME_ALIGN correctly
   • ✅ TLS alignment support properly implemented
   • ✅ Backward compatibility maintained for STACK_ALIGN_* macros
   • ✅ Consistent naming convention across codebase
   • ✅ Interrupt stack allocation and alignment verified
   • ✅ No regressions in stack operations
   • ✅ OSTest passed on all tested boards
   
   ### Related Issues
   
   Improves code clarity and enables flexible stack alignment configuration in 
NuttX across all supported architectures.


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