Fix-Point opened a new pull request, #4040: URL: https://github.com/apache/nuttx-apps/pull/4040
## Summary This PR shrinks the flash footprint of the `ostest` and `dd` test utilities to keep the 128 KiB G431 boards linking alongside https://github.com/apache/nuttx/pull/21491. This is entirely about flash size, not behaviour. The math32 changes in apache/nuttx#21491 replace constant-divisor 64-bit divisions with inline multiply-shift magic, which is a performance win but grows the image by ~256 bytes on 32-bit targets. `b-g431b-esc1` and `nucleo-g431kb` already have only 127/55 bytes of flash free on master, so #21491 pushes them over the edge (the `Linux (arm-stm32l-u-g)` CI job reports `region 'flash' overflowed by 132 bytes` and `by 188 bytes`). To make room without touching the boards' configuration, this PR frees flash in the test utilities: 1. **Narrow the wdog delay math to 32 bits** (`testing/ostest/wdog.c`): every delay in the test stays below 2^32 ns, so keeping the division and modulo 32-bit avoids pulling the 64-bit division library into the image. 2. **Compute the dd copy throughput with integer arithmetic** (`system/dd/dd_main.c`): the throughput was computed in `double`, which pulls the whole soft-float cluster (`__aeabi_dadd` and friends, ~2 KiB) into the image. Integer arithmetic -- `(total * USEC_PER_SEC / 1024) / elapsed`, with the division by 1024 a shift -- keeps one 64-bit division against the division library the image already contains and drops the soft-float cluster. Measured on `nucleo-g431kb:nsh`, the image shrinks by **2052 bytes** (128536 -> 126484), leaving headroom over the 188-byte shortfall; the same two commits clear `b-g431b-esc1:nsh` (132 bytes). The 64-bit division library is still linked after this PR (the unpatched `gmtime`/`printf` sites keep it); removing it entirely is a separate, larger change and is deliberately out of scope here. ## Impact - User impact: none beyond the test utilities. `dd` prints its KB/s line with integer rounding (off by at most ~1 KB/s versus the old double math) and `ostest`'s wdog timings are unchanged (the delays fit in 32 bits). - Build: no `CONFIG_*` change, no build-system change, no new header. - Hardware: targets the small-flash STM32G4 boards; no functional change on any other target. - Documentation: none needed. - Security: no security impact. - Compatibility: `dd`'s output format is unchanged. ## Testing - Host: Ubuntu 22.04 x86-64, `arm-none-eabi-gcc` 10.3.1. - Board/Configuration: `b-g431b-esc1:nsh` (Make), `nucleo-g431kb:nsh` (CMake). - Build: clean on both, no new warnings. - Size (`nucleo-g431kb:nsh`, text+data): 128536 -> 126484, **-2052 B**. ``` $ arm-none-eabi-size build/nuttx # after 125548 936 8784 135268 21064 build/nuttx ``` - Run: `qemu-armv7a` boots; `ostest` exits 0 (wdog, spinlock and POSIX timer cases pass); `dd` prints a KB/s line consistent with the integer formula. No real G431 hardware available -- the run is QEMU only. - `tools/checkpatch.sh`: passes on both commits. -- 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]
