Hello,
Given that I don't want to/can't use the SDK (see this post: https://community.nxp.com/t5/MCUXpresso-SDK/errors-in-code-of-SDK-for-RT1170/m-p/2328115/highlight/t...)
I can create descriptors to have CAAM calculate the correct CRC.
I have the following four functions:
- initialize
- update
- finalize
- Init/Finalize
A typical descriptor is:
| Initialize | Update | Finalize |
- HEADER
- KEY (set the polynomial)
- OPERATION (init)
- FIFO LOAD (load data)
- STORE (context)
- HALT
| - HEADER
- KEY (set the polynomial)
- OPERATION (Update)
- LOAD (context)
- FIFO LOAD (load data)
- STORE (context)
- HALT
| - HEADER
- KEY (set the polynomial)
- OPERATION (Finalize)
- LOAD (context)
- FIFO LOAD (load data)
- STORE (crc)
- HALT
|
What I really can't seem to handle well is the fact that both `initialize` and `finalize` have to provide data.
There isn't a single CRC software library that has such a requirement. For example, the code generated by pycrc doesn't require data for `init` and `fin`.
That said, there are contexts in which it is practically impossible to do so (without having to buffer something, which consumes RAM and ties up the processor, thereby losing some of the advantage gained from using CAAM).
I'm referring, for example, to serialization using Protobuf (nanopb). Since we don't want to use tens of kilobytes of RAM, we'd like to work in-stream.
So I call pb_encode(), and this calls a callback of mine, passing me a portion of the serialized data to be stored incrementally in non-volatile memory, and on which I want to calculate the CRC. However, I can’t know which call will be the last one. I’ll only know that after I exit pb_encode(), but by that point I won’t have any more data to process.
So the question is:
Is there really no way to avoid having to provide data to `Initialize`, and especially to `finalize`?
best regards
Max