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

   ## Summary
   
   Move the `STACK_ALIGNMENT` macro definition from architecture-specific 
internal headers (e.g., `arm_internal.h`, `arm64_internal.h`) to the public 
architecture IRQ headers (`irq.h`). This change enables common code to access 
the STACK_ALIGNMENT constant without including internal headers, improving code 
modularity and reducing header file dependencies while maintaining backward 
compatibility through existing includes.
   
   ## Changes
   
   The STACK_ALIGNMENT macro is moved from `*_internal.h` to `include/irq.h` 
for each architecture:
   
   - **ARM**: Move STACK_ALIGNMENT (8 bytes) from arm_internal.h to irq.h
   - **ARM64**: Move STACK_ALIGNMENT (16 bytes) from arm64_internal.h to irq.h  
   - **AVR**: Move STACK_ALIGNMENT (4 bytes) from avr32.h to avr/include/irq.h
   - **HC**: Move STACK_ALIGNMENT (2 bytes) from hc_internal.h to 
hc/include/irq.h
   - **MIPS**: Move conditional STACK_ALIGNMENT (4/8 bytes) from 
mips_internal.h to mips/include/irq.h
   - **OpenRISC (or1k)**: Move STACK_ALIGNMENT (4 bytes) from or1k_internal.h 
to or1k/include/irq.h
   - **Renesas**: Move STACK_ALIGNMENT (4 bytes) from renesas_internal.h to 
renesas/include/irq.h
   - **RISC-V**: Move STACK_ALIGNMENT (4 bytes) from riscv_internal.h to 
risc-v/include/irq.h
   - **SIM**: Move STACK_ALIGNMENT (8 bytes) from sim_internal.h to 
sim/include/irq.h
   - **SPARC**: Move STACK_ALIGNMENT (8 bytes) from sparc_internal.h to 
sparc/include/irq.h
   - **TriCore**: Move STACK_ALIGNMENT (8 bytes) from tricore_internal.h to 
tricore/include/irq.h
   - **x86**: Move STACK_ALIGNMENT (4 or 8 bytes) from x86_internal.h to 
x86/include/irq.h
   - **x86_64**: Move STACK_ALIGNMENT (8 bytes) from x86_64_internal.h to 
x86_64/include/irq.h
   - **Xtensa**: Move STACK_ALIGNMENT (16 bytes) from xtensa.h to 
xtensa/include/irq.h
   - **Z16**: Move STACK_ALIGNMENT (4 bytes) from z16_internal.h to 
z16/include/irq.h
   - **Z80**: Move conditional STACK_ALIGNMENT (4/8 bytes) from z80_internal.h 
to z80/include/irq.h
   
   ## Benefits & Technical Details
   
   - **Accessibility**: Common code can now access STACK_ALIGNMENT from public 
irq.h header without including private internal headers
   - **Code organization**: Architecture-specific constants properly placed in 
public interface rather than internal implementation headers
   - **Reduced dependencies**: Eliminates need for common code to depend on 
architecture-internal headers
   - **Consistency**: Ensures all architectures follow same pattern for 
exposing STACK_ALIGNMENT
   - **Backward compatibility**: No change in functionality; existing includes 
of internal headers still work as before
   
   ## Testing
   
   - Verified STACK_ALIGNMENT values are correct for each architecture on both 
32-bit and 64-bit platforms
   - Confirmed conditional compilation (e.g., CONFIG_LIBC_FLOATINGPOINT) works 
correctly after move
   - Tested that common code can now access STACK_ALIGNMENT directly from irq.h
   - Verified no build regressions across all supported architectures
   - Validated stack alignment calculations still work correctly in memory 
allocation code
   
   ## Impact
   
   - **Scope**: All 16 NuttX architecture families (35 affected files total)
   - **Compatibility**: Fully backward compatible - no API changes, existing 
code paths unchanged
   - **Build**: No performance impact, this is a purely organizational change
   - **Integration**: Enables future common code to leverage STACK_ALIGNMENT 
for better stack management


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