Method and device for separating legal metering program and illegal function program

By separating the legal measurement program from the illegal function program and setting up interactive access interfaces and verification information in the same chip storage space, the risk of metering data in the gas meter being modified at will is solved, and the functions of independent upgrade and mutual access are achieved.

CN120406913APending Publication Date: 2025-08-01ZHEJIANG WEIXING INTELLIGENT METER STOCK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510389036.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-31
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In existing household smart gas meters, metrological related procedures and functional codes are integrated, resulting in the modification of the function code that may affect key measurement parameters, and there is a risk of arbitrarily modifying key measurement data such as accumulated quantity.

Method used

Separate the legal measurement program from the illegal functional program, establish an independent legal project, preset the interactive access interface address, and calculate the verification information in the same chip storage space to ensure that the program is not affected by the functional program when it is compiled and upgraded independently.

Benefits of technology

The independence and integrity of the legal measurement procedures are realized, ensuring that the measurement data is not affected by the modification and upgrading of functional programs, and mutual access between programs can be achieved, ensuring the accuracy and security of the measurement data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120406913A_ABST
    Figure CN120406913A_ABST
Patent Text Reader

Abstract

The invention discloses a method and device for separating a legal metering program and a functional program, and the method comprises the steps: building an independent legal project which is used for independently compiling the legal metering program; presetting an interface address for interactive access of the processing program and the external program, wherein the interface address comprises a first-class interface for the external program to access the processing program and a second-class interface for the processing program to access the external program; calculating verification information of the compiled processing program and storing the verification information to a verification address; the verification address and the interface address are stored in a storage space of the same chip; the verification information comprises length information and a verification value of the processing program; when the external program accesses the processing program, calculating a verification value of the processing program according to the installation initial address and the length information of the processing program, and when the verification value is matched with the verification value, accessing the processing program according to the first-class interface; and when the processing program accesses the external program, accessing the external program according to the second type interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of legal metrology equipment, and more specifically, to a method and apparatus for separating legal metrology programs from non-legal functional programs. Background Art

[0002] Currently, most household smart gas meters utilize a single main control board, integrating metering-related and function codes. Modifying these function codes can affect key metering parameters, and there's a risk of arbitrarily modifying key metering parameters like cumulative volume. To meet market demand and public demand for gas meters, gas meter software needs to separate the metering-related components into separate, legally mandated metering software / programs.

[0003] The legal metering software / program is independent of the non-legal software / program part of the gas meter equipment and can be upgraded separately. It has an independent software identifier including CRC, which is used to determine whether the legal software has been changed during software verification and type evaluation. The legal software and non-legal software are accessed through an interface.

[0004] The legal metering software for gas meters includes cumulative quantity algorithm, metering-related sensor data acquisition driver, protocol and encryption and decryption processing for reading and writing metering-related parameters, storage processing of metering-related parameters, and other functional interfaces that affect metering.

[0005] Once a gas meter's legal metering software has been approved, changes are not permitted. If the legal software needs to be upgraded, re-approval must be obtained before the upgrade can proceed. This legal metering software effectively prevents key metering data, such as accumulated gas volume, from being arbitrarily altered. Summary of the Invention

[0006] In order to solve the above problems, the embodiments of the present application provide a method and device for separating legal metrology programs and non-legal functional programs, which makes metrology-related programs independent of functional programs, unaffected by modifications and upgrades of functional programs, and can access each other under the premise of separation.

[0007] In a first aspect, an embodiment of the present application provides a method for separating a legal metrology program from a non-legal functional program, the method comprising: Establish an independent legal system project, which is used to separately compile legal metrology programs; the legal metrology programs are processing programs related to legal metrology, and non-legal functional programs are external programs; Presetting interface addresses for interactive access between the processing program and the external program, the interface addresses including a first type of interface for the external program to access the processing program and a second type of interface for the processing program to access the external program; Calculate the verification information of the compiled processing program and store it at the verification address; the verification address and the interface address are stored in the storage space of the same chip; the verification information includes the length information and the verification value of the processing program; When the external program accesses the processing program, calculate the verification value of the processing program according to the installation start address and the length information of the processing program. When the verification value matches the verification value, access the processing program according to the first type of interface; When the processing program accesses the external program, access the external program according to the second type of interface.

