A firmware switching method, device, equipment and medium

By establishing a mapping relationship between virtual addresses and physical addresses under the ARM architecture and using a ping-pong switching method to switch the mapping table, the high complexity of traditional firmware switching is solved, and a simplified firmware switching process is achieved.

CN115129619BActive Publication Date: 2026-03-03INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-28
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

In the process of switching firmware between multiple CPUs under the ARM architecture, especially when performing online upgrades while running SSDs, the traditional method requires that the CPU's IRAM and DRAM areas be divided independently, resulting in high switching complexity.

Method used

By determining the virtual and physical addresses of the current firmware and the firmware to be switched, a mapping relationship is established, and the mapping table is switched using a ping-pong switching method to realize firmware loading and switching, avoiding the independent partitioning of IRAM and DRAM.

Benefits of technology

It reduces the complexity of the firmware switching process, simplifies the online upgrade process, and avoids the requirement for CPU and memory partitioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115129619B_ABST
    Figure CN115129619B_ABST
Patent Text Reader

Abstract

This application discloses a firmware switching method, apparatus, device, and medium, relating to the field of computer technology. The method includes: determining a first virtual address and a target physical address corresponding to the currently used firmware, and determining a second virtual address and a target physical storage address corresponding to the firmware to be switched; loading the current firmware from the first virtual address to the target physical storage address, and loading the firmware to be switched from the second virtual address to the target physical storage address, so as to switch the currently used firmware to the firmware to be switched. Therefore, this application can realize the conversion of the physical address corresponding to the virtual address to achieve the firmware switching process. Since it is not necessary to separately divide the overall CPU's IRAM and DRAM areas, the complexity of firmware switching is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a firmware switching method, apparatus, device, and medium. Background Technology

[0002] Currently, during firmware switching in multi-CPU (central processing unit) architectures under ARM (Advanced RISC Machine, RISC microprocessor) systems, to ensure continuous online upgrades of services while running on SSDs (Solid State Disks), this process involves switching between old and new firmware. The traditional method is to provide a transitional firmware, which requires independently partitioning the CPU's IRAM (Integrated Random Access Memory) and DRAM (Dynamic Random Access Memory) areas, and then using a mini transitional firmware to switch between the old and new firmware. This process is quite complex.

[0003] In conclusion, reducing the complexity of the firmware switching process is an urgent problem to be solved. Summary of the Invention

[0004] In view of this, the purpose of this invention is to provide a firmware switching method, apparatus, device, and medium that can reduce the complexity of the firmware switching process. The specific solution is as follows:

[0005] In a first aspect, this application discloses a firmware switching method, including:

[0006] Determine the first virtual address and target physical address corresponding to the current firmware in use, and determine the second virtual address and target storage physical address corresponding to the firmware to be switched;

[0007] The current firmware is loaded from the first virtual address to the target storage physical address, and the firmware to be switched is loaded from the second virtual address to the target usage physical address, so as to switch the current firmware into the firmware to be switched.

[0008] Optionally, determining the first virtual address and target physical address corresponding to the currently used firmware, and determining the second virtual address and target storage physical address corresponding to the firmware to be switched, includes:

[0009] Determine the first virtual address and target physical address corresponding to the current firmware in use, and determine the second virtual address and target storage physical address corresponding to the firmware to be switched;

[0010] Establish a preset mapping table that includes the mapping relationship between the first virtual address and the target physical address and the mapping relationship between the second virtual address and the target storage physical address, and establish a target mapping table that includes the mapping relationship between the first virtual address and the target storage physical address and the mapping relationship between the second virtual address and the target physical address.

[0011] Optionally, loading the current firmware from the first virtual address to the target storage physical address, and loading the firmware to be switched from the second virtual address to the target usage physical address, so as to switch the currently used firmware to the firmware to be switched, includes:

[0012] Switch the currently used preset mapping table to the target mapping table;

[0013] Based on the target mapping table, the current firmware is loaded from the first virtual address to the target storage physical address, and the firmware to be switched is loaded from the second virtual address to the target usage physical address, so as to switch the current firmware into the firmware to be switched.

