jsanchez-2g opened a new pull request, #20566: URL: https://github.com/apache/nuttx/pull/20566
## Summary BQ769x0 PEC requires CRC polynomial 0x07, initial state zero and no final XOR. Its current crc8ccittpart calls inherit entry/exit inversions from crc8table and calculate the wrong PEC. For the representative address/data bytes `11 00`, the required PEC is `42`; the existing API gives `6a`. Add explicit crc8smbus and crc8smbuspart helpers, reusing the existing table while cancelling its inversions. Update six BQ769x0 calls in read/write/multi-register-read paths. Preserve all existing CRC APIs and results. Include whitespace-only corrections required by full-file driver style checks. Reference: [TI BQ769x0 datasheet](https://www.ti.com/lit/gpn/BQ76940), CRC communication requirements. Companion NuttX Apps PR will add tests to testing/libc/crctest; link to be supplied when created. ## Impact Additive libc API and BQ769x0 PEC correctness fix. No configuration switch, build-system change or stored-data format change. Existing complemented CRC variants remain unchanged. CRC-disabled BQ transfers retain their existing behavior. No new security interface. No dependency on Apps for the driver fix itself. ## Testing Host: Ubuntu 24.04 / WSL2, x86_64. Target compiler: arm-none-eabi GCC 13.2.1. Native regression tests: real CMocka 1.1.7, nine passing cases, including new SMBus tests (123456789 -> F4, 11 00 -> 42, split calculations, empty inputs and independent bitwise reference across all 256 seeds), complemented API compatibility, and existing CRC variants. Tests are included in the companion Apps change, not only in a local harness. Production integration builds passed using make -j1 V=1 after clean/distclean and removal of residual untracked generated objects/dependencies. Boards: Conductor STM32H743BI, Vacule STM32H743II, Golgi STM32G0B1CE. Hardware operator reported all three candidates PASS on 2026-10-09; detailed target transcripts were not supplied. Exact ELF/BIN/config/map/checksums and build diagnostics retained locally. Builds use external 2G boards and fork support, not pristine Apache board configurations. BQ fork limit-reporting extensions remain in integration builds and are excluded from this upstream patch. Vacule and Golgi link maps confirm bq769x0 references crc8smbuspart and application checksums use independent 2G compute_crc8. Their effective configs disable SMART and CONFIG/NVS. Conductor provides integration/persistence/communications regression evidence, not execution of the new helper: its final image has no linked NuttX CRC8 functions. No global CRC inversion-removal patch is applied in any of these candidates. Full-file style, encoding, spelling and whitespace checks pass. Existing compiler warnings are retained; no warning-free full firmware build claimed. Native tests are not a NuttX target CMocka execution. ## PR verification Self-Check - [x] One functional change: correct BQ769x0 PEC through explicit helpers. - [x] Impact and validation described. - [x] Human Signed-off-by and post-commit message checks complete. - [x] Ready for review; companion dependency noted. -- 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]
