oresat / oresat-firmware

OreSat firmware based on ChibiOS for M0 and M4 microcontrollers
GNU General Public License v3.0
36 stars 13 forks source link

Add project CRC support library for STM32 CRC hardware #47

Closed heliochronix closed 3 months ago

heliochronix commented 3 years ago

Instead of having a bunch of individual CRC code files for different CRC implementations, create a support library that leverages the built-in CRC hardware on STM32 devices.

In particular, the polynomial on F091 devices is configurable, so it can be used to implement the CRC-16-CCITT used in subsystems like CANopen or CRC-32 used in firmware image checks.

For non-configurable devices, provide polynomial implementations for several common profiles that are not supported, but consolidate both into a single library for the project.

ThirteenFish commented 3 months ago

The CRC library in common/crc.c appears to do hardware accelerated CRC with a bit of coaxing. See for example app_bootlader's halconf.h which makes use of it.