Electric energy meter extension module architecture generation method and device, extension module and medium
By creating and configuring the boot program code and application code projects respectively in the electric energy meter expansion module, the problem that the Boot code and the App code cannot share common library functions is solved, and the normal upgrade process of the electric energy meter expansion module is realized.
Patent Information
- Application Number
- CN202411194621.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-09-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the expansion module of the electric energy meter, the Boot code and the App code cannot share common library functions. As a result, the shared function code may be erased during the upgrade process, affecting the normal operation of the Boot and App, causing the upgrade to fail.
Create independent bootstrap code projects and application code projects respectively, store and configure the jump from bootstrap code to application code, and copy and store the bootstrap code in the application code project to generate an application containing bootstrap code The program code project allows the boot program code and the application code to coexist in the same project to implement separate calls to common library functions.
The Boot code and the App code respectively call the public library functions to ensure that the normal operation of the boot program code is not affected during the upgrade and ensure the normal upgrade process of the electric energy meter expansion module.
Smart Images

Figure CN118708167A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electric energy metering, and in particular to a method, device, extension module and medium for generating an electric energy meter extension module architecture. Background Art
[0002] The dual-core energy meter is an IoT energy meter, which consists of a management module, a metering module and an expansion module. The expansion module includes functions such as a load identification module and a power quality module. To facilitate technical updates, the module must have a remote upgrade function, and the program must not be abnormal during the upgrade.
[0003] The extension module supports the upgrade function. The module program needs to allocate the bootstrap (Boot) code and the application (Application, App) code; when upgrading, the Boot code is run to erase the App code line by line and write the new App code. Since the public library functions cannot be located in the code intervals of Boot and App respectively, they will share the same function code. This may cause these shared function codes to be erased when the Boot code erases the App code during the upgrade process, thus affecting the normal operation of Boot and App. If the public library function code called by Boot is accidentally erased during the upgrade process, the Boot module will run abnormally. This will make the upgrade process unable to continue.
[0004] In view of the above problems, how to solve the problem that the Boot code and App code in the extension module cannot share common library functions, affecting the App code upgrade process, is an urgent problem to be solved by technicians in this field. Summary of the invention
[0005] The purpose of this application is to provide a method, device, extension module and medium for generating an electric energy meter extension module architecture, so as to solve the problem that the Boot code and App code in the extension module cannot share common library functions, thus affecting the app code upgrade process.
[0006] In order to solve the above technical problems, the present application provides a method for generating an electric energy meter extension module architecture, which is applied to an electric energy meter extension module; the method comprises: Creating a bootstrap code project and an application code project respectively; wherein the bootstrap code of the bootstrap code project and the application code of the application code project respectively contain corresponding public library functions; storing the boot program code and the application program code respectively, and configuring a jump from the boot program code to the application program code; The boot program code is copied and stored in a code space before the application code in the application code project to generate the application code project including the boot program code.
[0007] On the one hand, the creating of the boot program code project and the application program code project separately includes: generating the boot program code and the application program code respectively; storing the boot program code in a code space before a preset position in the boot program code project; The application code is stored in a code space after the preset position in the application code project.
[0008] On the other hand, the storing the boot program code and the application code separately and configuring the jump of the boot program code to the application code includes: Respectively obtain a first link file of the boot program code project and a second link file of the application program code project; storing the boot program code in the initial operation space of the controller according to the first link file; storing the application code in a code space after the initial running space of the controller according to the second link file; The entry function of the application code project is relocated to the end address of the starting execution space to configure a jump to the application code.
[0009] On the other hand, copying and storing the boot program code in the code space before the application code in the application code project includes: Compiling the boot program code into a text array; wherein the size of the text array is the same as the size of the code space before the preset position in the application code project; The text array is copied and stored in the code space before the preset position in the application code project.
[0010] On the other hand, after generating the application code project including the boot program code, the method further includes: Run the boot program code according to the test instruction; Determining whether the boot program code is running normally; If the boot program code does not run normally, output a first warning message; If the boot program code runs normally, then when the boot program code is finished running, jump to run the application code; Determining whether the application code is running normally; If the application code does not run normally, output a second warning message; If the application code runs normally, it is confirmed that the operation architecture of the electric energy meter extension module is generated correctly, and the process ends.
[0011] On the other hand, it also includes: Monitoring application upgrade instructions transmitted by the host computer through the application code; When the application code receives the application upgrade instruction, it stores the application upgrade instruction and triggers the reset of the electric energy meter expansion module; When the electric energy meter expansion module is restarted, detecting whether there is an application upgrade instruction through the boot program code; If there is an application upgrade instruction, the application code is upgraded through the boot program code according to the application upgrade instruction.
[0012] On the other hand, if there is no application upgrade instruction, it also includes: An application upgrade request is sent to a host computer through the application code, so that the host computer can send an application upgrade instruction to the application again according to the application upgrade request.
[0013] In order to solve the above technical problems, the present application also provides an electric energy meter extension module architecture generation device, which is applied to the electric energy meter extension module; the device comprises: A creation module is used to create a bootstrap code project and an application code project respectively; wherein the bootstrap code of the bootstrap code project and the application code of the application code project respectively contain corresponding public library functions; A storage module, used to store the boot program code and the application code respectively, and configure the jump from the boot program code to the application code; The copy module is used to copy and store the boot program code in the code space before the application code in the application code project to generate the application code project including the boot program code.
[0014] In order to solve the above technical problems, the present application also provides an electric energy meter expansion module, including: Memory for storing computer programs; The processor is used to implement the steps of the above-mentioned method for generating the electric energy meter extension module architecture when executing the computer program.
[0015] In order to solve the above technical problems, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for generating an electric energy meter expansion module architecture are implemented.
[0016] The method for generating the electric energy meter extension module architecture provided in the present application is applied to the electric energy meter extension module. Specifically, a bootstrap code project and an application code project are created respectively; wherein the bootstrap code of the bootstrap code project and the application code of the application code project respectively contain corresponding public library functions; the bootstrap code and the application code are stored respectively, and the jump of the bootstrap code to the application code is configured; the bootstrap code is copied and stored in the code space before the application code in the application code project to generate an application code project containing the bootstrap code. It can be seen that this scheme creates a bootstrap code project and an application code project that are independent of each other, and both projects contain public library functions. The bootstrap code and the application code are stored and the jump of the bootstrap code to the application code is configured, and finally the bootstrap code is copied and stored in the code space before the application code in the application code project, so that the bootstrap code and the application code coexist in the same project, which not only realizes the separate calls of the bootstrap code and the application code to the public library functions, but also realizes the fusion of the two sets of project codes, which can ensure that when the bootstrap code is upgraded and the application code is erased, the normal operation of the bootstrap code is not affected.
[0017] In addition, the present application also provides an electric energy meter extension module architecture generation device, an extension module and a medium, with the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A flowchart of a method for generating an electric energy meter expansion module architecture provided in an embodiment of the present application; Figure 2 A schematic diagram of an electric energy meter expansion module operation architecture provided in an embodiment of the present application; Figure 3 A schematic diagram of a device for generating an electric energy meter expansion module architecture provided in an embodiment of the present application; Figure 4 A schematic diagram of an electric energy meter expansion module provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0021] The core of this application is to provide a method, device, extension module and medium for generating an electric energy meter extension module architecture to solve the problem that the Boot code and App code in the extension module cannot share common library functions, affecting the App code upgrade process.
[0022] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0023] At present, since the common library functions cannot be located in the code intervals of Boot and App respectively, they will share the same function code. This may result in that during the upgrade process, when the Boot code erases the App code, these shared function codes may also be erased, thereby affecting the normal operation of Boot and App. If the common library function code called by Boot is accidentally erased during the upgrade process, the Boot module will run abnormally. This will make the upgrade process unable to continue. In order to solve the above problems, the present application provides a method for generating an electric energy meter extension module architecture. It can be understood that the method provided in the present application is applied to an electric energy meter extension module.
[0024] Figure 1 A flowchart of a method for generating an electric energy meter expansion module architecture provided in an embodiment of the present application. Figure 1 As shown, the method includes: S10: Create a boot program code project and an application program code project respectively; The bootstrap code of the bootstrap code project and the application code of the application code project respectively include corresponding public library functions.
[0025] First, you need to create two independent Boot code projects and App code projects respectively.
[0026] The goal of Boot code engineering is to develop and maintain the boot code of the system or device. This includes writing and optimizing the code used to initialize the hardware, load the operating system, or perform other critical startup tasks. The development process of Boot code engineering usually includes steps such as requirements analysis, hardware initialization design, boot process design, code writing, and debugging. Its focus includes the system's startup speed, stability, resource usage, and compatibility. The goal of App code engineering is to develop and maintain applications on the system or device. This includes designing user interfaces, implementing business logic, and handling functions such as data storage and network communication. The development process of App code engineering usually includes steps such as requirements analysis, user interface design, functional module development, integration testing, and release. Its focus includes user experience, functional integrity, performance optimization, and security.
[0027] A shared library function is a set of functions that can be shared by multiple applications or modules. These functions are usually encapsulated in a dynamic link library (DLL) or a static library (LIB) so that they can be reused in different projects.
[0028] It should be noted that in this embodiment, the Boot code project and the App code project respectively include corresponding public library functions. In other words, the Boot code project and the App code project are independent of each other, and the two public library functions are also independent of each other. In this embodiment, the specific process of creating the Boot code project and the App code project is not limited, and it depends on the specific implementation situation.
[0029] S11: Store the boot program code and the application program code separately, and configure the jump from the boot program code to the application program code.
[0030] Furthermore, the Boot code and the App code are stored separately, and the jump from the Boot code to the App code is configured.
[0031] It should be noted that in a computer system or embedded device, the main purpose of the Boot code is to start the system and load the application or operating system. The Boot code is usually located at the beginning of the storage device and is executed first when the system is powered on or reset. Specifically, the Boot code is responsible for initializing the system hardware, including setting the clock, configuring the memory controller, initializing peripherals, etc.; at the same time, the App code needs to be loaded from the storage device into the memory, which involves reading the file system, decompressing the code, or performing other necessary operations to ensure that the App code can be executed correctly. Once the App code is loaded into the memory, the Boot code needs to pass control to the App code so that it can start executing. In addition, the Boot code can also provide some startup services, such as parameter passing, environment settings, etc., to help the App code run better.
[0032] In this embodiment, there is no restriction on the specific method of storing the Boot code and the App code, and the specific process of configuring the jump from the Boot code to the App code, which depends on the specific implementation situation.
[0033] S12: Copying and storing the boot program code in a code space before the application program code in the application program code project to generate an application program code project including the boot program code.
[0034] Figure 2 A schematic diagram of an electric energy meter expansion module operation architecture provided in an embodiment of the present application. Figure 2 As shown, in order to merge the two sets of project codes, the Boot code is specifically copied and stored in the code space before the App code in the App code project to generate an App code project containing the Boot code. When the project is running, the Boot code will be run first, and then the App code will be run. In this embodiment, the specific process of copying and storing the Boot code in the code space before the App code in the App code project is not limited, and it depends on the specific implementation situation.
[0035] In this embodiment, a boot program code project and an application program code project are created independently of each other, and both projects contain common library functions. The boot program code and the application program code are stored and the jump from the boot program code to the application program code is configured. Finally, the boot program code is copied and stored in the code space before the application program code in the application program code project, so that the boot program code and the application program code coexist in the same project, which not only realizes the separate calling of the common library function by the boot program code and the application program code, but also realizes the integration of the two sets of project codes, and can ensure that when the boot program code is upgraded and the application program code is erased, the normal operation of the boot program code is not affected.
[0036] Based on the above embodiments, in some embodiments, a boot program code project and an application program code project are created separately, including: S101: Generate a boot program code and an application program code respectively; S102: storing the boot program code in a code space before a preset position in the boot program code project; S103: Storing the application code in a code space after a preset position in the application code project.
[0037] In order to create the Boot code project and the App code project, in this embodiment, the Boot code and the App code are first generated respectively. The Boot code is stored in the code space before the preset position in the Boot code project, and the App code is stored in the code space after the preset position in the App code project.
[0038] It should be noted that in this embodiment, there is no restriction on the preset position of the code space. For example, if the preset position is set to 12K, the Boot code is specifically stored in the first 12K of the code space of the Boot code project, and the App code is stored in the code space after the 12K of the App code project.
[0039] In this way, the creation of Boot code project and App code project is realized.
[0040] Based on the above embodiments, in some embodiments, the boot program code and the application program code are stored separately, and the jump from the boot program code to the application program code is configured, including: S111: respectively obtaining a first link file of a boot program code project and a second link file of an application program code project; S112: storing the boot program code into the initial running space of the controller according to the first link file; S113: storing the application code in the code space after the initial running space of the controller according to the second link file; S114: Relocate the entry function of the application code project to the end address of the starting execution space to configure a jump to the application code.
[0041] In order to store the Boot code and the App code and configure the jump from the Boot code to the App code, in this embodiment, the first link file of the Boot code project and the second link file of the App code project are respectively obtained.
[0042] It should be noted that in code engineering, the role of the linker script is to instruct the linker how to combine different object files into an executable file or library file. Specifically, it can specify the address and size of each part of the program (such as code segment, data segment, stack, etc.) in memory. This includes specifying the start address, end address, and alignment of each segment.
[0043] Therefore, in this embodiment, the Boot code is stored in the controller's initial operation space according to the first link file, such as the first 12K of the controller's code space, so that when the electric energy meter expansion module is started, the Boot code will be run first. Further, the App code is stored in the code space after the controller's initial operation space according to the second link file, such as the code space after 12K of the controller; at the same time, the entry function of the App code project is relocated to the end address of the initial operation space, such as the address of the 12K byte of the controller's code space, so that the App code can be jumped to run after the Boot code runs.
[0044] In this way, the storage of Boot code and App code and the configuration of the jump from Boot code to App code are realized, ensuring the normal operation of Boot code and App code.
[0045] Based on the above embodiments, in some embodiments, the boot program code is copied and stored in the code space before the application code in the application code project, including: S121: compile the bootloader code into a text array; wherein the size of the text array is the same as the size of the code space before the preset position in the application code project; S122: Copy and store the text array in the code space before the preset position in the application code project.
[0046] In order to integrate the two projects, in this embodiment, the Boot code is specifically compiled into a Hex file. It should be noted that in this embodiment, the text array is converted from HEX. HEX file is a text file format for representing binary data, which is usually used to transmit and store program code, data or configuration information in software development and embedded systems.
[0047] In addition, the size of the text array is the same as the size of the code space before the preset position in the App code project. For example, when the size of the code space before the preset position in the App code project is 12K, the size of the text array should also be 12K, so as to ensure that the text array is copied and stored in the code space before the preset position in the App code project, that is, in the first 12K code space, to achieve the coexistence of Boot code and App code.
[0048] Based on the above embodiment, in some embodiments, after the application code project including the boot program code is generated, the following further includes: S13: Run the boot program code according to the test instruction; S14: Determine whether the boot program code runs normally; if not, proceed to step S15; if yes, proceed to step S16; S15: Output the first alarm information; S16: When the boot program code is finished running, jump to run the application code; S17: Determine whether the application code runs normally; if not, proceed to step S18; if yes, proceed to step S19; S18: Outputting the second alarm information; S19: Confirm that the operation architecture of the electric energy meter extension module is generated correctly and end.
[0049] In order to verify whether the two engineering codes are successfully integrated and whether the operation architecture of the electric energy meter expansion module is generated correctly, after the App code project containing the Boot code is generated, the Boot code is run according to the test instructions, and at the same time, it is determined whether the Boot code runs normally. If it is confirmed that the Boot code does not run normally, it is confirmed that there is an abnormality in the Boot code, and the first alarm information is output to prompt the user to maintain the Boot code.
[0050] If the Boot code is confirmed to be running normally, then when the Boot code is finished running, jump to run the App code and determine whether the App code is running normally. If it is confirmed that the App code is not running normally, it is confirmed that there is an abnormality in the App code and the second alarm information is output to prompt the user to maintain the App code. If the App code is running normally, it is confirmed that the operation architecture of the electric energy meter expansion module is generated correctly and the current process is terminated.
[0051] In this way, the success of the fusion of the two engineering codes is verified.
[0052] Based on the above embodiments, in some embodiments, the method further includes: S20: monitoring the application upgrade instruction transmitted by the host computer through the application code; S21: When the application code receives the application upgrade instruction, it stores the application upgrade instruction and triggers the reset of the electric energy meter expansion module; S22: When the electric energy meter expansion module restarts, it detects whether there is an application upgrade instruction through the boot program code; if there is an application upgrade instruction, it goes to step S23; S23: According to the application upgrade instruction, the application code is upgraded through the boot program code.
[0053] In order to upgrade the App code, in this embodiment, the App code monitors the App upgrade instruction transmitted by the host computer. When the App code receives the App upgrade instruction, it stores the App upgrade instruction and triggers the reset of the electric energy meter expansion module. When the electric energy meter expansion module restarts, the Boot code detects whether there is an App upgrade instruction.
[0054] If the Boot code confirms that there is an App upgrade instruction, the App code is upgraded through the Boot code according to the App upgrade instruction. It can be understood that the upgrade process mainly erases the App code and writes new App code.
[0055] In addition, if the Boot code confirms that there is no App upgrade instruction, it can be considered that the App upgrade instruction does not exist in the first place, or it can be considered that the App upgrade instruction is lost. In order to prevent the App code upgrade from failing, the App upgrade request can be further sent to the host computer through the App code, so that the host computer can send the App upgrade instruction to the App again according to the App upgrade request, and the App code can be upgraded through the Boot code combined with the App upgrade instruction.
[0056] In the above-mentioned embodiment, the generation of the operation architecture of the electric energy meter extension module is described in detail. The present application also provides an embodiment corresponding to the device for generating the architecture of the electric energy meter extension module.
[0057] Figure 3 A schematic diagram of a device for generating an electric energy meter expansion module architecture provided in an embodiment of the present application. The device is applied to an electric energy meter expansion module; Figure 3 As shown, the device comprises: The creation module 10 is used to create a bootstrap code project and an application code project respectively; wherein the bootstrap code of the bootstrap code project and the application code of the application code project respectively contain corresponding public library functions.
[0058] The storage module 11 is used to store the boot program code and the application program code respectively, and configure the jump from the boot program code to the application program code.
[0059] The copy module 12 is used to copy and store the boot program code in the code space before the application program code in the application program code project to generate an application program code project including the boot program code.
[0060] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0061] Figure 4 A schematic diagram of an electric energy meter expansion module provided in an embodiment of the present application. Figure 4 As shown in the figure, the electric energy meter expansion module includes: A memory 20, used for storing computer programs; The processor 21 is used to implement the steps of the method for generating the electric energy meter extension module architecture mentioned in the above embodiment when executing the computer program.
[0062] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0063] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the method for generating the electric energy meter extension module architecture disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. Data 203 may include but is not limited to data involved in the method for generating the electric energy meter extension module architecture.
[0064] In some embodiments, the electric energy meter expansion module may further include an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .
[0065] Those skilled in the art will understand that Figure 4 The structure shown in does not constitute a limitation on the electric energy meter expansion module, and may include more or fewer components than shown in the figure.
[0066] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.
[0067] It is understandable that if the method in the above embodiment is implemented in the form of 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 the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0068] The above is a detailed introduction to a method, device, extension module and medium for generating an electric energy meter extension module architecture provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can refer to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can refer to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.
[0069] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for generating an electric energy meter extension module architecture, characterized in that: Applied to an electric energy meter expansion module; the method comprises: Creating a bootstrap code project and an application code project respectively; wherein the bootstrap code of the bootstrap code project and the application code of the application code project respectively contain corresponding public library functions; storing the boot program code and the application program code respectively, and configuring a jump from the boot program code to the application program code; The boot program code is copied and stored in a code space before the application code in the application code project to generate the application code project including the boot program code.
2. The method for generating an electric energy meter extension module architecture according to claim 1, characterized in that: The step of creating a boot program code project and an application program code project separately includes: generating the boot program code and the application program code respectively; storing the boot program code in a code space before a preset position in the boot program code project; The application code is stored in a code space after the preset position in the application code project.
3. The method for generating an electric energy meter extension module architecture according to claim 1, characterized in that: The storing the boot program code and the application program code separately and configuring the jump of the boot program code to the application program code includes: Respectively obtain a first link file of the boot program code project and a second link file of the application program code project; storing the boot program code in the initial operation space of the controller according to the first link file; storing the application code in a code space after the initial running space of the controller according to the second link file; The entry function of the application code project is relocated to the end address of the starting execution space to configure a jump to the application code.
4. The method for generating an electric energy meter extension module architecture according to claim 2, characterized in that: The step of copying and storing the boot program code in a code space before the application code in the application code project includes: Compiling the boot program code into a text array; wherein the size of the text array is the same as the size of the code space before the preset position in the application code project; The text array is copied and stored in the code space before the preset position in the application code project.
5. The method for generating an electric energy meter extension module architecture according to claim 1, characterized in that: After generating the application code project including the boot program code, the method further includes: Run the boot program code according to the test instruction; Determining whether the boot program code is running normally; If the boot program code does not run normally, output a first warning message; If the boot program code runs normally, then when the boot program code is finished running, jump to run the application code; Determining whether the application code is running normally; If the application code does not run normally, output a second warning message; If the application code runs normally, it is confirmed that the operation architecture of the electric energy meter extension module is generated correctly, and the process ends.
6. The method for generating an electric energy meter extension module architecture according to any one of claims 1 to 5, characterized in that: Also includes: Monitoring application upgrade instructions transmitted by the host computer through the application code; When the application code receives the application upgrade instruction, it stores the application upgrade instruction and triggers the reset of the electric energy meter expansion module; When the electric energy meter expansion module is restarted, detecting whether there is an application upgrade instruction through the boot program code; If there is an application upgrade instruction, the application code is upgraded through the boot program code according to the application upgrade instruction.
7. The method for generating an electric energy meter extension module architecture according to claim 6, characterized in that: If there is no application upgrade instruction, it also includes: An application upgrade request is sent to a host computer through the application code, so that the host computer can send an application upgrade instruction to the application again according to the application upgrade request.
8. A device for generating an extended module architecture of an electric energy meter, characterized in that: Applicable to an electric energy meter expansion module; the device comprises: A creation module is used to create a bootstrap code project and an application code project respectively; wherein the bootstrap code of the bootstrap code project and the application code of the application code project respectively contain corresponding public library functions; A storage module, used to store the boot program code and the application code respectively, and configure the jump from the boot program code to the application code; The copy module is used to copy and store the boot program code in the code space before the application code in the application code project to generate the application code project including the boot program code.
9. An electric energy meter expansion module, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for generating an electric energy meter extension module architecture as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for generating an electric energy meter extension module architecture as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Software upgrading method and device
CN110968337A
Method and device for separating BOOT from application program and related components
CN114780234A
Code sharing method, system and device and medium
CN116382794A
Program upgrading method and device and electronic equipment
CN116679961A
Spatial multiplexing method and system of MCU (Microprogrammed Control Unit)
CN118113280A