[0008] Preferably, place the processing program in the legal project, remove the relevance between the processing program and the external program, and enable the processing program to be independently compiled and passed.

[0009] Preferably, accessing the processing program according to the first type of interface specifically includes: Preset an interface array with a fixed address, arrange the interface addresses in sequence into the interface array, and output the interface sequence; the interface sequence is the arrangement sequence of each interface address; The external program calculates the address offset through the interface sequence, and then obtains the target address, and accesses the processing program according to the target address.

[0010] Preferably, it further includes: Create an interface file for the external program to access the processing program. According to the fixed address of the interface array and the interface sequence, define a macro in the interface file that can obtain the element value in the interface array; the element value is the target address.

[0011] Preferably, accessing the processing program according to the target address includes: The external program obtains the target address in the interface array according to the macro in the interface file, and then jumps to run in the interface of the processing program; After the processing program runs, it returns to run the external program.

[0012] Preferably, accessing the external program according to the second type of interface specifically includes: The second type of interface is a callback function registration interface. The external program registers the processing program callback function interface, and the registered callback function is used for the processing program to access the external program.

[0013] Preferably, it further includes merging the compiled processing program and the external program to generate an output file, specifically including: Obtain the compiled processing program and the external program; the external program is independently compiled in the external project; Merge the handler with the added verification information and the external program into a file to generate an output file; The output file includes a separate external program bin file, a separate handler bin file, and a bin file after merging the external program and the handler; Install or upgrade the program according to the output file.

[0014] In a second aspect, an embodiment of the present application provides a separation device for a legal metrology program and an illegal metrology function program, and the device includes: Independent compilation module: Establish an independent legal project for separately compiling the legal metrology program; the legal metrology program is a processing program related to legal metrology, and the illegal metrology function program is an external program; establish an independent external project for independently compiling the external program within the external project; Interactive interface module: Preset the interface address for the interaction and access between the processing program and the external program; the interface address includes a first type of interface for the external program to access the processing program and a second type of interface for the processing program to access the external program; Verification and storage module: Calculate the verification information of the compiled processing program and store it in the verification address; the verification address and the interface address are stored in the storage space of the same chip; the verification information includes the length information and the verification value of the processing program; Interactive access module: When the external program accesses the processing program, calculate the verification value of the processing program according to the installation start address and the length information of the processing program. When the verification value matches the verification value, access the processing program according to the first type of interface; when the processing program accesses the external program, access the external program according to the second type of interface.

[0015] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the method provided in the first aspect or any possible implementation manner of the first aspect are implemented.

[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method provided in the first aspect or any possible implementation manner of the first aspect is implemented.

[0017] The beneficial effects of the present invention are as follows: The present invention provides a separation method and device for a legal metrology program and an illegal metrology function program, which separates the metrology-related program from the functional part and is not affected by the program modification and upgrade of the functional part. The processing program and the external program are in the storage space of the same chip, and the processing program and the external program can access each other on the premise of separation.

[0018] To achieve the complete separation of the legal metrology part, an independent legal metrology software project is established. This independent project is compiled separately and is not associated with the projects of the functional parts.

[0019] To ensure the functional integrity and accuracy after the upgrade of the processing program, the verification-related information is merged with the output file after the compilation of the legal software (processing program). The verification information is placed in front of the legal software, and the verification information and the legal software are upgraded together during the upgrade to ensure the integrity and accuracy of the legal software. Description of the Drawings

[0020] To more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0021] Figure 1 It is a schematic flowchart of a method for separating legal metrology programs and non-legal metrology function programs provided by the embodiments of the present application; Figure 2 It is a schematic structural diagram of a device for separating legal metrology programs and non-legal metrology function programs provided by the embodiments of the present application; Figure 3 It is a schematic structural diagram of an electronic device provided by the embodiments of the present application; Figure 4 It is a schematic diagram of the storage space division of the legal metrology program; Figure 5 It is a schematic diagram of the interface for an external program to access the processing program; Figure 6 It is a schematic diagram of an external program calculating the CRC check value of the processing program. Detailed Embodiments

[0022] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the drawings in the embodiments of the present application.

