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

   # arm_a_r: consolidate common ARM A/R architecture code
   
   ## Summary
   
   Consolidate common ARM A/R implementations into `arch/arm/src/arm_a_r` so
   ARMv7-A, ARMv7-R, and ARMv8-R share one implementation instead of maintaining
   profile-specific copies.
   
   The series moves common interrupt, abort, syscall, address-environment, 
fault,
   and architecture helper code into `arm_a_r`, removes the superseded copies,
   and updates both Make and CMake integration.
   
   ## Changes
   
   - Move the common `arm_doirq.c` implementation into `arm_a_r`.
   - Move the common data-abort and prefetch-abort implementations into
     `arm_a_r`.
   - Move `arm_dispatch_syscall.S` and `arm_syscall.c` into `arm_a_r`.
   - Move `addrenv.h`, `mmu.h`, and `arm_hwdebug.c` into `arm_a_r`.
   - Move `arm_userfault.c` into `arm_a_r` so ARMv7-A, ARMv7-R, and ARMv8-R use
     the same user-fault termination path.
   - Consolidate the common `arm.h` definitions in `arm_a_r` and remove the
     duplicated profile-specific headers.
   - Remove common SCTLR definitions from the obsolete header locations.
   - Update ARM startup and vector code to use the shared definitions.
   - Add the selected common ARM family directory to the board include path.
   - Update Make and CMake source lists for ARMv7-A, ARMv7-R, and ARMv8-R.
   - Remove an unsupported `SYS_assert_handler` case from the shared syscall
     handler.
   
   ## Rationale
   
   The ARM A/R profiles contain several implementations that differ only because
   they historically lived in separate architecture directories. Maintaining
   these copies independently makes fixes easy to miss and allows the variants 
to
   drift.
   
   The shared layout makes ownership explicit:
   
   ```text
   arch/arm/src/arm_a_r/
   ├── addrenv.h
   ├── arm.h
   ├── arm_dataabort.c
   ├── arm_dispatch_syscall.S
   ├── arm_doirq.c
   ├── arm_hwdebug.c
   ├── arm_prefetchabort.c
   ├── arm_syscall.c
   ├── arm_userfault.c
   ├── mmu.h
   └── sctlr.h
   ```
   
   Profile-specific source remains in `armv7-a`, `armv7-r`, and `armv8-r`.
   
   ## Commits
   
   ```text
   f0fd78a8c2e arm_a_r: merge arm_doirq.c to arm_a_r
   bc68d196c7d arm_a_r: merge arm_dataabort.c to arm_a_r
   a328bd13536 arm_a_r: merge arm_dispatch_syscall.S to arm_a_r
   4784ef0b3db arm_a_r: Move syscall handling to common code
   00f075b3511 arm_a_r: merge arm_prefetchabort.c to arm_a_r
   cbae1a4040a arm: remove common sctlr MACRO in arm.h
   709d6807c4b arm: merge arm.h to arm_a_r
   c05f54b2e17 board: Add the path dependency of amr_a_r/arm_m
   9882dceec5f arm_a_r: Fix common fault and syscall handling
   ```
   
   ## Testing
   
   ### Make: ARMv7-A
   
   Command executed from `nuttx`:
   
   ```text
   $ make distclean
   $ tools/configure.sh -l qemu-armv7a:nsh
   $ make -j$(nproc)
   ```
   
   Result: **PASS**
   
   ```text
   LD: nuttx
   Memory region         Used Size  Region Size  %age Used
                ROM:      382528 B         1 MB     36.48%
                RAM:         28 KB        16 MB      0.17%
   CP: nuttx.bin
   ```
   
   The linker also reported the existing RWX load-segment warning.
   
   ### Make: ARMv7-R
   
   Command executed from `nuttx`:
   
   ```text
   $ make distclean
   $ tools/configure.sh -l qemu-armv7r:nsh
   $ make -j$(nproc)
   ```
   
   Result: **PASS**
   
   ```text
   LD: nuttx
   Memory region         Used Size  Region Size  %age Used
             kflash:      283640 B         1 MB     27.05%
             uflash:          0 GB         0 GB
              ksram:         16 KB        16 MB      0.10%
              usram:          0 GB         0 GB
   CP: nuttx.hex
   CP: nuttx.bin
   ```
   
   The linker also reported the existing RWX load-segment warning.
   
   ### Make: ARMv8-R
   
   Command executed from `nuttx`:
   
   ```text
   $ make distclean
   $ tools/configure.sh -l fvp-armv8r-aarch32:nsh
   $ make -j$(nproc)
   ```
   
   Result: **FAIL** at final link.
   
   ```text
   LD: nuttx
   arm-none-eabi-ld: 
/home/hujun5/work/ssd/online_nuttx/nuttx/staging/libsched.a(irq_initialize.o): 
in function `irq_initialize':
   
/home/hujun5/work/ssd/online_nuttx/nuttx/sched/irq/irq_initialize.c:98:(.text.irq_initialize+0x1c):
 undefined reference to `up_irqinitialize'
   Memory region         Used Size  Region Size  %age Used
              FLASH:      279468 B        64 MB      0.42%
                RAM:       18184 B        64 MB      0.03%
   make[1]: *** [Makefile:248:nuttx] 错误 1
   make: *** [tools/Unix.mk:581:nuttx] 错误 2
   ```
   
   The ARMv8-R sources compiled, but this configuration did not complete the 
final
   link because `up_irqinitialize` was unresolved. This result is recorded as a
   failure; no runtime result is claimed.
   
   ### CMake/Ninja: ARMv7-A
   
   Command executed from `nuttx`:
   
   ```text
   $ cmake -S . -B /tmp/arm-ar-pr-cmake-qemu-armv7a -G Ninja \
       -DBOARD_CONFIG=qemu-armv7a:nsh
   $ cmake --build /tmp/arm-ar-pr-cmake-qemu-armv7a -j$(nproc)
   ```
   
   Result: **PASS**
   
   ```text
   [1334/1336] Generating allsyms_final.c
   [1335/1336] Building C object CMakeFiles/final_nuttx.dir/allsyms_final.c.o
   [1336/1336] Linking CXX executable final_nuttx
   Memory region         Used Size  Region Size  %age Used
                ROM:      386616 B         1 MB     36.87%
                RAM:         28 KB        16 MB      0.17%
   ```
   
   The linker also reported the existing RWX load-segment warning.
   
   ### Patch checks
   
   Commands executed from `nuttx`:
   
   ```text
   $ tools/checkpatch.sh -g HEAD~9..HEAD
   ✔️ All checks pass.
   $ git diff --check
   ```
   
   `git diff --check` produced no output and returned success.
   
   ## Scope not tested
   
   - No simulator boot or hardware runtime test was run.
   - Protected and kernel build variants were not built separately.
   - The ARMv8-R FVP configuration did not reach a successful final link.
   - The complete GitHub Actions ARM build matrix was not reproduced locally.
   


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

  • [PR] arm_a_r: consolidate com... hujun260 (via GitHub) via commits

Reply via email to