[0014] Optionally, switching the currently used preset mapping table to the target mapping table includes:

[0015] According to the preset mapping table ping-pong switching method, the currently used preset mapping table is switched to the target mapping table.

[0016] Optionally, determining the second virtual address and target storage physical address corresponding to the firmware to be switched includes:

[0017] If the firmware to be switched does not exist in the virtual address space, the firmware to be switched is stored in the second virtual address, and the target storage physical address corresponding to the second virtual address is determined.

[0018] Optional, also includes:

[0019] If there is common data between the current firmware and the firmware to be switched, then the common data is stored in a virtual legacy data area that is different from the second virtual address and the first virtual address.

[0020] Optionally, before loading the current firmware from the first virtual address to the target storage physical address and loading the firmware to be switched from the second virtual address to the target usage physical address, the method further includes:

[0021] If the firmware to be switched exists in the target storage physical address, then delete the firmware to be switched in the target storage physical address, and delete the current firmware in the target used physical address.

[0022] Secondly, this application discloses a firmware switching device, comprising:

[0023] The address determination module is used to determine the first virtual address and the target physical address corresponding to the currently used firmware, and to determine the second virtual address and the target storage physical address corresponding to the firmware to be switched.

[0024] The firmware switching module is used to load the current firmware from the first virtual address to the target storage physical address, and load the firmware to be switched from the second virtual address to the target usage physical address, so as to switch the current firmware in use to the firmware to be switched.

[0025] Thirdly, this application discloses an electronic device, including a processor and a memory; wherein the processor implements the aforementioned firmware switching method using a computer program stored in the memory.

[0026] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is used by a processor, it implements the aforementioned disclosed firmware switching method.

[0027] As can be seen, this application determines the first virtual address and the target physical address corresponding to the currently used firmware, and determines the second virtual address and the target storage physical address corresponding to the firmware to be switched. The current firmware is loaded from the first virtual address to the target storage physical address, and the firmware to be switched is loaded from the second virtual address to the target physical address, so as to switch the currently used firmware to the firmware to be switched. Therefore, this application loads the firmware from the virtual address to the corresponding physical address (including the target physical address and the target storage physical address), which can realize the corresponding physical address conversion to achieve the firmware switching process. Since it is not necessary to separately divide the overall CPU's IRAM and DRAM areas, the complexity of firmware switching is reduced. Attached Figure Description

[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0029] Figure 1 A flowchart of a firmware switching method provided in this application;

[0030] Figure 2 A flowchart of a specific firmware switching method provided in this application;

[0031] Figure 3 This application provides a pre-defined mapping representation.

[0032] Figure 4 This application provides an intentional representation of a target mapping.

[0033] Figure 5 A schematic diagram of a mapping table switching provided in this application;

[0034] Figure 6 A schematic diagram of a firmware switching device provided in this application;

[0035] Figure 7 This application provides a structural diagram of an electronic device. Detailed Implementation

[0036] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention.

[0037] Currently, the traditional firmware switching method is to provide a mini transition firmware, which requires the CPU's IRAM (Integrated Random Access Memory) and DRAM (Dynamic Random Access Memory) areas to be divided independently, and then the new and old firmware are switched using the mini transition firmware. This process is quite complex.

[0038] To overcome the above problems, this application provides a firmware switching scheme that can reduce the complexity of the firmware switching process.

[0039] See Figure 1 As shown in the figure, this application discloses a firmware switching method, which includes:

[0040] Step S11: Determine the first virtual address and target physical address corresponding to the current firmware in use, and determine the second virtual address and target storage physical address corresponding to the firmware to be switched.

[0041] In this embodiment, a corresponding virtual address space and physical address space may be set, and the firmware located at the target physical address is set to be the firmware in use, while the firmware not in use may be located at the target storage physical address.

[0042] In this embodiment, determining the second virtual address and target physical storage address corresponding to the firmware to be switched includes: if the firmware to be switched does not exist in the virtual address space, then the firmware to be switched is stored in the second virtual address, and the target physical storage address corresponding to the second virtual address is determined. Specifically, if firmware switching is required, the second firmware needs to be saved to the virtual address.

