Firmware operation method and device, electronic equipment and storage medium

By dividing source code files into ordinary and important software code files and generating different file identifiers during compilation and linking, the problem of insufficient memory and low efficiency in firmware operation of consumer electronic devices is solved, achieving memory saving and Flash efficiency improvement, reducing device costs and enhancing user experience.

CN121807322APending Publication Date: 2026-04-07HANGZHOU JIEFENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing consumer electronic devices face the dilemma of insufficient memory and low operating efficiency when running firmware. In particular, firmware consumes too much memory when running on DDR and is inefficient when running on Flash, resulting in high costs and poor user experience.

Method used

The source code files are divided into ordinary software code files and important software code files, and different file identifiers are generated during the compilation and linking process. These are placed in different address segments of Flash and memory respectively. At startup, the ordinary code is read from Flash and the important code is read from memory for execution.

Benefits of technology

It reduces memory usage, improves Flash efficiency, solves the problems of insufficient memory and low operating efficiency, reduces device costs, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121807322A_ABST
    Figure CN121807322A_ABST
Patent Text Reader

Abstract

The invention provides a firmware running method and device, electronic equipment and a storage medium. The firmware running method comprises the steps that a source code file is divided into a common software code file and an important software code file; when the electronic equipment firmware is compiled in the compiling script, the compiler generates file identifiers of the common software code file and the important software code file; the link script respectively puts the common software code file and the important software code file into different loading addresses of a Flash address field based on the file identifier; the link script determines an initial address and an end address of the important software code file in a memory; burning firmware generated by compiling the link to the electronic equipment; when the electronic equipment is started, reading and operating the common software code file from the Flash; and reading and operating the important software code file from the memory. Therefore, the dilemma problems that when the electronic equipment runs in firmware, the memory is insufficient, and when the electronic equipment runs in Flash, the running efficiency is low are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of real-time operating system (RTOS) technology, and in particular to a firmware running method, apparatus, electronic device, and storage medium. Background Technology

[0002] Currently, most consumer electronic devices, whether built-in or external, contain Flash (Flash Memory, hereinafter referred to as Flash) and DDR (Double Data Rate, hereinafter referred to as RAM). Most devices store their firmware in Flash and then decompress it into RAM for booting. A few electronic devices that support booting from Flash have their firmware running directly in Flash.

[0003] However, electronic devices running DDR firmware require ample memory and are relatively memory-intensive. Electronic devices with small memory are not well-suited to this and are prone to memory shortage errors. In many consumer electronics devices, DDR is built into the main controller chip. The price of a main controller with large memory is significantly higher, making such electronic devices relatively expensive and affecting their market competitiveness.

[0004] Furthermore, electronic devices with firmware running on Flash memory suffer from low operating efficiency, sluggish operation, and a poor user experience due to the limitations of Flash's read and write speeds. This is because Flash frequency (currently, Flash read and write frequencies are generally around 100MHz at most) is far lower than the operating frequency of DDR (several thousand MHz). Summary of the Invention

[0005] In view of this, the purpose of the present invention is to provide a firmware running method, apparatus, electronic device and storage medium to solve the dilemma of insufficient memory when the electronic device runs on firmware and low running efficiency when running on Flash.

[0006] In a first aspect, embodiments of the present invention provide a firmware running method, the method comprising: dividing a source code file into a regular software code file and an important software code file; when compiling the firmware of an electronic device within a compilation script, the compiler generates file identifiers for the regular software code file and the important software code file; a linker script places the regular software code file and the important software code file into different load addresses in a Flash address segment based on the file identifiers; the linker script determines the start address and end address of the important software code file in memory; burning the firmware generated by the compilation and linking script to the electronic device; when the electronic device starts up, reading the regular software code file from Flash and executing the regular software code file; and reading the important software code file from memory and executing the important software code file.