[0023] In the following description, the terms "first" and "second" are for descriptive purposes only and should not be construed as indicating or implying relative importance. The following description provides multiple embodiments of the present application. Different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments described. Thus, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then the present application should also be considered to include embodiments that contain one or more of all other possible combinations of A, B, C, and D, even though such embodiments may not be explicitly recited in the following content.

[0024] The following description provides examples and does not limit the scope, applicability, or examples set forth in the claims. Changes can be made to the functions and arrangements of the described elements without departing from the scope of the content of the present application. Various processes or components can be appropriately omitted, substituted, or added to each example. For example, the described method can be performed in a different order than the described order, and various steps can be added, omitted, or combined. In addition, the features described in some examples can be combined into other examples.

[0025] See Figure 1 , Figure 1 is a schematic flowchart of a method for separating a legal metrology program and an illegal legal function program provided by an embodiment of the present application. In the embodiment of the present application, the method includes: S101. Establish an independent legal project, which is used to separately compile the legal metrology program.

[0026] The execution entity of the present application can be a metrology device that meets legal requirements, such as a gas meter, an electric meter, a water meter, etc.

[0027] In the present application, the legal metrology program / legal metrology software / legal software is a processing program related to legal metrology, and the illegal legal function program / function software is an external program. However, it should be clear that both the legal software and the function software are in the storage space of the same chip, and the processing program and the external program are both installed in one storage space. During operation, the two are independent of each other and can access each other. <{

[0028] Based on the actual situation, the storage distribution of the legal metrology program can refer to Figure 4 , which is embodied in the form of an interface address array and can include interfaces Addr1, Addr2, Addr3, Addr4,... that need to be accessed, the fixed address (Addr-array) of the interface array, the legal address (permission address), etc. That is, the starting position of the installation address of the legal metrology program is interface 1, and the ending position is the legal address (Addr-legal).

[0029] The verification address (Addr-CRC) can be placed below the legal address, and below the verification address is the storage address (Addr-App) of the external program, that is, the functional part.

[0030] In the embodiments of the present application, the processing program, the external program, the interface array, and the verification information are all stored in the same storage space, and this storage space can be the same storage medium, such as a chip.

[0031] When establishing a project, a legal project and an external project can be established separately, and the association between the two can be removed, and the processing program and the external program can be compiled independently.

[0032] In the embodiments of the present application, the processing program can be placed in the legal project, the association between the processing program and the external program can be removed, and it is not associated with the project of the functional part, so that the processing program can be independently compiled and passed. Correspondingly, the external program can be placed in the external project for independent compilation.

[0033] S102. Preset the interface address for the interaction and access between the processing program and the external program.

[0034] In the embodiments of the present application, after compilation, the codes of the two parts can be merged, but at this time, the two parts of the codes cannot achieve interaction. Therefore, the interface address for the interaction and access between the two can be preset, and the interaction and access between the external program and the processing program can be realized according to the interface address.

[0035] Specifically, the interface address includes a first type of interface for the external program to access the processing program and a second type of interface for the processing program to access the external program.

[0036] Among them, the second type of interface can be a callback function registration interface, and the external program registers the legal software callback function interface, and the registered callback function is used for the legal software to access the external program.

[0037] The number of the first type of interfaces may be large. An interface array with a fixed address can be preset, and the interface addresses that can be accessed by the external program are put into the interface array and arranged in order. The external program finds the interface address through the array with the fixed address, and then accesses the processing program and jumps to run.

[0038] The interface addresses are arranged in order in the array. The external program calculates the address offset according to the order of the interfaces put into the array, so as to find the specific position where the interface address is stored, that is, obtain the target address. The target address can correspond to the function interface, data interface, etc. of the processing program, so as to implement functions, obtain data, etc.

[0039] S103. Calculate the verification information of the compiled processing program and store it in the verification address.

[0040] In an embodiment of the present application, the verification address and the interface address are stored in the storage space of the same chip; the verification information includes the length information of the processing program and the verification value.

[0041] Of course, the specific content related to the verification information may further include other data, such as legal signature files, verification codes, etc. In the present application, the length information and the verification value are taken as examples for illustration.

[0042] In an embodiment of the present application, the external program and the processing program are independently compiled. A script file can be used to automatically compile the project of the processing program during the project compilation of the external program, calculate the verification information of the processing program, merge the processing program with the added verification information and the external program to generate the final output file, and perform program installation and program update based on the output file.

[0043] When generating the output file, the output file may include a separate external program bin file, a separate processing program bin file, and a bin file after the merger of the external program and the processing program, with higher subsequent upgrade freedom. Just select the corresponding bin file according to needs to make the upgrade file.

[0044] During program installation, the program can be installed based on the bin file after the merger of the external program and the processing program. At this time, the processing program is added with verification information. Thus, the verification information of the processing program can be stored in the verification address. The verification address is outside the permission address, while the processing program can be inside the permission address. When calculating the length information of the processing program, only the length within the right item address is calculated, and the verification address is not included in the length information of the processing program.

[0045] After the installation is completed, the external program is located below the verification address. As Figure 6 shown, the external program can directly access the verification information on the verification address, and then pre-verify the legality of the processing program based on this.

[0046] S104. When the external program accesses the processing program, calculate the verification value of the processing program according to the installation start address and the length information of the processing program. When the verification value matches the verification value, access the processing program according to the first type of interface; when the processing program accesses the external program, access the external program according to the second type of interface.

[0047] In the present application, the interaction between the external program and the processing program is implemented through two types of interfaces and can be independent.

[0048] In an embodiment of the present application, the processing program may carry a software identifier, such as a software identification with CRC verification. The external program has the function of verifying the CRC of the processing program. When the external program accesses the processing program, it can first verify the legality of the processing program and then access it to call its functions, data, etc.

[0049] Specifically, taking CRC check as an example, after the processing program is installed or compiled, the check information can be calculated. The check information may include the length information of the processing program (code) and the CRC check value. For the installed processing program, the external program can obtain the length information and the CRC check value from the check address, and can also calculate the verification value of the processing program according to the installation start address and length information of the processing program. When the verification value matches the check value, the processing program can be accessed according to the first type of interface. The access object is the above-mentioned interface that needs to be accessed, such as Addr1.

[0050] Please refer to Figure 6 , the installation start address is Addr1, the length information can be directly obtained from the check address, and the CRC calculation area can be obtained according to the start address and length information. At this time, the external program can calculate the CRC of the legal metrology software, which can be defined as the verification value, take out the CRC check value from the check address, and compare the verification value with the check value to determine the legality of the processing program.

[0051] If the verification value and the check value match, the comparison passes, and the processing program can be accessed according to the first type of interface.

[0052] If the verification value and the check value do not match, the comparison fails, and an error message can be prompted or an alarm can be issued.

[0053] In the embodiments of the present application, accessing the processing program according to the first type of interface specifically includes: Preset an interface array with a fixed address, arrange the interface addresses in order into the interface array, and output the interface order; the interface order is the arrangement order of each interface address. The external program calculates the address offset through the interface order, and then obtains the target address, and accesses the processing program according to the target address.

[0054] An interface file for the external program to access the processing program can be established. According to the fixed address and interface order of the interface array, a macro that can obtain the element value in the interface array is defined in the interface file; the element value is the target address.

[0055] Therefore, accessing the processing program according to the target address can be implemented based on the macro, specifically including: The external program obtains the target address in the interface array according to the macro in the interface file, and then jumps to the interface of the processing program to run; after the processing program runs, it returns to the external program to run.

[0056] Taking interface 1 corresponding to the target address Addr1 as an example, please refer to Figure 5, the external program retrieves the first element Addr1 of the interface array from the interface array at a fixed address, finds the address of Interface 1, and jumps to run the interface.

[0057] In the embodiments of the present application, the processing program can access the external program according to the second type of interface, specifically including: The second type of interface is a callback function registration interface. The external program registers the callback function interface of the processing program, and the registered callback function is used for the processing program to access the external program. That is, when the legal software needs to access the external program, it accesses through the registered callback function.

[0058] Next, in conjunction with the attached Figure 2 , a detailed introduction will be given to the separation device for the legal metrology program and the non-legal metrology function program provided in the embodiments of the present application. It should be noted that the attached Figure 2 The separation device for the legal metrology program and the non-legal metrology function program shown is used to execute the method of the embodiments of the present application Figure 1 shown. For the sake of convenience of description, only the parts related to the embodiments of the present application are shown. For the specific technical details not disclosed, please refer to the embodiments Figure 1 shown in the present application.

[0059] Please refer to Figure 2 , Figure 2 which is a schematic structural diagram of a separation device for a legal metrology program and a non-legal metrology function program provided in an embodiment of the present application. As Figure 2 shown, the device includes: Independent compilation module 201: Establish an independent legal project, which is used to separately compile the legal metrology program; the legal metrology program is a processing program related to legal metrology, and the non-legal metrology function program is an external program; Interaction interface module 202: Preset the interface addresses for the interaction and access between the processing program and the external program; the interface addresses include the first type of interface for the external program to access the processing program and the second type of interface for the processing program to access the external program; Verification and storage module 203: Calculate the verification information of the compiled processing program and store it in the verification address; the verification address and the interface address are stored in the storage space of the same chip; the verification information includes the length information and the verification value of the processing program; Interaction access module 024: When the external program accesses the processing program, calculate the verification value of the processing program according to the installation start address and length information of the processing program. When the verification value matches the verification value, access the processing program according to the first type of interface; when the processing program accesses the external program, access the external program according to the second type of interface.

[0060] Those skilled in the art can clearly understand that the technical solutions of the embodiments of the present application can be implemented by means of software and / or hardware. The "units" and "modules" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a Field-Programmable Gate Array (FPGA), an Integrated Circuit (IC), etc.

[0061] Each processing unit and / or module of the embodiments of the present application can be implemented by an analog circuit that implements the functions described in the embodiments of the present application, or can be implemented by software that executes the functions described in the embodiments of the present application.

[0062] See Figure 3 , which shows a schematic structural diagram of an electronic device related to the embodiments of the present application. This electronic device can be used to implement Figure 1 the method in the illustrated embodiment. As Figure 3 shown, the electronic device 300 may include: at least one central processing unit 301, at least one network interface 304, a user interface 303, a memory 305, and at least one communication bus 302.

[0063] Among them, the communication bus 302 is used to realize the connection and communication between these components.

[0064] Among them, the user interface 303 may include a display screen (Display), a camera (Camera). Optionally, the user interface 303 may further include a standard wired interface and a wireless interface.

[0065] Among them, the network interface 304 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).

