A processor firmware loading method, device, storage medium and program product
By dividing the processor firmware into a start firmware segment and a function firmware segment, and dynamically loading the target function firmware segment, the problems of long firmware loading time and data redundancy are solved, achieving fast hardware startup and resource saving.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- RICUN TECH (SHANGHAI) CO LTD
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-24
AI Technical Summary
In existing technologies, firmware loading time is long, which affects hardware boot speed, and data redundancy between the bootloader and the main program leads to wasted flash memory space and increased hardware costs.
The processor firmware is divided into a start firmware segment and a function firmware segment. The start firmware segment is loaded when the processor is powered on and the processor is started according to the call parameter information. After the processor starts, the target function firmware segment is loaded as needed, and dynamic loading is performed using flash memory read driver and memory write interface.
It accelerates hardware boot speed, reduces firmware loading time, saves flash memory and memory resources, avoids data redundancy, and improves hardware boot efficiency.
Smart Images

Figure CN121349563B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chip design technology, and in particular to a firmware loading method, apparatus, storage medium, and program product for a processor. Background Technology
[0002] Currently, chip design is increasingly moving towards a combination of hardware and firmware, making chip design simpler and more flexible. The introduction of firmware provides a way to fix chip design defects, and tasks that are difficult for hardware to perform can be handled by firmware.
[0003] Firmware is a set of instructions that run on the processor inside the chip, so booting firmware requires a loading process. Current firmware loading methods store the firmware in external flash memory, and after power is applied, copy the contents of the flash memory to the processor's memory, such as static random-access memory (SRAM), before the firmware can run.
[0004] However, as the complexity of firmware processing tasks and the size of firmware increase, firmware loading requires more and more instructions and data, and the firmware loading time becomes longer and longer, which seriously affects the hardware boot speed.
[0005] To improve hardware boot speed, current technology designs the processor firmware as both a bootloader and a main program. Both the bootloader and main program are independent executable programs. During hardware startup, only the bootloader needs to be loaded to start the hardware, resulting in a certain improvement in boot speed.
[0006] However, since the bootloader and main program are both independent executable programs, and they contain the same functionalities, data redundancy occurs, wasting flash memory space and increasing hardware costs. Furthermore, the main program needs to be fully loaded into memory, resulting in long firmware loading times and significant memory resource consumption, thus wasting resources. Summary of the Invention
[0007] This invention provides a firmware loading method, device, storage medium, and program product for a processor, to improve hardware boot speed, reduce firmware loading time, and save hardware storage resources.
[0008] According to one aspect of the present invention, a firmware loading method for a processor is provided, wherein the processor firmware includes a start firmware segment and at least one functional firmware segment; the start firmware segment includes a flash memory read driver, a processor memory write interface, and call parameter information; the method includes:
[0009] When the processor is powered on, the start firmware segment is loaded and the processor is started according to the call parameter information;
[0010] After the processor starts up, the target function firmware segment is located in the processor's firmware according to the processor's task.
[0011] Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the processor memory for task processing.
[0012] Optionally, loading flag information is set in each of the aforementioned functional firmware segments;
[0013] Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the processor memory for task processing, including:
[0014] Based on the loading flag information corresponding to the target function firmware segment, determine whether the target function firmware has been loaded into the processor memory;
[0015] When the target function firmware is not loaded into the processor memory, the target function firmware segment is loaded into the processor memory for task processing according to the flash read driver and processor memory write interface in the start firmware segment.
[0016] Optionally, after loading the target function firmware segment into the processor memory for task processing, the method further includes:
[0017] When the starting firmware segment indicates that the target function firmware segment is protected content, the target function firmware segment loaded in the processor memory is cleared or set to invalid when the target function firmware segment call ends.
[0018] Optionally, the starting firmware segment includes call frequency information for each functional firmware segment;
[0019] Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the processor memory for task processing, including:
[0020] Based on the call frequency information corresponding to the target function firmware segment in the starting firmware segment, the overlay storage information of the target function firmware segment is determined;
[0021] Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the area of the processor memory corresponding to the overwritten storage information for task processing.
[0022] Optionally, each of the functional firmware segments is stored encrypted in flash memory, and the start firmware segment includes the decryption algorithm for each of the functional firmware segments;
[0023] Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the processor memory for task processing, including:
[0024] The target function firmware segment is decrypted according to the decryption algorithm corresponding to the target function firmware segment in the starting firmware segment, and the firmware segment decryption result is obtained;
[0025] Based on the flash read driver and processor memory write interface in the initial firmware segment, the decryption result of the firmware segment is loaded into the processor memory for task processing.
[0026] Optionally, the start firmware segment includes verification information for each of the functional firmware segments;
[0027] Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the processor memory for task processing, including:
[0028] Obtain the verification information in the starting firmware segment that corresponds to the target function firmware segment;
[0029] When the verification information passes, the target function firmware segment is loaded into the processor memory for task processing according to the flash read driver and processor memory write interface in the start firmware segment.
[0030] Optionally, the start firmware segment includes the link scripts for each of the functional firmware segments and start and end markers;
[0031] After the processor starts up, the target function firmware segment is located in the processor's firmware according to the processor's task, including:
[0032] After the processor starts, the target functional firmware segment is determined in the linker script of the starting firmware segment according to the processor's task, and the storage location of the target functional firmware segment in the flash memory is determined according to the start and end markers.
[0033] According to another aspect of the present invention, a firmware loading apparatus for a processor is provided. The firmware of the processor includes a start firmware segment and at least one functional firmware segment; the start firmware segment includes a flash memory read driver, a processor memory write interface, and call parameter information; the apparatus includes:
[0034] The processor startup module is used to load the start firmware segment and start the processor according to the call parameter information when the processor is powered on.
[0035] The target function firmware segment lookup module is used to look up the target function firmware segment in the processor's firmware after the processor starts up, based on the processor's task.
[0036] The target function firmware segment loading module is used to load the target function firmware segment into the processor memory for task processing based on the flash memory read driver and processor memory write interface in the starting firmware segment.
[0037] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0038] At least one processor; and a memory communicatively connected to said at least one processor; wherein,
[0039] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the firmware loading method of the processor according to any embodiment of the present invention.
[0040] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the firmware loading method of the processor according to any embodiment of the present invention.
[0041] According to another aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the firmware loading method of the processor according to any embodiment of the present invention.
[0042] In the technical solution of this invention, the processor firmware includes a start firmware segment and at least one functional firmware segment. The start firmware segment includes a flash memory read driver, a processor memory write interface, and call parameter information. By loading the start firmware segment and starting the processor according to the call parameter information when the processor is powered on, and searching for the target functional firmware segment in the processor firmware according to the processor's task after startup, the target functional firmware segment is loaded into the processor memory for task processing according to the flash memory read driver and processor memory write interface in the start firmware segment. This solves the problem of the processor dynamically calling firmware segments on demand for startup and operation. By splitting the processor firmware, loading functional firmware on demand during firmware loading can reduce firmware loading time and accelerate hardware startup speed. Furthermore, by incorporating the start firmware segment as part of the processor firmware, redundant information is reduced, and flash memory space is saved.
[0043] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 This is a flowchart of a firmware loading method for a processor according to Embodiment 1 of the present invention;
[0046] Figure 2 This is a schematic flowchart of another firmware loading method for a processor according to Embodiment 1 of the present invention;
[0047] Figure 3 This is a flowchart of a firmware loading method for a processor according to Embodiment 2 of the present invention;
[0048] Figure 4 This is a schematic diagram of the structure of a firmware loading device for a processor according to Embodiment 3 of the present invention;
[0049] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the firmware loading method of the processor according to an embodiment of the present invention. Detailed Implementation
[0050] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0051] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0052] Example 1
[0053] Figure 1 This is a flowchart of a firmware loading method for a processor according to Embodiment 1 of the present invention. This embodiment is applicable to the situation where the processor is started by firmware loading during chip design or repair. The method can be executed by a firmware loading device for the processor. The firmware loading device for the processor can be implemented in hardware and / or software. The firmware loading device for the processor can be configured in electronic devices such as chips, processors, computers, or controllers.
[0054] The processor firmware includes a start firmware segment and at least one functional firmware segment. The start firmware segment includes the flash memory read driver, the processor memory write interface, and call parameter information. Both the start firmware segment and each functional firmware segment are parts of the processor firmware and are not complete programs. By combining the start firmware segment and the functional firmware segments to form a complete program—the processor firmware—data redundancy caused by dividing the processor firmware into multiple complete programs is avoided, thus improving flash memory resource utilization. The start firmware segment can be placed at the top of the processor firmware.
[0055] The processor's firmware can be pre-stored in flash memory and loaded into processor memory, such as SRAM, during processor startup. Loading the start firmware segment enables hardware booting of the processor. The call parameters in the start firmware segment can include global variables, static variables, constants, and strings used by the start firmware segment. The flash read driver and processor memory write interface in the start firmware segment can be used to load the required functional firmware segments from flash memory into memory.
[0056] A functional firmware segment can be the smallest unit that a processor can dynamically load when performing task processing. In other words, a functional firmware segment can implement the minimum processing functionality required for a task. By splitting the processor's firmware into a start firmware segment and multiple functional firmware segments, only the start firmware segment can be loaded during processor startup, enabling rapid processor hardware startup. When the processor performs task processing, the corresponding functional firmware segments are loaded according to the required functions, avoiding loading the entire firmware into processor memory, allowing programs to run with minimal firmware loading overhead. Firmware execution does not need to wait for the entire processor firmware to finish loading; instead, it can be dynamically loaded based on the actual operational needs of the program, achieving rapid task execution and enabling more functionality to be implemented within limited memory space. For example, when the processor calls a function for task processing, only the instructions corresponding to the function and the data used can be loaded into processor memory for task execution.
[0057] like Figure 1 As shown, the firmware loading method for this processor includes:
[0058] Step 110: When the processor is powered on, load the start firmware segment and start the processor according to the call parameter information.
[0059] The start firmware segment can include global variables, static variables, constants, and strings required for processor startup, as well as other calling parameters. Therefore, when the processor is powered on, it can be started based on the calling parameters in the start firmware segment, achieving rapid hardware startup with a minimal firmware segment. It should be noted that the start firmware segment in this application is merely a section within the processor firmware, avoiding the redundancy of instructions and data caused by the presence of identical content in multiple complete programs (boot program and main program) when the processor firmware is divided into multiple complete programs; this also avoids wasting flash memory space and reduces hardware costs.
[0060] Step 120: After the processor starts up, locate the target function firmware segment in the processor firmware according to the processor's task.
[0061] When processing tasks, the processor can send firmware function requests to memory, which can then locate the corresponding target function firmware segment in flash memory based on the function request. For example, the target function firmware segment can be determined by matching the function name, firmware segment attributes, or linker scripts of the function firmware segment.
[0062] Optionally, the start firmware segment includes the linker scripts for each functional firmware segment and start and end markers; after the processor starts, the target functional firmware segment is located in the processor's firmware according to the processor's task, including: after the processor starts, the target functional firmware segment is determined in the linker script of the start firmware segment according to the processor's task, and the storage location of the target functional firmware segment in the flash memory is determined according to the start and end markers.
[0063] The linker script can be used to call functional firmware segments. For example, the linker script can include information such as functions, global variables, static variables, constants, and strings in the functional firmware segments. The linker scripts for each functional firmware segment can be set directly in the start firmware segment, or the linker scripts for each functional firmware segment can be set in the start firmware segment through the main function. Neither of these methods will cause the start firmware segment to be too large, affecting the hardware boot speed.
[0064] The start firmware segment may also include start and end markers (such as start and end) for each functional firmware segment. These start and end markers determine the storage location of each functional firmware segment in flash memory, facilitating accurate retrieval. Specifically, when the processor sends a firmware function request to memory, memory can send the request to flash memory. Flash memory can then match the firmware function request with the linker scripts of each functional firmware segment to determine the target functional firmware segment. Based on the start and end markers corresponding to the target functional firmware segment, its storage location in flash memory can be determined, allowing it to be loaded from flash memory into the processor's memory.
[0065] Step 130: Based on the flash memory read driver and processor memory write interface in the starting firmware segment, load the target function firmware segment into the processor memory for task processing.
[0066] The firmware segment can be read from the storage location of the target function firmware segment in flash memory via the flash read driver in the start firmware segment. The target function firmware segment read from flash memory can be loaded into memory via the processor memory write interface in the start firmware segment. Task processing can be performed when the target function firmware segment is loaded into memory.
[0067] To avoid duplicate loading of functional firmware segments, optionally, loading flag information is set in each functional firmware segment; the target functional firmware segment is loaded into the processor memory for task processing based on the flash read driver and processor memory write interface in the starting firmware segment, including: determining whether the target functional firmware has been loaded into the processor memory based on the loading flag information corresponding to the target functional firmware segment; if the target functional firmware has not been loaded into the processor memory, the target functional firmware segment is loaded into the processor memory for task processing based on the flash read driver and processor memory write interface in the starting firmware segment.
[0068] The load flag information is used to indicate whether the current functional firmware segment has been loaded into memory. If the load flag information determines that the target functional firmware has already been loaded, it does not need to be loaded again. If the load flag information determines that the target functional firmware has not been loaded into processor memory, the target functional firmware segment can be loaded into processor memory for task processing based on the flash read driver and processor memory write interface in the initial firmware segment. By using the load flag information, duplicate loading of functional firmware segments can be avoided, improving the processor's task processing efficiency.
[0069] To enhance the security of the firmware segment, optionally, after loading the target function firmware segment into the processor memory for task processing, the method further includes: when the starting firmware segment indicates that the target function firmware segment is protected content, clearing or invalidating the target function firmware segment loaded in the processor memory when the target function firmware segment call ends.
[0070] When the target function firmware segment in processor memory is cleared or invalidated, the load flag information of the target function firmware in flash memory can be modified to not loaded. By clearing or invalidating the protected target function firmware segment in processor memory at the end of the call, the target function firmware segment can be protected, preventing the leakage of sensitive information. Furthermore, by clearing or invalidating the target function firmware segment loaded in processor memory, the storage space in memory can be reused to load other function firmware segments, improving memory utilization and enabling more functions.
[0071] Figure 2 This is a schematic flowchart of another firmware loading method for a processor according to Embodiment 1 of the present invention. Figure 2 As shown, when the processor hardware is powered on, the start firmware segment in the processor firmware is loaded to achieve processor hardware startup. When the processor is processing a task, the target functional firmware segment in the processor firmware is selected and loaded according to the firmware segment call instruction of the task. Before loading the target functional firmware segment, it is determined whether the target functional firmware segment has been loaded into memory based on the corresponding loading flag information. If the target functional firmware segment has not been loaded, it is loaded, and the corresponding loading flag information is marked as loaded. If the target functional firmware segment has been loaded, there is no need to load it again, and function execution can proceed. Before function execution, it can be determined whether the target functional firmware segment is protected content. If the target functional firmware segment is protected content, it can be cleared from memory after function execution, and the corresponding loading flag information is updated to not loaded. If the target functional firmware segment is not protected content, function execution can proceed, and there is no need to clear the target functional firmware segment from memory after function execution. After function execution, it can be determined whether the processor task has been completed. If the processor task has not been completed, the process returns to the step of selecting and loading the target functional firmware segment in the processor firmware according to the firmware segment call instruction of the task when the processor is processing the task. End when the processor task is completed.
[0072] In this embodiment, the processor firmware includes a start firmware segment and at least one functional firmware segment. The start firmware segment includes a flash memory read driver, a processor memory write interface, and call parameter information. When the processor is powered on, the start firmware segment is loaded and the processor is started according to the call parameter information. After the processor starts, the target functional firmware segment is searched in the processor firmware according to the processor's task. Based on the flash memory read driver and processor memory write interface in the start firmware segment, the target functional firmware segment is loaded into the processor memory for task processing. This solves the problem of the processor dynamically calling firmware segments on demand for startup and operation. By splitting the processor firmware, functional firmware can be loaded on demand during firmware loading, which can reduce firmware loading time and accelerate hardware startup speed. Furthermore, by incorporating the start firmware segment as part of the processor firmware, redundant information is reduced, and flash memory space is saved.
[0073] Example 2
[0074] Figure 3 This is a flowchart of a firmware loading method for a processor according to Embodiment 2 of the present invention. This embodiment is a further refinement of the above technical solution. The technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments.
[0075] The processor firmware includes a start firmware segment and at least one functional firmware segment. The start firmware segment includes the flash memory read driver, the processor memory write interface, and call parameter information. The start firmware segment also includes the linker scripts and start / end markers for each functional firmware segment. Each functional firmware segment sets load marker information.
[0076] like Figure 3 As shown, the method includes:
[0077] Step 310: When the processor is powered on, load the start firmware segment and start the processor according to the call parameter information.
[0078] Step 320: After the processor starts up, determine the target function firmware segment in the linker script of the starting firmware segment according to the processor's task, and determine the storage location of the target function firmware segment in the flash memory according to the start and end markers.
[0079] Step 330: Determine whether the target function firmware has been loaded into the processor memory based on the loading flag information corresponding to the target function firmware segment.
[0080] Step 340: When the target function firmware is not loaded into the processor memory, load the target function firmware into the processor memory for task processing according to the flash read driver and processor memory write interface in the starting firmware segment.
[0081] Based on the above implementation, optionally, the starting firmware segment includes call frequency information for each functional firmware segment; according to the flash memory read driver and processor memory write interface in the starting firmware segment, the target functional firmware segment is loaded into the processor memory for task processing, including: determining the overlay storage information of the target functional firmware segment according to the call frequency information corresponding to the target functional firmware segment in the starting firmware segment; and loading the target functional firmware segment into the area in the processor memory corresponding to the overlay storage information for task processing according to the flash memory read driver and processor memory write interface in the starting firmware segment.
[0082] The call frequency information for a functional firmware segment can be the number of times the functional firmware segment is called, or the degree of call frequency. For example, the call frequency information for a functional firmware segment can include high-frequency calls, medium-frequency calls, and low-frequency calls. When the call frequency information of a functional firmware segment is different, the storage area of the functional firmware segment in memory is different, and / or, the storage method of the functional firmware segment in memory is different.
[0083] Specifically, the corresponding overlay storage information can be determined based on the call frequency information of the functional firmware segment, and the functional firmware segment can be stored in the memory region corresponding to the overlay storage information. For example, the call frequency information of the functional firmware segment and the overlay storage information may be positively or negatively correlated. For instance, the higher the call frequency of a functional firmware segment, the lower the probability of it being overwritten in memory. For example, for frequently called functional firmware segments, its overlay storage information can be of low overlay probability, meaning that frequently called functional firmware segments can be stored in a region of memory that is less likely to be overwritten. For instance, a first storage region can be set up in memory to store frequently called functional firmware segments without overlay storage. For medium-frequency called functional firmware segments, its overlay storage information can be of medium overlay probability, meaning that medium-frequency called functional firmware segments can be stored in a region of memory that may be overwritten. For instance, a second storage region can be set up in memory to store medium-frequency called functional firmware segments, allowing for a certain degree of overlay storage. For frequently accessed firmware segments, their overwrite storage information can have a high overwrite probability, meaning that these segments can be stored in a region of memory that is easily overwritten. For example, a third storage region can be set up in memory to store these frequently accessed firmware segments, allowing for overwrite storage.
[0084] By overwriting the contents stored in memory and combining the call frequency information of functional firmware segments during the overwriting process, different functional firmware segments can be loaded in the same storage space, improving memory space utilization. Functional firmware segments can be shared and run within a limited memory space, enabling the execution of larger firmware within that limited space. Functional firmware segments are loaded into memory only when needed, rather than loading the entire firmware at once, thus effectively utilizing limited memory resources. This avoids situations where some functions in the firmware may only need to be executed once but continuously occupy memory storage resources, allowing different functional firmware segments to be loaded into memory to implement more functions.
[0085] Optionally, each functional firmware segment is stored encrypted in flash memory, and the starting firmware segment includes the decryption algorithm for each functional firmware segment. Based on the flash memory read driver and processor memory write interface in the starting firmware segment, the target functional firmware segment is loaded into the processor memory for task processing, including: decrypting the target functional firmware segment according to the decryption algorithm corresponding to the target functional firmware segment in the starting firmware segment to obtain the firmware segment decryption result; and loading the firmware segment decryption result into the processor memory for task processing according to the flash memory read driver and processor memory write interface in the starting firmware segment.
[0086] By encrypting and storing functional firmware segments and decrypting them during loading, the confidentiality of functional firmware segments is achieved, thereby improving firmware security.
[0087] Optionally, the starting firmware segment includes verification information for each functional firmware segment. Based on the flash memory read driver and processor memory write interface in the starting firmware segment, the target functional firmware segment is loaded into the processor memory for task processing, including: obtaining the verification information corresponding to the target functional firmware segment from the starting firmware segment; and, when the verification information passes, loading the target functional firmware segment into the processor memory for task processing based on the flash memory read driver and processor memory write interface in the starting firmware segment. The verification information allows for integrity verification of the functional firmware segments, improving firmware security.
[0088] Step 350: When the starting firmware segment indicates that the target function firmware segment is protected content, the target function firmware segment loaded in the processor memory is cleared or set to invalid when the target function firmware segment call ends.
[0089] In the technical solution of this invention embodiment, the processor firmware includes a start firmware segment and at least one functional firmware segment. The start firmware segment includes a flash memory read driver, a processor memory write interface, and call parameter information. When the processor is powered on, the start firmware segment is loaded and the processor is started according to the call parameter information. After the processor starts, the target functional firmware segment is determined in the linker script of the start firmware segment according to the processor's task, and the storage location of the target functional firmware segment in the flash memory is determined according to the start and end markers. According to the loading marker information corresponding to the target functional firmware segment, it is determined whether the target functional firmware has been loaded into the processor memory. If the target functional firmware has not been loaded into the processor memory, the target functional firmware segment is loaded into the processor memory for task processing according to the flash memory read driver and the processor memory write interface in the start firmware segment. When the start firmware segment indicates that the target functional firmware segment is protected content, the target functional firmware segment loaded into the processor memory is transferred to the processor memory when the call to the target functional firmware segment ends. The removal or invalidation of firmware segments solves the problem of processors dynamically calling firmware segments on demand for startup. By splitting the processor firmware, functional firmware is loaded on demand during firmware loading, avoiding loading the entire firmware, thus reducing firmware loading time and accelerating hardware startup speed. Furthermore, incorporating the initial firmware segment as part of the processor firmware reduces redundant information and saves flash memory space. Verifying signatures and clearing confidentiality on functional firmware segments prevents firmware tampering and protects the core firmware content. Overwriting functional firmware segments in memory allows them to share memory storage resources, enabling more functional firmware segments to be loaded into memory, implementing more functions, and improving the utilization of memory storage resources. For content requiring protection, verification signatures are performed before copying, and after execution, it can be marked as invalid or cleared, making it impossible to obtain the complete firmware content in memory and avoiding the risk of leakage or tampering of sensitive information in the firmware.
[0090] Example 3
[0091] Figure 4 This is a schematic diagram of a firmware loading device for a processor according to Embodiment 3 of the present invention. The processor firmware includes a start firmware segment and at least one functional firmware segment; the start firmware segment includes a flash memory read driver, a processor memory write interface, and call parameter information. Figure 4 As shown, the device includes: a processor boot module 410, a target function firmware segment lookup module 420, and a target function firmware segment loading module 430. Wherein:
[0092] The processor startup module 410 is used to load the start firmware segment and start the processor according to the call parameter information when the processor is powered on.
[0093] The target function firmware segment lookup module 420 is used to look up the target function firmware segment in the processor firmware according to the processor's task after the processor starts up.
[0094] The target function firmware segment loading module 430 is used to load the target function firmware segment into the processor memory for task processing based on the flash memory read driver and processor memory write interface in the starting firmware segment.
[0095] Optionally, loading flag information can be set in each functional firmware segment;
[0096] The target function firmware segment loading module 430 includes:
[0097] The firmware segment loading judgment unit is used to determine whether the target function firmware has been loaded into the processor memory based on the loading mark information corresponding to the target function firmware segment.
[0098] The target function firmware segment loading unit is used to load the target function firmware segment into the processor memory for task processing when the target function firmware is not loaded into the processor memory, based on the flash memory read driver and processor memory write interface in the starting firmware segment.
[0099] Optionally, the device may also include:
[0100] The firmware segment clearing module is used to clear or invalidate the target function firmware segment loaded in the processor memory after the target function firmware segment is loaded into the processor memory for task processing, when the start firmware segment indicates that the target function firmware segment is protected content, and when the target function firmware segment call ends.
[0101] Optionally, the start firmware segment may include call frequency information for each functional firmware segment;
[0102] The target function firmware segment loading module 430 includes:
[0103] The overlay storage information determination unit is used to determine the overlay storage information of the target function firmware segment based on the call frequency information corresponding to the target function firmware segment in the starting firmware segment.
[0104] The overlay storage unit is used to load the target function firmware segment into the area of the processor memory corresponding to the overlay storage information for task processing, based on the flash memory read driver and processor memory write interface in the starting firmware segment.
[0105] Optionally, each functional firmware segment is stored encrypted in flash memory, and the beginning firmware segment includes the decryption algorithm for each functional firmware segment.
[0106] The target function firmware segment loading module 430 includes:
[0107] The firmware segment decryption unit is used to decrypt the target function firmware segment according to the decryption algorithm corresponding to the target function firmware segment in the starting firmware segment, and obtain the firmware segment decryption result;
[0108] The firmware segment decryption and loading unit is used to load the firmware segment decryption result into the processor memory for task processing based on the flash memory read driver and processor memory write interface in the initial firmware segment.
[0109] Optionally, the start firmware segment may include verification information for each functional firmware segment;
[0110] The target function firmware segment loading module 430 includes:
[0111] The verification information acquisition unit is used to acquire the verification information corresponding to the target function firmware segment in the starting firmware segment;
[0112] The firmware segment verification and loading unit is used to load the target function firmware segment into the processor memory for task processing based on the flash memory read driver and processor memory write interface in the starting firmware segment when the verification information passes.
[0113] Optionally, the start firmware segment includes the linker scripts for each functional firmware segment and start and end markers;
[0114] Target function firmware segment lookup module 420 includes:
[0115] The target function firmware segment lookup unit is used to determine the target function firmware segment in the linker script of the starting firmware segment according to the processor's task after the processor starts up, and to determine the storage location of the target function firmware segment in flash memory according to the start and end markers.
[0116] The firmware loading device for the processor provided in this embodiment of the invention can execute the firmware loading method for the processor provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0117] Example 4
[0118] Figure 5 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0119] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) or random access memory (RAM), communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from the storage unit 18. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. Input / output (I / O) interfaces are also connected to the bus 14.
[0120] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0121] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the processor's firmware loading method.
[0122] In some embodiments, the processor firmware loading method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the processor firmware loading method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the processor firmware loading method by any other suitable means (e.g., by means of firmware).
[0123] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0124] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0125] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0126] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0127] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0128] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0129] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0130] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A firmware loading method for a processor, characterized in that, The processor firmware includes a start firmware segment and at least one functional firmware segment; the start firmware segment and each functional firmware segment together constitute a complete program; the functional firmware segment is the smallest unit dynamically loaded by the processor when implementing task processing; when the processor performs task processing, the corresponding functional firmware segment is loaded according to the required function; the start firmware segment includes a flash memory read driver, a processor memory write interface, and call parameter information; the method includes: When the processor is powered on, the start firmware segment is loaded and the processor is started according to the call parameter information; After the processor starts up, the target function firmware segment is located in the processor's firmware according to the processor's task. Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the processor memory for task processing.
2. The method according to claim 1, characterized in that, Loading flag information is set in each of the aforementioned functional firmware segments; Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the processor memory for task processing, including: Based on the loading flag information corresponding to the target function firmware segment, determine whether the target function firmware has been loaded into the processor memory; When the target function firmware is not loaded into the processor memory, the target function firmware segment is loaded into the processor memory for task processing according to the flash read driver and processor memory write interface in the start firmware segment.
3. The method according to claim 1, characterized in that, After loading the target function firmware segment into the processor memory for task processing, the process further includes: When the starting firmware segment indicates that the target function firmware segment is protected content, the target function firmware segment loaded in the processor memory is cleared or set to invalid when the target function firmware segment call ends.
4. The method according to claim 1, characterized in that, The starting firmware segment includes the call frequency information of each functional firmware segment; Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the processor memory for task processing, including: Based on the call frequency information corresponding to the target function firmware segment in the starting firmware segment, the overlay storage information of the target function firmware segment is determined; Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the area of the processor memory corresponding to the overwritten storage information for task processing.
5. The method according to claim 1, characterized in that, Each of the aforementioned functional firmware segments is stored encrypted in flash memory, and the start firmware segment includes the decryption algorithm for each of the aforementioned functional firmware segments; Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the processor memory for task processing, including: The target function firmware segment is decrypted according to the decryption algorithm corresponding to the target function firmware segment in the starting firmware segment, and the firmware segment decryption result is obtained; Based on the flash read driver and processor memory write interface in the initial firmware segment, the decryption result of the firmware segment is loaded into the processor memory for task processing.
6. The method according to claim 1, characterized in that, The start firmware segment includes verification information for each of the functional firmware segments; Based on the flash read driver and processor memory write interface in the starting firmware segment, the target function firmware segment is loaded into the processor memory for task processing, including: Obtain the verification information in the starting firmware segment that corresponds to the target function firmware segment; When the verification information passes, the target function firmware segment is loaded into the processor memory for task processing according to the flash read driver and processor memory write interface in the start firmware segment.
7. The method according to claim 1, characterized in that, The starting firmware segment includes the link scripts for each of the functional firmware segments and start and end markers; After the processor starts up, the target function firmware segment is located in the processor's firmware according to the processor's task, including: After the processor starts, the target functional firmware segment is determined in the linker script of the starting firmware segment according to the processor's task, and the storage location of the target functional firmware segment in the flash memory is determined according to the start and end markers.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and a memory communicatively connected to said at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the firmware loading method of the processor according to any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that are used to cause a processor to execute the firmware loading method of the processor according to any one of claims 1-7.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the firmware loading method of the processor according to any one of claims 1-7.
Citation Information
Patent Citations
Segmented starting method and device of system, storage medium and electronic equipment
CN119806655A
Bootloader linking method, boot loader executing method, boot loader linking device, boot loader executing device, chip, network interface card, computer equipment, readable storage medium and program product
CN120335877A
Sectional loading method and device for firmware in starting process of network set top box
CN120407033A