[0007] In optional embodiments of this application, the step of dividing the source code file into ordinary software code files and important software code files includes: determining the type identifier and / or execution frequency of the source code file; if the type identifier of the source code file is a non-important file, and / or the execution frequency of the source code file is less than a preset threshold, the source code file is divided into an ordinary software code file; if the type identifier of the source code file is an important file, and / or the execution frequency of the source code file is greater than or equal to the threshold, the source code file is divided into an important software code file.

[0008] In an optional embodiment of this application, the step of the compiler generating file identifiers for ordinary software code files and important software code files includes: the compiler generating a first identifier for the file identifier of the ordinary software code file; and the compiler generating a second identifier for the file identifier of the important software code file.

[0009] In an optional embodiment of this application, the step of the linker script placing ordinary software code files and important software code files into different loading addresses of the Flash address segment based on file identifiers includes: if the file identifier is a first identifier, the linker script places the ordinary software code file into the first loading address of the Flash address segment; if the file identifier is a second identifier, the linker script places the important software code file into the second loading address of the Flash address segment.

[0010] In an optional embodiment of this application, the step of the linker script determining the start and end addresses of the important software code file in memory includes: the linker script determining the start and end addresses of the second load address in memory during runtime.

[0011] In an optional embodiment of this application, after the step of burning the firmware generated by compilation and linking to the electronic device, the method further includes: sequentially initializing Flash and memory when the electronic device starts up.

[0012] In an optional embodiment of this application, the steps of reading and executing ordinary software code files from Flash and reading and executing important software code files from memory when the electronic device starts up include: copying the important software code files from the load address of the Flash address segment to the start and end addresses of memory; reading and executing ordinary software code files from the load address of the Flash address segment; and reading and executing important software code files from the start and end addresses of memory.

[0013] Secondly, embodiments of the present invention also provide a firmware running device, the device comprising: a code file partitioning module, used to partition source code files into ordinary software code files and important software code files; a file identifier generation module, used by the compiler to generate file identifiers for ordinary software code files and important software code files when compiling the firmware of an electronic device within a compilation script; a Flash address segment determination module, used by the linker script to place ordinary software code files and important software code files into different loading addresses of the Flash address segment based on the file identifiers; a memory address determination module, used by the linker script to determine the start address and end address of the important software code files in memory; a firmware burning module, used to burn the firmware generated by compilation and linking to the electronic device; and a code file reading and execution module, used to read and execute ordinary software code files from Flash when the electronic device starts up; and to read and execute important software code files from memory.

[0014] Thirdly, embodiments of the present invention also provide an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the above-described firmware operation method.

[0015] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the aforementioned firmware operation method.

[0016] The embodiments of the present invention bring the following beneficial effects: This invention provides a firmware running method, apparatus, electronic device, and storage medium. The method divides source code files into ordinary software code files and important software code files. When compiling the electronic device firmware within a compilation script, the compiler generates file identifiers for the ordinary and important software code files. The linker script, based on these file identifiers, places the ordinary and important software code files into different load addresses within the Flash address segment. The linker script determines the start and end addresses of the important software code files in memory. The compiled and linked firmware is then burned into the electronic device. Upon startup, the ordinary software code files are read from Flash and executed; simultaneously, the important software code files are read from memory and executed. This approach allows for the reading and execution of ordinary software code files from Flash and important software code files from memory, reducing memory usage and improving Flash efficiency. This solves the dilemma of insufficient memory when running firmware and low efficiency when running Flash.

[0017] Other features and advantages of this disclosure will be set forth in the following description, or some features and advantages may be inferred from the description or determined without doubt, or may be learned by practicing the techniques described above.

[0018] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0019] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0020] Figure 1 A flowchart of a firmware running method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of a firmware running device provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of another firmware running device provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions 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, 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.

[0022] Currently, most consumer electronic devices, whether built-in or external, contain both Flash and DDR memory. Most devices store their firmware in Flash and then decompress it into RAM for booting. A few electronic devices that support booting from Flash have their firmware running directly in Flash.

