hujun260 opened a new pull request, #21748:
URL: https://github.com/apache/nuttx/pull/21748
# NuttX PR Description
## Title
arm64: optimize startup by skipping zero-BSS initialization
## Description
This PR contains the following two commits:
1. **ARM64: Add `ARCH_SKIP_ZERO_BSS` option**
- Add the generic `ARCH_SKIP_ZERO_BSS` Kconfig option.
- Allow architectures and startup code to skip explicit zeroing of the BSS
section when the boot environment already guarantees the required memory
state.
- Add the startup guard to ARM, ARMv7-A, ARMv7-R, ARMv8-R, ARM64, MPS,
RISC-V QEMU, x86_64 Intel64, ESP32, ESP32-S2, and ESP32-S3 startup
paths.
- Reduce boot time by avoiding unnecessary BSS initialization.
2. **arm64: Remove `arm64_earlyprintinit`**
- Remove the obsolete `arm64_earlyprintinit` path.
- Clean up the ARM64 common startup code and platform-specific low-level
UART
initialization code.
- Update A64, FVP-v8R, Goldfish, i.MX8, i.MX9, QEMU, RK3399, and Zynq
MPSoC startup paths.
- Preserve the existing early-console behavior through the remaining
platform initialization paths.
## Motivation
Reduce ARM64 and multi-architecture boot overhead by avoiding redundant BSS
zeroing and remove an obsolete ARM64 early-print initialization mechanism.
The
changes simplify startup code while preserving normal console and application
startup behavior.
## Runtime and Build Testing
The ARM64 QEMU `nsh` configuration was built with CMake and Ninja using the
GNU Arm Embedded toolchain.
### Build log
```text
-- Board: qemu-armv8a
-- Config: nsh
-- The C compiler identification is GNU 13.2.1
-- Found assembler: arm-none-eabi-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: build
[1328/1328] Linking CXX executable final_nuttx
Memory region Used Size Region Size %age Used
ROM: 373960 B 1 MB 35.66%
RAM: 28 KB 16 MB 0.17%
```
The build completed successfully. The linker emitted only the existing RWX
LOAD segment warning.
### QEMU startup log
```text
qemu-system-arm -cpu cortex-a7 -semihosting \
-M virt,virtualization=off,gic-version=2 -m 1024 -nographic \
-kernel ./build/nuttx
nsh>
```
### ARMv7-A `ostest`
```text
nsh> ostest
stdio_test: Standard I/O Check: printf
ostest_main: Started user_main at PID=6
user_main: vfork() test
vfork_test: Child 7 ran and exited before the parent resumed
user_main: FPU test
FPU#1: Succeeded
FPU#2: Succeeded
user_main: wqueue test
wqueue_test: backend = flat
wqueue_test: HPWORK done
wqueue_test: custom queue, threads = 1 done
wqueue_test: custom queue, threads = 2 done
wqueue_test: multiple custom queues done
wqueue_test: teardown done
user_main: mutex test
mutex_test: PASSED
user_main: signal handler test
sighand_test: SUCCESS
user_main: nested signal handler test
signest_test: done
user_main: priority inheritance test
priority_inheritance: PASSED Priority were correctly restored.
priority_inheritance: Finished
user_main: scheduler lock test
sched_lock: PASSED No pre-emption occurred while scheduler was locked.
sched_lock: Finished
Final memory usage:
VARIABLE BEFORE AFTER
======== ======== ========
arena ff3ffc ff3ffc
ordblks 2 7
mxordblk fec130 fd5460
uordblks 7d94 7ed4
fordblks fec268 fec128
user_main: Exiting
ostest_main: Exiting with status 0
nsh>
```
## Testing Status
- [x] Built with the ARM64 QEMU `nsh` configuration.
- [x] Booted the resulting image under QEMU.
- [x] ARMv7-A `ostest` completed with status 0.
- [x] FPU, vfork, work queue, mutex, signal, priority inheritance, and
scheduler-lock tests completed successfully.
- [ ] Measured boot-time improvement across all affected architectures.
- [ ] Tested all secure and non-secure ARM64 platform variants.
## Commits
- `2c768c4c098a8a73a996ce67e4fa093446652a09` ARM64: add ARCH_SKIP_ZERO_BSS
option
- `3d4aea9413b1d82e7c746c8ff522fb195f207892` arm64: remove
arm64_earlyprintinit
## Change Summary
The two commits modify 21 files with 68 insertions and 97 deletions.
Signed-off-by: sunjikun <[email protected]>
Signed-off-by: hujun5 <[email protected]>
--
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]