[0043] It should be noted that if common data exists between the current firmware and the firmware to be switched, this common data is stored in a virtual legacy data area that is distinct from the second virtual address and the first virtual address. In this case, only one loading of the common data from the virtual legacy data area into the legacy data area, which is distinct from the target storage physical address and the target used physical address, is required, because the common data has not changed. It should also be noted that the common data between the current firmware and the firmware to be switched must be stored in a special program segment called the carry-over legacy data area. The carry-over data area is designed so that common data does not need to be copied when the firmware is reloaded from the current firmware to the firmware to be switched.

[0044] Step S12: Load the current firmware from the first virtual address to the target storage physical address, and load the firmware to be switched from the second virtual address to the target usage physical address, so as to switch the current firmware in use to the firmware to be switched.

[0045] In this embodiment of the application, the current firmware is the firmware that is in use. Firmware switching is to switch the current firmware that is in use to the firmware to be switched. Since the firmware in the target physical address is the firmware that is in use, the current firmware is loaded from the first virtual address to the target physical address, and the firmware to be switched is loaded from the second virtual address to the target physical address, so as to switch the current firmware that is in use to the firmware to be switched.

[0046] It should be noted that before loading the current firmware from the first virtual address to the target storage physical address and loading the firmware to be switched from the second virtual address to the target usage physical address, the method further includes: if the firmware to be switched exists in the target storage physical address, then delete the firmware to be switched in the target storage physical address and delete the current firmware in the target usage physical address.

[0047] As can be seen, this application determines the first virtual address and the target physical address corresponding to the currently used firmware, and determines the second virtual address and the target storage physical address corresponding to the firmware to be switched. The current firmware is loaded from the first virtual address to the target storage physical address, and the firmware to be switched is loaded from the second virtual address to the target physical address, so as to switch the currently used firmware to the firmware to be switched. Therefore, this application loads the firmware from the virtual address to the corresponding physical address (including the target physical address and the target storage physical address), which can realize the corresponding physical address conversion to achieve the firmware switching process. Since it is not necessary to separately divide the overall CPU's IRAM and DRAM areas, the complexity of firmware switching is reduced.

[0048] See Figure 2 As shown in the figure, this application discloses a specific firmware switching method, which includes:

[0049] Step S21: Determine the first virtual address and target physical address corresponding to the current firmware in use, and determine the second virtual address and target storage physical address corresponding to the firmware to be switched.

[0050] In this embodiment, a corresponding virtual address space and physical address space may be set, and the firmware located at the target physical address is set to be the firmware in use, while the firmware not in use may be located at the target storage physical address.

[0051] In this embodiment, determining the second virtual address and target physical storage address corresponding to the firmware to be switched includes: if the firmware to be switched does not exist in the virtual address space, then the firmware to be switched is stored in the second virtual address, and the target physical storage address corresponding to the second virtual address is determined. Specifically, if firmware switching is required, the second firmware needs to be saved to the virtual address.

[0052] It should be noted that if common data exists between the current firmware and the firmware to be switched, this common data is stored in a virtual legacy data area that is distinct from the second virtual address and the first virtual address. In this case, only one loading of the common data from the virtual legacy data area into the legacy data area, which is distinct from the target storage physical address and the target used physical address, is required, because the common data has not changed. It should also be noted that the common data between the current firmware and the firmware to be switched must be stored in a special program segment called the carry-over legacy data area. The carry-over data area is designed so that when the firmware is reloaded from the current firmware to the firmware to be switched (i.e., the mapping table used is changed from the preset mapping table to the target mapping table), common data does not need to be copied.

[0053] Step S22: Establish a preset mapping table including the mapping relationship between the first virtual address and the target physical address and the mapping relationship between the second virtual address and the target storage physical address, and establish a target mapping table including the mapping relationship between the first virtual address and the target storage physical address and the mapping relationship between the second virtual address and the target physical address.