[0023] However, electronic devices running DDR firmware require ample memory and are relatively memory-intensive. Electronic devices with small memory are not well-suited to this and are prone to memory shortage errors. In many consumer electronics devices, DDR is built into the main controller chip. The price of a main controller with large memory is significantly higher, making such electronic devices relatively expensive and affecting their market competitiveness.

[0024] Furthermore, electronic devices with firmware running on Flash memory suffer from low operating efficiency, sluggish operation, and a poor user experience due to the limitations of Flash's read and write speeds. This is because Flash frequency (currently, Flash read and write frequencies are generally around 100MHz at most) is far lower than the operating frequency of DDR (several thousand MHz).

[0025] Based on this, the present invention provides a firmware running method, apparatus, electronic device, and storage medium, specifically providing a firmware running method applied to RTOS, which can solve the dilemma of insufficient memory when the electronic device runs on firmware and low running efficiency when running on Flash.

[0026] To facilitate understanding of this embodiment, a firmware operation method disclosed in this embodiment of the invention will first be described in detail.

[0027] Example 1: This invention provides a firmware running method, see [link to relevant documentation]. Figure 1 The flowchart shown illustrates a firmware execution method, which includes the following steps: Step S102: Divide the source code files into ordinary software code files and important software code files.

[0028] In this embodiment, the source code files can first be divided into two categories: ordinary software code files and important software code files.

[0029] In some embodiments, the type identifier and / or execution frequency of the source code file can be determined; if the type identifier of the source code file is a non-critical file, and / or the execution frequency of the source code file is less than a preset threshold, the source code file is classified as a normal software code file; if the type identifier of the source code file is a critical file, and / or the execution frequency of the source code file is greater than or equal to the threshold, the source code file is classified as a critical software code file.

[0030] In this embodiment, the source code file can be determined as a regular software code file or an important software code file based on the type identifier and / or execution frequency of the source code file.

[0031] Specifically, source code files identified as non-critical and / or executed less than a threshold can be classified as ordinary software code files; conversely, source code files identified as critical and / or executed more than or equal to a threshold can be classified as critical software code files. For example, critical software code files could be the software code files of critical modules such as basic modules and network modules.

[0032] In step S104, when compiling the firmware of the electronic device within the compilation script, the compiler generates file identifiers for ordinary software code files and important software code files.

[0033] When compiling firmware for electronic devices within a compilation script, the compiler can generate different file identifiers for ordinary software code files and important software code files.

[0034] In some embodiments, the file identifier for ordinary software code files generated by the compiler is the first identifier; the file identifier for important software code files generated by the compiler is the second identifier.

[0035] In this embodiment, the compiler can generate ordinary software code files with the first identifier *.o, and the compiler can also generate important software code files with the second identifier *_runddr.o.

[0036] Step S106: The linker script places ordinary software code files and important software code files into different loading addresses in the Flash address segment based on file identifiers.

[0037] In this embodiment, the linking script can place ordinary software code files and important software code files into different loading addresses in the Flash address range based on file identifiers.

[0038] Load Memory Address (LMA) is a core concept in embedded system and firmware development, referring to the actual storage location when program data is burned to the physical storage medium.

[0039] In some embodiments, if the file is identified by a first identifier, the linker script places the ordinary software code file into the first load address of the Flash address segment; if the file is identified by a second identifier, the linker script places the important software code file into the second load address of the Flash address segment.

[0040] That is, the linker script in this embodiment can put ordinary software code files identified as *.o into the first load address of the Flash address segment, and can also put important software code files identified as *_runddr.o into the second load address of the Flash address segment.

[0041] Step S108: The linker script determines the start and end addresses of important software code files in memory.

[0042] The linker script in this embodiment can also determine the start and end addresses of important software code files in memory.

