mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-13 07:57:56 +08:00
819c783b6c
Replaces the legacy pure-Python lookup table CRC32 implementation with the built-in `zlib.crc32`. The previous implementation relied on a manual loop over bytes, which was inefficient for large firmware files (taking ~0.5s for 2MB on modern CPUs). The new implementation reduces this to ~1ms. Implementation details: - Removed the hardcoded `crctab` array to clean up the code. - Adjusted `zlib` initial state (0xFFFFFFFF) and final XOR operations to ensure bit-perfect compatibility with the specific CRC32 variant expected by the PX4 bootloader. Benchmark (2MB firmware): - Legacy: ~0.48s - zlib: ~0.001s