[0054] In this embodiment of the application, a preset mapping table is established, including the mapping relationship between the first virtual address and the target physical address, and the mapping relationship between the second virtual address and the target storage physical address. A target mapping table is also established, including the mapping relationship between the first virtual address and the target storage physical address, and the mapping relationship between the second virtual address and the target physical address. It should be noted that the preset mapping table is as follows: Figure 3The diagram shows the mapping table when the current firmware is in use. NewFW is the firmware to be switched, OldFW is the current firmware, Read-Only Memory (ROM) can be ROW, BRAM can be considered a memory area (register), TTB0 and TTB1 are the base addresses of general-purpose registers, Code is the code area storing the specific code content, the legacy data area is Carry-over, and system data is System Data. As shown in the diagram, the current firmware is located at virtual address 0x8000_0000, the firmware to be switched is located at virtual address 0x8400_0000, the current firmware is loaded to physical address 0x8000_0000, and the firmware to be switched is recorded to physical address 0x8400_0000. The legacy data area is located at virtual address 0x8200_0000 and also at physical address 0x8200_0000. At this time, the firmware in use is the current firmware. It should be noted that the content loaded to the physical address includes the contents of TTB0 and TTB1, the Code content, and Data. It should be noted that the target mapping table is as follows: Figure 4 The diagram shows the mapping table when the firmware to be switched is in use. A Function Unit Register may exist between the BRAM register and TTB0 and TTB1. As shown, the current firmware is located at virtual address 0x8000_0000, and the firmware to be switched is located at virtual address 0x8400_0000. The current firmware is loaded to physical address 0x8400_0000, and the firmware to be switched is recorded at physical address 0x8000_0000. At this time, the firmware in use is the firmware to be switched. It should be noted that the firmware starts running from 0x8000_0000, and the currently running firmware is the firmware to be switched. Furthermore, 0x8000_0000, 0x8200_0000, and 0x8400_0000 are just examples of addresses; specific addresses are not specifically limited here.

[0055] Step S23: Switch the currently used preset mapping table to the target mapping table.

[0056] In this embodiment, switching the currently used preset mapping table to the target mapping table includes: switching the currently used preset mapping table to the target mapping table according to a preset mapping table ping-pong switching method. It should be noted that in the ARM CPU architecture, two mapping tables (also called translation tables) are established: one for the current firmware and one for the firmware to be switched. Each mapping table provides a different system memory view. The mapping tables are implemented to map the contents of the same virtual memory to physically different memory locations. When the firmware is updated from the current firmware to the firmware to be switched, the current mapping table switches to the other mapping table in a ping-pong manner. Each firmware image has a physically different DRAM region. Specifically, as shown... Figure 5 As shown, the preset mapping table and the target mapping table can be switched between each other; in the preset mapping table (OldFW mapping table), virtual address 0x8000_0000 corresponds to physical address 0x8000_0000, and virtual address 0x8400_0000 corresponds to physical address 0x8400_0000; in the target mapping table (NewFw mapping table), virtual address 0x8000_0000 corresponds to physical address 0x8400_0000, and virtual address 0x8400_0000 corresponds to physical address 0x8000_0000; where fwSwitch.s and fwSwitch2.s are the switching execution libraries, and restartCPU() and restartCPU2() are the specific switching execution modules in the switching execution libraries.

[0057] Step S24: Based on the target mapping table, load the current firmware from the first virtual address to the target storage physical address, and load the firmware to be switched from the second virtual address to the target usage physical address, so as to switch the current firmware in use to the firmware to be switched.

[0058] In this embodiment of the application, the current firmware is the firmware that is in use. Firmware switching is to switch the current firmware that is in use to the firmware to be switched. Since the firmware in the target physical address is the firmware that is in use, the current firmware is loaded from the first virtual address to the target physical address, and the firmware to be switched is loaded from the second virtual address to the target physical address, so as to switch the current firmware that is in use to the firmware to be switched.

[0059] It should be noted that before loading the current firmware from the first virtual address to the target storage physical address and loading the firmware to be switched from the second virtual address to the target usage physical address, the method further includes: if the firmware to be switched exists in the target storage physical address, then delete the firmware to be switched in the target storage physical address and delete the current firmware in the target usage physical address.