[0043] The start and end addresses in memory are collectively known as the runtime address (Virtual Memory Address, VMA). The VMA is the logical address in memory where the program's code and data reside during actual execution. The VMA is a core concept in embedded systems and operating systems, determining the actual location in memory accessed by the CPU (Central Processing Unit) when executing instructions.

[0044] In some embodiments, the linker script determines the start and end addresses of the second load address in memory at runtime.

[0045] In this embodiment, the linker script can also determine the start and end addresses in memory when the second load address is executed, based on the predefined second load address.

[0046] Step S110: Burn the firmware generated by compiling and linking to the electronic device.

[0047] In this embodiment, the compiled and linked firmware of an electronic device can be burned into the electronic device.

[0048] Step S112: When the electronic device starts up, read ordinary software code files from Flash and execute them; and read important software code files from memory and execute them.

[0049] In some embodiments, Flash and memory may also be initialized sequentially when the electronic device starts up.

[0050] In this embodiment, the electronic device can boot from Flash first. Specifically, in this embodiment, ordinary software code files and important software code files can be read and run from Flash and memory respectively.

[0051] In some embodiments, important software code files can be copied from the load address of the Flash address segment to the start and end addresses in memory; ordinary software code files can be read from the load address of the Flash address segment and executed; and important software code files can be read from the start and end addresses in memory and executed.

[0052] In this embodiment, after the electronic device boots up and Flash and DDR initialization is complete, important software code files can be copied from the load address of the Flash address segment (i.e., the aforementioned second load address) to the start and end addresses of memory, and then the important software code files can be run. Furthermore, this embodiment can also directly read and run ordinary software code files from the load address of the Flash address segment.

[0053] Therefore, in this embodiment, important and frequently executed instructions (i.e., important software code files) such as basic modules and network modules can be read from memory and run. This not only saves memory by not running all the code in memory, but also ensures the user experience and prevents lag.

[0054] This invention provides a firmware execution method that divides source code files into ordinary software code files and important software code files. When compiling the electronic device firmware within a compilation script, the compiler generates file identifiers for the ordinary and important software code files. The linker script, based on these file identifiers, places the ordinary and important software code files into different load addresses within the Flash address segment. The linker script determines the start and end addresses of the important software code files in memory. The compiled and linked firmware is then burned into the electronic device. Upon startup, the ordinary software code files are read from Flash and executed; simultaneously, the important software code files are read from memory and executed. This method allows for the reading and execution of ordinary software code files from Flash and important software code files from memory, reducing memory usage and improving Flash efficiency. This solves the dilemma of insufficient memory when running firmware and low efficiency when running Flash.

[0055] Example 2: This embodiment provides another firmware running method, which is implemented based on the above embodiment. The focus is on describing the definition of specific code segments within the linker script, as shown in the following code: .text.ddr : { = ALIGN(4); / / Align the current position counter to a 4-byte boundary __text_ddr_start = .; / / Assigns the current address (after alignment) to the symbol __text_ddr_start, as the starting VMA address of this segment. / / The following will put the .text, .text*, and .text.* sections from a specific object file into this output section. *_runddr.o(.text) / / All .text sections in runddr object files *_runddr.o(.text*) / / All .text* sections in runddr object files (may contain some variations) *_runddr.o(.text.*) / / All .text.* segments in runddr object files / / Similarly, for the lib_a-memcpy-asm.o object file *lib_a-memcpy-asm.o(.text) *lib_a-memcpy-asm.o(.text*) *lib_a-memcpy-asm.o(.text.*) __text_ddr_end = .; / / Defines the end VMA address of the segment. }>REGION_TEXT_DDR AT>REGION_TEXT / / The VMA of this segment is in REGION_TEXT_DDR, and the LMA is in REGION_TEXT __text_ddr_load = LOADADDR(.text.ddr); / / Use LOADADDR to get the load address (LMA) of this segment and assign it to __text_ddr_load.

