I use KL81's SHA256 to calculate Flash's Hash. It works fine with some data in RAM. But when I tried to calculate my whole firmware's SHA256, I got some problems.The firmware is running in flash, starts from 0x00000000.
When I use the LTC driver to do the calculation, I found one of the functions, LTC_DRV_hash_update(), has a check on input buffer:
if ((NULL == ctx) || (NULL == input))
So my calculation failed because the input address is 0. I tried to remove this check, the code stuck in function ltc_drv_wait().
If I changed the input address from 0 to 0x4, the code stuck in function ltc_drv_wait() as well.
If I copy my firmware from Flash to a big buffer in RAM and calculate the SHA256, the code hang in ltc_drv_wait() as well.
The code size is 0x8A30 bytes. It looks like if the code try to calculate the hash of itself, the LTC module cannot finish the calculation.
Did anyone has this problem before?