hujun260 opened a new pull request, #22151:
URL: https://github.com/apache/nuttx/pull/22151
# arm_m: consolidate IRQ and barrier headers
## Summary
Merge the duplicated ARMv6-M, ARMv7-M, and ARMv8-M IRQ and memory-barrier
headers into the common `arch/arm/include/arm_m` directory.
The common headers retain the architectural differences between ARMv6-M and
the later M profiles while removing three separately maintained copies.
## Changes
- Move the ARMv7-M IRQ definitions to `arch/arm/include/arm_m/irq.h`.
- Remove the superseded ARMv6-M and ARMv8-M IRQ headers.
- Select the common IRQ header for ARMv6-M, ARMv7-M, and ARMv8-M from
`arch/arm/include/irq.h`.
- Keep ARMv6-M interrupt masking based on `PRIMASK`, because ARMv6-M does not
provide `BASEPRI`.
- Keep ARMv7-M and ARMv8-M interrupt masking based on `BASEPRI`.
- Move the ARM-M barrier definitions to
`arch/arm/include/arm_m/barriers.h`.
- Remove the superseded ARMv7-M and ARMv8-M barrier headers.
- Select the common barrier header for all three ARM-M profiles from
`arch/arm/include/barriers.h`.
- Use the operand-less `dmb`/`dsb` forms for ARMv6-M.
- Keep the `ish`, `ishst`, and `sy` barrier variants for ARMv7-M and ARMv8-M.
## Rationale
The three ARM-M profiles used separate IRQ and barrier headers with
substantial
duplication. Maintaining common logic in three locations makes fixes harder
to
apply consistently.
The common headers preserve the required profile-specific behavior with
configuration guards:
```text
ARMv6-M -> PRIMASK and operand-less barriers
ARMv7-M -> BASEPRI and dmb ish/dmb ishst/dsb sy
ARMv8-M -> BASEPRI and dmb ish/dmb ishst/dsb sy
```
## Commits
```text
5e851417be716a1842eea4a4913e85afd495b099 arm_m: merge irq.h into arm_m
baeddce51ff5bc06f6055be3bb37e10bab3ed121 arm_m: merge barrier into arm_m
```
## Testing
All builds were performed from a clean `nuttx` tree with the GNU Arm Embedded
toolchain available in `PATH`.
### ARMv6-M Make build
Command:
```text
$ make distclean
$ tools/configure.sh -l stm32f051-discovery:nsh
$ make -j$(nproc)
```
Result: **PASS**
```text
LD: nuttx
Memory region Used Size Region Size %age Used
flash: 34640 B 64 KB 52.86%
sram: 1704 B 8 KB 20.80%
CP: nuttx.bin
```
### ARMv7-M Make build
Command:
```text
$ make distclean
$ tools/configure.sh -l stm32f4discovery:nsh
$ make -j$(nproc)
```
Result: **PASS**
```text
LD: nuttx
Memory region Used Size Region Size %age Used
flash: 96852 B 1 MB 9.24%
sram: 5840 B 112 KB 5.09%
CP: nuttx.hex
CP: nuttx.bin
```
The build also emitted the existing STM32 default flash-configuration
warning:
```text
common/stm32/stm32_flash_m3m4_f2f4.c:53:4: warning: #warning "Default Flash
Configuration Used - See Override Flash Size Designator" [-Wcpp]
```
### ARMv8-M Make build
Command:
```text
$ make distclean
$ tools/configure.sh -l mps2-an521:nsh
$ make -j$(nproc)
```
Result: **PASS**
```text
LD: nuttx
Memory region Used Size Region Size %age Used
flash: 348216 B 4 MB 8.30%
sram1: 11952 B 4 MB 0.28%
CP: nuttx.hex
CP: nuttx.bin
```
### Patch checks
Commands:
```text
$ tools/checkpatch.sh -g HEAD~2..HEAD
✔️ All checks pass.
$ git diff --check HEAD~2..HEAD
```
`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.
- CMake/Ninja builds were not run.
- 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]