hujun260 opened a new pull request, #22489:
URL: https://github.com/apache/nuttx/pull/22489
# arm_m: Consolidate ARM-M Architecture Implementations
## Summary
Consolidate common ARM-M implementations from the ARMv6-M, ARMv7-M, and
ARMv8-M source directories into `arch/arm/src/arm_m`. This reduces duplicated
code and keeps the Make and CMake build paths consistent across ARM-M profiles.
## Changes
- Merge the ARM-M CPU information implementation into
`arch/arm/src/arm_m/arm_cpuinfo.c`.
- Merge the common IRQ handling implementation into
`arch/arm/src/arm_m/arm_doirq.c`.
- Move the ARMv8-M SAU and secure IRQ implementations into
`arch/arm/src/arm_m`.
- Add the shared ARM-M dispatch syscall assembly implementation and update
the ARM-A/R source selection.
- Update ARMv6-M, ARMv7-M, and ARMv8-M `Make.defs` and `CMakeLists.txt`
files to select shared implementations exactly once.
- Remove the now-duplicated profile-specific copies.
- Preserve ARMv6-M, ARMv7-M, and ARMv8-M conditional behavior while
centralizing maintenance of common code.
## Rationale
The same ARM-M functionality was distributed across multiple
architecture-profile directories. This made fixes harder to maintain and
allowed the Make and CMake source lists to diverge. The consolidation gives
shared implementations a single owner while retaining profile-specific build
selections where required.
## Scope
This change is limited to source ownership and build-system integration. It
does not intentionally change the public API or runtime behavior of the ARM-M
exception, CPU information, SAU, secure IRQ, or syscall-dispatch paths.
## Commits
```text
8d29aba407b arch/arm: add arm unwind EHABI asm declare to make
sched_backtrace find
55d5cf7abc7 arch/arm/arm-m: merge armv6/7/8-m into arm_m
2022f9fe59d arch/arm-m: fix when rtcb->sigdeliver inprogress savedregs
overlap.
64e427ab095 arch/arm_m: merge arm_cpuinfo.c
5b32deb77e1 arch/arm_m: move arm_sau.c arm_secure_irq.c to arm_m
```
## Testing
### Patch whitespace check
Command:
```text
$ git diff --check HEAD~5..HEAD
```
Result:
```text
diff_check_rc=0
```
Result: **PASS**.
### Checkpatch
Command:
```text
$ ./tools/checkpatch.sh -c -u -m -g HEAD~5..HEAD
```
Output:
```text
Used config files:
1: .codespellrc
✔️ All checks pass.
```
Result: **PASS**.
### ARM build
The existing ARM build configuration was rebuilt with:
```text
$ make -j20
```
Output:
```text
Create version.h
LD: nuttx
Memory region Used Size Region Size %age Used
oscram: 0 GB 240 KB 0.00%
ddr3: 389984 B 1016 MB 0.04%
CP: nuttx.hex
CP: nuttx.bin
```
Result: **PASS**. The build completed and generated `nuttx`, `nuttx.hex`,
and `nuttx.bin`.
## Change Statistics
The `HEAD~5..HEAD` range changes 18 files:
- 63 insertions
- 640 deletions
- 18 files changed
The resulting net reduction is primarily due to removing duplicated ARMv6-M,
ARMv7-M, and ARMv8-M implementations after moving the common code into
`arch/arm/src/arm_m`.
## Follow-up Testing
The following checks are recommended before merging if they are not covered
by CI:
- Clean Make builds for representative ARMv6-M, ARMv7-M, and ARMv8-M boards.
- CMake/Ninja builds for the same architecture profiles.
- Runtime NSH boot and exception/signal handling tests.
- Protected, SMP, FPU, TrustZone, and other profile-specific configurations.
- The complete ARM CI matrix.
--
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]