[0066] Among them, the central processing unit 301 may include one or more processing cores. The central processing unit 301 connects various parts within the entire electronic device 300 through various interfaces and lines. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 305, and by calling the data stored in the memory 305, it executes various functions of the terminal and processes data. Optionally, the central processing unit 301 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The central processing unit 301 may integrate a combination of one or several of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the central processing unit 301 and may be implemented separately by a single chip.

[0067] Among them, the memory 305 may include random access memory (RAM) and may also include read-only memory. Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 305 may include a program storage area and a data storage area. Among them, the program storage area can store instructions for implementing the operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area can store the data involved in the above-mentioned various method embodiments. Optionally, the memory 305 may also be at least one storage device located far from the aforementioned central processing unit 301. As Figure 3 shown, the memory 305, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and program instructions.

[0068] In Figure 3In the electronic device 300 shown, the user interface 303 is mainly used to provide an interface for the user to input and obtain the data input by the user; and the central processing unit 301 can be used to call the separation application programs of the legal metrology program and the non-legal metrology function program stored in the memory 305, and specifically perform the following operations: Establish an independent legal project, which is used to separately compile the legal metrology program; the legal metrology program is a processing program related to legal metrology, and the non-legal metrology function program is an external program; Preset the interface addresses for the interaction and access between the processing program and the external program. The interface addresses include the first type of interface for the external program to access the processing program and the second type of interface for the processing program to access the external program; Calculate the verification information of the compiled processing program and store it in the verification address; the verification address and the interface address are stored in the storage space of the same chip; the verification information includes the length information and the verification value of the processing program; When the external program accesses the processing program, calculate the verification value of the processing program according to the installation start address and the length information of the processing program. When the verification value matches the verification value, access the processing program according to the first type of interface; When the processing program accesses the external program, access the external program according to the second type of interface.

