This invention provides an embedded
flash memory integrity protection method and
system based on general hardware
collaboration, belonging to the field of
firmware protection technology. The
firmware area within the
flash memory to be protected is divided into multiple blocks to be protected. The start address, length, and block identifier of each block are defined through a configuration file, and a
firmware image is generated through compilation. A
verification calculation tool calculates the
verification digest of the original binary data block by block, generating a block
verification information table containing the corresponding block address, length, identifier, and pre-calculated digest. This verification table is written into the firmware image and burned into the
flash memory. After
system initialization, the DMA controller transfers the data of the blocks to be protected to the hardware verification engine, calculating the current verification digest in real time. An interrupt is triggered after each
block transfer is completed. In the interrupt service routine, the current digest is compared with the pre-stored digest; if they do not match, a security response is triggered. A hardware
timer polls and repeats the verification at a preset period, achieving periodic integrity monitoring of the entire block.