nasa / cFE

The Core Flight System (cFS) Core Flight Executive (cFE)
Apache License 2.0
413 stars 206 forks source link

Customizable CRC Algorithms #1095

Open mjmccaskey opened 3 years ago

mjmccaskey commented 3 years ago

Is your feature request related to a problem? Please describe. It would be useful to be able to customize which CRC algorithms are being implemented in CFE_ES_CalculateCRC.

Describe the solution you'd like Instead of using a hard-coded lookup table, a user can set a few variables in a configuration file that describes the desired algorithm. On initialization of CFE_ES, the lookup tables can be generated based on the configuration variables. I've attached a couple snippets of code to demonstrate a potential implementation. The CRC algorithm variables are set in sample_mission_cfg.h. The lookup tables are generated in an initialization function that can be called when CFE_ES initializes.

Additional context The example CRC algorithms I used come from here (https://reveng.sourceforge.io/crc-catalogue/). The CRC-16 algorithm is currently implemented in CFE_ES_CalculateCRC.

Requester Info Mathew McCaskey HX5 / NASA-GRC Regenerative Fuel Cell Project

snippets.zip

skliper commented 3 years ago

Good point, this is an excellent candidate for a shift to the "module" concept/pattern (easily replaceable or customizable).