The invention relates to the technical field of
industrial communication networks, in particular to a BootROM code patch loading method and
system based on a
CPU Cache mechanism, and the method comprises the steps: obtaining patch configuration data; a
Cache controller of the CPU is initialized, an instruction Cache and a
data Cache are enabled, and a write allocation strategy and a consistency monitoring mechanism are started; writing the patch code block into a target address of the
address space of the BootROM, using the read-only attribute of the BootROM to enable the write-in operation to distribute a cache line in the
data Cache to store the patch code block, and marking the patch code block as a modified state; and when the CPU executes to a target address, triggering the instruction Cache to be missing, obtaining patch code blocks from the
data Cache through a consistency monitoring mechanism, and executing the patch code blocks, so that the BootROM codes are dynamically repaired. The
system comprises a control module, a
Cache management module, a
bus interface module and a patch storage module. According to the method, online update of the BootROM code is realized through a Cache mechanism, and the technical problem that a read-only memory cannot be directly modified is solved.