[0060] In this embodiment, based on the target mapping table, the current firmware is loaded from the first virtual address to the target storage physical address, and the firmware to be switched is loaded from the second virtual address to the target usage physical address, so as to switch the currently used firmware to the firmware to be switched. Specifically, the current firmware in virtual address 0x8000_0000 is loaded into physical address 0x8400_0000, and the firmware to be switched in virtual address 0x8400_0000 is loaded into physical address 0x8000_0000. It should be noted that the firmware in physical address 0x8000_0000 is put into use, which means that physical address 0x8000_0000 is considered the target usage physical address, and physical address 0x8400_0000 is the target storage physical address.

[0061] This application provides a Ping-Pang core-switching method for firmware upgrades of SSDs under multi-core CPUs on ARM. By providing different mapping tables, the same virtual machine address is mapped to different physical memory (addresses), enabling continuous online service upgrades. This method avoids the use of transitional firmware for continuous online service upgrades (NDU, Non-disruptive Upgrade) and also avoids the separate partitioning of the overall CPU's IRAM and DRAM areas, thus simplifying the implementation complexity.

[0062] As can be seen, this application determines the first virtual address and target physical address corresponding to the currently used firmware, and determines the second virtual address and target storage physical address corresponding to the firmware to be switched; it establishes a preset mapping table including the mapping relationship between the first virtual address and the target physical address, and a target mapping table including the mapping relationship between the second virtual address and the target storage physical address; it switches the currently used preset mapping table to the target mapping table; based on the target mapping table, it loads the current firmware from the first virtual address to the target storage physical address, and loads the firmware to be switched from the second virtual address to the target physical address, so as to switch the currently used firmware to the firmware to be switched. Therefore, this application, by establishing a mapping table and loading the firmware from the virtual address to the corresponding physical address through mapping table switching, can realize the corresponding physical address conversion to achieve the firmware switching process. Since it is not necessary to separately divide the overall CPU's IRAM and DRAM areas, the complexity of firmware switching is reduced.

[0063] See Figure 6 As shown in the figure, this application discloses a firmware switching device, including:

[0064] Address determination module 11 is used to determine the first virtual address and the target physical address corresponding to the current firmware in use, and to determine the second virtual address and the target storage physical address corresponding to the firmware to be switched.

[0065] The firmware switching module 12 is used to load the current firmware from the first virtual address to the target storage physical address, and load the firmware to be switched from the second virtual address to the target usage physical address, so as to switch the current firmware in use to the firmware to be switched.

[0066] As can be seen, this application determines the first virtual address and the target physical address corresponding to the currently used firmware, and determines the second virtual address and the target storage physical address corresponding to the firmware to be switched. The current firmware is loaded from the first virtual address to the target storage physical address, and the firmware to be switched is loaded from the second virtual address to the target physical address, so as to switch the currently used firmware to the firmware to be switched. Therefore, this application loads the firmware from the virtual address to the corresponding physical address (including the target physical address and the target storage physical address), which can realize the corresponding physical address conversion to achieve the firmware switching process. Since it is not necessary to separately divide the overall CPU's IRAM and DRAM areas, the complexity of firmware switching is reduced.

[0067] In some embodiments, the address determination module 11 includes:

[0068] The address determination unit is used to determine the first virtual address and the target physical address corresponding to the currently used firmware, and to determine the second virtual address and the target storage physical address corresponding to the firmware to be switched.

[0069] The mapping table establishment module is used to establish a preset mapping table including the mapping relationship between the first virtual address and the target physical address and the mapping relationship between the second virtual address and the target storage physical address, and to establish a target mapping table including the mapping relationship between the first virtual address and the target storage physical address and the mapping relationship between the second virtual address and the target physical address;

[0070] In some embodiments, the firmware switching module 12 includes:

[0071] A mapping table switching unit is used to switch the currently used preset mapping table to the target mapping table;

[0072] A firmware switching unit is configured to load the current firmware from the first virtual address to the target storage physical address based on the target mapping table, and load the firmware to be switched from the second virtual address to the target usage physical address, so as to switch the currently used firmware to the firmware to be switched.