[0056] The method provided in this embodiment of the invention allows the firmware of an electronic device to run partly in Flash and partly in DDR, thereby flexibly utilizing Flash and DDR resources; it can reduce memory occupancy, thus making it applicable to small memory (DDR) electronic devices; and it can also improve the operating efficiency of Flash.

[0057] The method provided by the embodiments of the present invention can not only meet the needs of electronic devices with insufficient memory, but also solve the problem of low firmware efficiency caused by the inherent defect that the operating frequency of Flash is much lower than that of DDR. It provides electronic devices with small memory with a stronger survival space, makes more flexible and full use of Flash and DDR resource allocation, provides customers with market cost competitiveness, and generates better economic benefits.

[0058] Example 3: Corresponding to the above method embodiments, this invention provides a firmware running device, see [link to relevant documentation]. Figure 2 The diagram shows a structural schematic of a firmware running device, which includes: The code file partitioning module 21 is used to divide source code files into ordinary software code files and important software code files; The file identifier generation module 22 is used to generate file identifiers for ordinary software code files and important software code files by the compiler when compiling the firmware of electronic devices within the compilation script. Flash address segment determination module 23 is used to link scripts to place ordinary software code files and important software code files into different loading addresses in the Flash address segment based on file identifiers; The memory address determination module 24 is used by the linker script to determine the start and end addresses of important software code files in memory; Firmware burning module 25 is used to burn the firmware generated by compilation and linking to electronic devices; The code file reading and execution module 26 is used to read and execute ordinary software code files from Flash when the electronic device starts up; and to read and execute important software code files from memory.

[0059] This invention provides a firmware running device that divides source code files into ordinary software code files and important software code files. When compiling the firmware of an electronic device within a compilation script, the compiler generates file identifiers for the ordinary and important software code files. The linker script, based on these file identifiers, places the ordinary and important software code files into different load addresses within the Flash address segment. The linker script determines the start and end addresses of the important software code files in memory. The compiled and linked firmware is then burned into the electronic device. Upon startup, the ordinary software code files are read from Flash and executed; simultaneously, the important software code files are read from memory and executed. This method allows for the reading and execution of ordinary software code files from Flash and important software code files from memory, reducing memory usage and improving Flash efficiency. This solves the dilemma of insufficient memory when running firmware and low efficiency when running Flash.

[0060] The code file segmentation module described above is used to determine the type identifier and / or execution frequency of the source code file. If the type identifier of the source code file is a non-important file, and / or the execution frequency of the source code file is less than a preset threshold, the source code file is segmented into a normal software code file. If the type identifier of the source code file is an important file, and / or the execution frequency of the source code file is greater than or equal to the threshold, the source code file is segmented into an important software code file.

[0061] The file identifier generation module described above uses the first identifier for ordinary software code files generated by the compiler, and the second identifier for important software code files generated by the compiler.

[0062] The aforementioned Flash address segment determination module is used to place ordinary software code files into the first load address of the Flash address segment if the file identifier is the first identifier; and to place important software code files into the second load address of the Flash address segment if the file identifier is the second identifier.

[0063] The aforementioned memory address determination module is used to link the script to determine the start and end addresses in memory when the second load address is executed.

[0064] See Figure 3 The diagram shows another firmware running device, which further includes a Flash and memory initialization module 27 for sequentially initializing Flash and memory when the electronic device starts up.

[0065] The aforementioned code file reading and execution module is used to copy important software code files from the load address of the Flash address segment to the start and end addresses in memory; read ordinary software code files from the load address of the Flash address segment and execute them; and read important software code files from the start and end addresses in memory and execute them.

[0066] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the firmware running device described above can be referred to the corresponding process in the aforementioned embodiments of the firmware running method, and will not be repeated here.

[0067] Example 4: This invention also provides an electronic device for running the above-described firmware running method; see [link to previous document]. Figure 4 The diagram shows the structure of an electronic device, which includes a memory 100 and a processor 101. The memory 100 is used to store one or more computer instructions, which are executed by the processor 101 to implement the firmware operation method described above.

