A method for resetting a processor, suitable for a computer device comprising a controller, a main processor, a coprocessor, a static memory, and a random-access memory, the method comprising:
- obtaining a complete image file corresponding to the coprocessor by a first component of the computer device, and loading the complete image file into a reference space in the random-access memory by the first component, wherein the random-access memory comprises a specific space corresponding to the coprocessor, and the first component is the coprocessor, wherein the reference space is a first designated random-access memory region configured to store said complete image file, and the specific space is a second designated random-access memory region, distinct from the reference space, configured to store the complete image file and from which the coprocessor executes;
- notifying, by the coprocessor, the main processor that an executable image file of the coprocessor needs to be updated;
- loading the complete image file stored in the reference space into the specific space corresponding to the coprocessor by a second component of the computer device, thereby enabling a reset of the coprocessor independently of an access status of the static memory of the computer device, and validating the complete image file stored in the specific space by the second component in response to determining that the coprocessor needs to be reset, wherein the second component is the main processor;
- and
- resetting the coprocessor based on the complete image file stored in the specific space by the second component in response to the second component determining that the complete image file stored in the specific space is valid,
- wherein the first component is the coprocessor, the second component is the main processor, a security permission of the main processor is higher than a security permission of the coprocessor, and before the step of validating the complete image file stored in the specific space by the second component, the method further comprises:
- switching the main processor from a non-secure mode to a secure mode;
- holding a reset signal corresponding to the coprocessor by the main processor in response to determining that the coprocessor needs to be reset;
- and
- disabling a write-protect function of the specific space, loading the complete image file from the reference space into the specific space, and enabling the write-protect function of the specific space by the main processor;
- wherein the step of resetting the coprocessor based on the complete image file stored in the specific space by the second component in response to the second component determining that the complete image file stored in the specific space is valid comprises:
- loading/updating the complete image file stored in the specific space into the static memory of the computer device and releasing the reset signal corresponding to the coprocessor by the main processor, wherein the coprocessor performs a reset operation based on the complete image file stored in the specific space in response to the corresponding reset signal.