[0069] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the steps of the above method are implemented. Among them, the computer-readable storage medium may include, but is not limited to, any type of disk, including floppy disks, optical disks, DVDs, CD-ROMs, microdrives, and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic cards or optical cards, nano-systems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.

[0070] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.

[0071] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0072] In several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some service interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical or other form.

[0073] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0074] In addition, in each embodiment of the present application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0075] If the above-mentioned integrated unit 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 memory. Based on such an understanding, the technical solution of the present application, in essence, 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. This computer software product is stored in a memory and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned memory includes: USB flash drives, read-only memory (ROM), random access memory (RAM), mobile hard disks, magnetic disks, or optical discs, etc., which can store program codes.

[0076] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program. This program can be stored in a computer-readable memory. The memory can include: flash drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs, etc.

[0077] The above are only exemplary embodiments of the present disclosure, and the scope of the present disclosure cannot be limited thereby. That is, any equivalent changes and modifications made in accordance with the teachings of the present disclosure still fall within the scope covered by the present disclosure. Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the specification and practicing the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include known common general knowledge or conventional technical means in the technical field not recorded in the present disclosure. The specification and embodiments are only regarded as exemplary, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A method for separating a legal metrology program and an illegal metrology function program, characterized in that The method includes: Establish an independent legal metrology project, which is used to separately compile the legal metrology program; the legal metrology program is a processing program related to legal metrology, and the non-legal function program is an external program; Preset the interface address for the interaction and access between the processing program and the external program. The interface address includes a first type of interface for the external program to access the processing program and a second type of interface for the processing program to access the external program; Calculate the verification information of the compiled processing program and store it in the verification address; the verification address and the interface address are stored in the storage space of the same chip; the verification information includes the length information and the verification value of the processing program; When the external program accesses the processing program, calculate the verification value of the processing program according to the installation start address and the length information of the processing program. When the verification value matches the verification value, access the processing program according to the first type of interface; When the processing program accesses the external program, access the external program according to the second type of interface.