[0068] Furthermore, Figure 4 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 101, the communication interface 103 and the memory 100 connected via the bus 102.

[0069] The memory 100 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0070] Processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 101 or by instructions in software form. Processor 101 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 100, and processor 101 reads information from memory 100 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0071] This invention also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are called and executed by a processor, they cause the processor to implement the aforementioned firmware operation method. For specific implementation details, please refer to the method embodiments, which will not be repeated here.

[0072] The computer program products of the firmware running method, apparatus, electronic device and storage medium provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0073] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and / or device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0074] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0075] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0076] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0077] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A firmware running method, characterized in that, The method includes: Divide the source code files into ordinary software code files and important software code files; When compiling the firmware of an electronic device within a compilation script, the compiler generates file identifiers for the ordinary software code file and the important software code file; The linker script places the ordinary software code file and the important software code file into different loading addresses in the Flash address segment based on the file identifier; The linker script determines the start and end addresses of the important software code file in memory; Burn the firmware generated by compiling and linking to the electronic device; When the electronic device starts up, the ordinary software code file is read from Flash and executed; and the important software code file is read from memory and executed.

2. The method according to claim 1, characterized in that, The steps to divide source code files into ordinary software code files and important software code files include: Determine the type identifier and / or execution frequency of the source code file; If the source code file is identified as a non-critical file, and / or the execution frequency of the source code file is less than a preset threshold, the source code file will be classified as a regular software code file. If the source code file is identified as an important file, and / or the execution frequency of the source code file is greater than or equal to the threshold, the source code file is classified as an important software code file.

3. The method according to claim 1, characterized in that, The steps of the compiler generating file identifiers for the ordinary software code file and the important software code file include: The file identifier of the ordinary software code file generated by the compiler is the first identifier; The file identifier for the important software code file generated by the compiler is the second identifier.

4. The method according to claim 3, characterized in that, The step of linking the script to place the ordinary software code file and the important software code file into different load addresses in the Flash address segment based on the file identifier includes: If the file is identified as the first identifier, the linker script places the ordinary software code file into the first load address of the Flash address segment; If the file is identified as the second identifier, the linker script places the important software code file into the second load address of the Flash address segment.

5. The method according to claim 4, characterized in that, The steps of the linker script to determine the start and end addresses of the important software code file in memory include: The linker script determines the start and end addresses of the second load address in memory during runtime.

6. The method according to claim 1, characterized in that, After the step of burning the firmware generated by compiling and linking to the electronic device, the method further includes: When the electronic device starts up, the Flash and the memory are initialized sequentially.

7. The method according to claim 1, characterized in that, When the electronic device starts up, the ordinary software code file is read from Flash and executed. Furthermore, the steps of reading the important software code file from the memory and executing the important software code file include: The important software code file is copied from the load address of the Flash address segment to the start and end addresses of the memory. The ordinary software code file is read from the load address of the Flash address segment and executed; and the important software code file is read from the start address and end address in the memory and executed.

8. A firmware running device, characterized in that, The device includes: The code file partitioning module is used to divide source code files into ordinary software code files and important software code files; The file identifier generation module is used to generate file identifiers for the ordinary software code files and the important software code files when compiling the firmware of electronic devices within the compilation script. The Flash address segment determination module is used to link the script to place the ordinary software code file and the important software code file into different loading addresses in the Flash address segment based on the file identifier; The memory address determination module is used by the linker script to determine the start and end addresses of the important software code file in memory; Firmware burning module is used to burn the firmware generated by compilation and linking to electronic devices; The code file reading and execution module is used to read the ordinary software code file from Flash and execute the ordinary software code file when the electronic device is started; and to read the important software code file from the memory and execute the important software code file.

9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the firmware running method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the firmware operation method according to any one of claims 1 to 7.