[0073] The mapping table switching unit includes:

[0074] The mapping table switching subunit is used to switch the currently used preset mapping table to the target mapping table according to a preset mapping table ping-pong switching method.

[0075] In some embodiments, the address determination module includes:

[0076] The address determination subunit is used to store the firmware to be switched to a second virtual address if the firmware to be switched does not exist in the virtual address space, and to determine the target storage physical address corresponding to the second virtual address.

[0077] In some embodiments, the firmware switching device further includes:

[0078] A general data storage unit is used to store the general data between the current firmware and the firmware to be switched into a virtual legacy storage data area that is different from the second virtual address and the first virtual address if general data exists between the current firmware and the firmware to be switched.

[0079] In some embodiments, the firmware switching device further includes:

[0080] The deletion unit is configured to delete the firmware to be switched in the target storage physical address and delete the current firmware in the target used physical address if the firmware to be switched exists in the target storage physical address.

[0081] Furthermore, embodiments of this application also provide an electronic device. Figure 7 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.

[0082] Figure 7 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, an input / output interface 24, a communication interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and used by the processor 21 to implement the following steps:

[0083] Determine the first virtual address and target physical address corresponding to the current firmware in use, and determine the second virtual address and target storage physical address corresponding to the firmware to be switched;

[0084] The current firmware is loaded from the first virtual address to the target storage physical address, and the firmware to be switched is loaded from the second virtual address to the target usage physical address, so as to switch the current firmware into the firmware to be switched.

[0085] In some specific embodiments, the processor executes a computer program stored in the memory, specifically implementing the following steps:

[0086] Determine the first virtual address and target physical address corresponding to the current firmware in use, and determine the second virtual address and target storage physical address corresponding to the firmware to be switched;

[0087] Establish a preset mapping table that includes the mapping relationship between the first virtual address and the target physical address and the mapping relationship between the second virtual address and the target storage physical address, and establish a target mapping table that includes the mapping relationship between the first virtual address and the target storage physical address and the mapping relationship between the second virtual address and the target physical address.

[0088] In some specific embodiments, the processor executes a computer program stored in the memory, specifically implementing the following steps:

[0089] Switch the currently used preset mapping table to the target mapping table;

[0090] Based on the target mapping table, the current firmware is loaded from the first virtual address to the target storage physical address, and the firmware to be switched is loaded from the second virtual address to the target usage physical address, so as to switch the current firmware into the firmware to be switched.

[0091] In some specific embodiments, the processor executes a computer program stored in the memory, specifically implementing the following steps:

[0092] According to the preset mapping table ping-pong switching method, the currently used preset mapping table is switched to the target mapping table.

[0093] In some specific embodiments, the processor executes a computer program stored in the memory, specifically implementing the following steps:

[0094] If the firmware to be switched does not exist in the virtual address space, the firmware to be switched is stored in the second virtual address, and the target storage physical address corresponding to the second virtual address is determined.

[0095] In some specific embodiments, the processor executes a computer program stored in the memory, specifically implementing the following steps:

[0096] If there is common data between the current firmware and the firmware to be switched, then the common data is stored in a virtual legacy data area that is different from the second virtual address and the first virtual address.

[0097] In some specific embodiments, the processor executes a computer program stored in the memory, specifically implementing the following steps:

[0098] If the firmware to be switched exists in the target storage physical address, then delete the firmware to be switched in the target storage physical address, and delete the current firmware in the target used physical address.

[0099] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 25 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 24 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0100] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The memory 22 can be a random access memory that can be used as running memory and a non-volatile memory used for external memory storage. The storage resources on it include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0101] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 on the source host and the computer program 222. The operating system 221 can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to perform the firmware switching method used by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program that can be used to perform other specific tasks.

[0102] In this embodiment, the input / output interface 24 may include, but is not limited to, a USB interface, a hard disk read interface, a serial interface, a voice input interface, a fingerprint input interface, etc.

[0103] Furthermore, embodiments of this application also disclose a computer-readable storage medium for storing a computer program; wherein, when the computer program is used by a processor, it implements the aforementioned disclosed firmware switching method.