2. The method according to claim 1, wherein It also includes: Place the processing program in the legal metrology project, remove the association between the processing program and the external program, and enable the processing program to be independently compiled and passed.

3. The method according to claim 1, characterized in that, Accessing the processing program according to the first type of interface specifically includes: Preset an interface array with a fixed address, arrange the interface addresses in sequence into the interface array, and output the interface sequence; the interface sequence is the arrangement sequence of each interface address; The external program calculates the address offset through the interface sequence, thereby obtaining the target address, and accesses the processing program according to the target address.

4. The method according to claim 3, characterized in that It also includes: Establish an interface file for the external program to access the processing program. According to the fixed address of the interface array and the interface sequence, define a macro in the interface file that can obtain the element value in the interface array; the element value is the target address.

5. The method according to claim 4, characterized in that Accessing the processing program according to the target address includes: The external program obtains the target address in the interface array according to the macro in the interface file, and then jumps to run in the interface of the processing program; After the processing program runs, it returns to the external program to run.

6. The method according to claim 1, characterized in that, Accessing the external program according to the second type of interface specifically includes: The second type of interface is a callback function registration interface. The external program registers the processing program callback function interface, and the registered callback function is used for the processing program to access the external program.

7. The method according to claim 1, wherein It also includes merging the compiled processing program and the external program to generate an output file, specifically including: Obtain the compiled processing program and the external program; the external program is independently compiled in an external project; Merge the processing program with the added verification information and the external program into a file to generate an output file; The output file includes a separate external program bin file, a separate processing program bin file, and a bin file after the merger of the external program and the processing program; Perform program installation or program upgrade according to the output file.

8. A separating device for a legal metrology program and a functional program, characterized in that, It includes: Independent compilation module: Establish an independent legal metrology project, which is used to compile the legal metrology program separately; the legal metrology program is a processing program related to legal metrology, and the non-legal function program is an external program; Interactive interface module: Preset the interface address for the interaction and access between the processing program and the external program; the interface address includes the first type of interface for the external program to access the processing program and the second type of interface for the processing program to access the external program; Verification and storage module: Calculate the verification information of the compiled processing program and store it in the verification address; the verification address and the interface address are stored in the storage space of the same chip; the verification information includes the length information and the verification value of the processing program; Interactive access module: When the external program accesses the processing program, calculate the verification value of the processing program according to the installation start address and length information of the processing program. When the verification value matches the verification value, access the processing program according to the first type of interface; when the processing program accesses the external program, access the external program according to the second type of interface.

9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1-7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1-7 are implemented.