[0104] For the specific steps of this method, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0105] The computer-readable storage medium referred to herein includes random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, magnetic disks, optical disks, or any other form of storage medium known in the art. The computer program, when used by a processor, implements the aforementioned firmware switching method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.

[0106] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the firmware switching method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0107] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are used in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0108] The steps of the algorithm described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, software modules used by a processor, or a combination of both. The software modules can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the art.

[0109] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0110] The firmware switching method, apparatus, device, and medium provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A firmware switching method, characterized in that, include: Determine the first virtual address and target physical address corresponding to the current firmware in use, and determine the second virtual address and target storage physical address corresponding to the firmware to be switched; The current firmware is loaded from the first virtual address to the target storage physical address, and the firmware to be switched is loaded from the second virtual address to the target usage physical address, so as to switch the current firmware in use to the firmware to be switched; Correspondingly, it also includes: If there is common data between the current firmware and the firmware to be switched, then the common data is stored in a virtual legacy data area that is different from the second virtual address and the first virtual address.

2. The firmware switching method according to claim 1, characterized in that, The process of determining the first virtual address and target physical address corresponding to the currently used firmware, and determining the second virtual address and target storage physical address corresponding to the firmware to be switched, includes: Determine the first virtual address and target physical address corresponding to the current firmware in use, and determine the second virtual address and target storage physical address corresponding to the firmware to be switched; Establish a preset mapping table that includes the mapping relationship between the first virtual address and the target physical address and the mapping relationship between the second virtual address and the target storage physical address, and establish a target mapping table that includes the mapping relationship between the first virtual address and the target storage physical address and the mapping relationship between the second virtual address and the target physical address.

3. The firmware switching method according to claim 2, characterized in that, The step of loading the current firmware from the first virtual address to the target storage physical address, and loading the firmware to be switched from the second virtual address to the target usage physical address, so as to switch the currently used firmware to the firmware to be switched, includes: Switch the currently used preset mapping table to the target mapping table; Based on the target mapping table, the current firmware is loaded from the first virtual address to the target storage physical address, and the firmware to be switched is loaded from the second virtual address to the target usage physical address, so as to switch the current firmware into the firmware to be switched.

4. The firmware switching method according to claim 3, characterized in that, The step of switching the currently used preset mapping table to the target mapping table includes: According to the preset mapping table ping-pong switching method, the currently used preset mapping table is switched to the target mapping table.

5. The firmware switching method according to claim 1, characterized in that, Determining the second virtual address and target storage physical address corresponding to the firmware to be switched includes: If the firmware to be switched does not exist in the virtual address space, the firmware to be switched is stored in the second virtual address, and the target storage physical address corresponding to the second virtual address is determined.

6. The firmware switching method according to any one of claims 1 to 5, characterized in that, Before loading the current firmware from the first virtual address to the target storage physical address, and loading the firmware to be switched from the second virtual address to the target usage physical address, the method further includes: If the firmware to be switched exists in the target storage physical address, then delete the firmware to be switched in the target storage physical address, and delete the current firmware in the target used physical address.

7. A firmware switching device, characterized in that, include: The address determination module is used to determine the first virtual address and the target physical address corresponding to the currently used firmware, and to determine the second virtual address and the target storage physical address corresponding to the firmware to be switched. A firmware switching module is used to load the current firmware from the first virtual address to the target storage physical address, and load the firmware to be switched from the second virtual address to the target used physical address, so as to switch the current firmware in use to the firmware to be switched; Correspondingly, it also includes: If there is common data between the current firmware and the firmware to be switched, then the common data is stored in a virtual legacy data area that is different from the second virtual address and the first virtual address.

8. An electronic device, characterized in that, It includes a processor and a memory; wherein the processor implements the firmware switching method as described in any one of claims 1 to 6 when using a computer program stored in the memory.

9. A computer-readable storage medium, characterized in that, Used to store a computer program; wherein, when used by a processor, the computer program implements the firmware switching method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • BIOS updating method and device under Linux operating system

    CN110858145A

  • Method and apparatus for running process

    WO2022001506A1