Movatterモバイル変換


[0]ホーム

URL:


CN110119281A - A kind of electric energy meter software modularization upgrading method and electric energy meter system - Google Patents

A kind of electric energy meter software modularization upgrading method and electric energy meter system
Download PDF

Info

Publication number
CN110119281A
CN110119281ACN201810124992.7ACN201810124992ACN110119281ACN 110119281 ACN110119281 ACN 110119281ACN 201810124992 ACN201810124992 ACN 201810124992ACN 110119281 ACN110119281 ACN 110119281A
Authority
CN
China
Prior art keywords
electric energy
energy meter
upgrade
application program
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810124992.7A
Other languages
Chinese (zh)
Inventor
林向阳
冯海舟
谷战垒
方旭
杜树帅
贺姗姗
张慧
付召辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xuji Group Co Ltd
Henan Xuji Instrument Co Ltd
Original Assignee
Xuji Group Co Ltd
Henan Xuji Instrument Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xuji Group Co Ltd, Henan Xuji Instrument Co LtdfiledCriticalXuji Group Co Ltd
Priority to CN201810124992.7ApriorityCriticalpatent/CN110119281A/en
Publication of CN110119281ApublicationCriticalpatent/CN110119281A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

The present invention relates to a kind of electric energy meter software modularization upgrading method and electric energy meter systems, belong to electric energy meter system technical field.Electric energy meter software is carried out module division according to the function of electric energy meter by the present invention, each functional module compiles generation module file, the application program memory space of electric energy meter software is divided, obtain at least two storage subspaces, each modularization file is upgraded to corresponding storage subspace respectively, so that the independent upgrading to each module is realized, without whole updating program after wiping the area single-chip microcontroller ROM of electric energy meter, upgrading mode is simple, and upgrading efficiency is greatly improved.

Description

Translated fromChinese
一种电能表软件模块化升级方法及电能表系统Modular upgrade method of electric energy meter software and electric energy meter system

技术领域technical field

本发明涉及一种电能表软件模块化升级方法及电能表系统,属于电能表系统技术领域。The invention relates to a method for upgrading electric energy meter software modularization and an electric energy meter system, belonging to the technical field of electric energy meter systems.

背景技术Background technique

电能表启动后,从闪存(Flash)中加载程序代码和CE(电能计量单元)代码运行,在研发设计阶段,可以通过仿真器将已编译好的程序烧录到芯片的闪存中,从而实现对程序的更新升级,在电能表生产阶段,通过专用的烧录器将程序烧写到芯片中,电能表出厂后,如果有特殊要求需要升级程序时,则只能通过返厂后进行操作。现有技术虽然在程序设计阶段能方便的对电能表程序进行升级操作,但在电能表生产阶段及其出厂后,若有升级需求,只能通过烧录器对单台电能表依次进行升级,操作非常之麻烦,尤其是当电能表安装到千家万户后,如果要升级更新的话,则需要将所有的电能表返厂,然后进行升级,或者在去到每一处电表的安装位置,拆掉铅封,通过专用工具进行升级,升级成本巨大。After the energy meter is started, load the program code and CE (electric energy measurement unit) code from the flash memory (Flash) to run. Program update and upgrade. In the production stage of the electric energy meter, the program is programmed into the chip through a dedicated programmer. After the electric energy meter leaves the factory, if there is a special requirement to upgrade the program, it can only be operated after returning to the factory. Although the existing technology can conveniently upgrade the electric energy meter program in the program design stage, but in the electric energy meter production stage and after leaving the factory, if there is an upgrade demand, the single electric energy meter can only be upgraded sequentially through the programmer. The operation is very troublesome, especially after the electric energy meters are installed in thousands of households, if you want to upgrade and update, you need to return all the electric energy meters to the factory, and then upgrade, or go to the installation location of each electric meter, disassemble The lead seal is dropped, and the upgrade is performed through a special tool, and the upgrade cost is huge.

为此,有人提出了在线升级方式,例如,公布号为CN106953902A的专利申请文件,该文件公开了一种电能表固件升级方法和装置,该方法通过在自组网中发送携带电能表标识获取命令的广播消息,接收该自组网中其它电能表标识应答所述广播消息而上报的电能表标识;按照该电能表表示发送升级命令和固件文件,使对应于电能表标识的其它电能表接收到升级命令和固件文件,自动执行自身的固件升级过程,从而在自组网中通过触发一台电能表升级,实现其它电能表升级。该方案虽然能够实现在线升级,提供了升级效率,但是并没有给出具体升级过程,而目前的在线升级都是将电能表的单片机ROM区擦除后整体更新程序,使得电能表软件管理工作繁杂,易造成完善了一项功能后造成原有功能失效等问题。For this reason, someone has proposed an online upgrade method. For example, the patent application document with the publication number CN106953902A discloses a method and device for upgrading the firmware of an electric energy meter. broadcast message, receive the electric energy meter identification reported by other electric energy meter identifications in the ad hoc network in response to the broadcast message; send upgrade commands and firmware files according to the electric energy meter representation, so that other electric energy meters corresponding to the electric energy meter identification receive The upgrade command and firmware file can automatically execute its own firmware upgrade process, so as to trigger the upgrade of one electric energy meter in the ad hoc network to realize the upgrade of other electric energy meters. Although this solution can realize online upgrade and provide upgrade efficiency, it does not give a specific upgrade process, and the current online upgrade is to erase the ROM area of the single-chip microcomputer of the electric energy meter and then update the whole procedure, which makes the electric energy meter software management complicated. , It is easy to cause problems such as the failure of the original function after improving a function.

发明内容Contents of the invention

本发明的目的是提供一种电能表软件模块化升级方法,以解决目前电能表软件升级过程只能整体升级导致升级过程复杂,易造成原有功能失效问题;本发明还提供了一种电能表系统。The purpose of the present invention is to provide a modularized upgrade method for electric energy meter software to solve the problem that the current electric energy meter software upgrade process can only be upgraded as a whole, resulting in a complicated upgrade process and easy failure of original functions; the present invention also provides an electric energy meter system.

本发明为解决上述技术问题而提供一种电能表软件模块化升级方法,包括以下方案,方法方案一:该模块化升级方法包括以下步骤:In order to solve the above-mentioned technical problems, the present invention provides a method for modular upgrading of electric energy meter software, which includes the following schemes, method scheme 1: the modular upgrading method includes the following steps:

1)将电能表应用程序按程序功能进行模块化划分,将电能表软件的应用程序存储空间进行划分,得到至少两个存储子空间,分别用于存储电能表应用程序的各功能模块;1) Carry out modular division of the electric energy meter application program according to the program function, divide the application program storage space of the electric energy meter software, obtain at least two storage subspaces, which are respectively used to store each functional module of the electric energy meter application program;

2)将电能表的应用程序中各功能模块的目标文件编译到对应存储子空间的指定起始地址;2) compiling the target files of each function module in the application program of the electric energy meter to the specified starting address of the corresponding storage subspace;

3)将待升级的电能表应用程序功能模块的升级文件存放到存储芯片对应的升级区域,并将放到存储芯片的升级区域中升级文件搬运至相应的存储子空间,对该功能模块进行升级。3) Store the upgrade file of the application function module of the electric energy meter to be upgraded in the upgrade area corresponding to the memory chip, and place the upgrade file in the upgrade area of the memory chip and move the upgrade file to the corresponding storage subspace to upgrade the function module .

本发明将电能表软件按照电能表的功能进行模块划分,每个功能模块编译产生模块化文件,将各模块化文件分别升级到电能表单片机的指定存储区域,从而实现对各模块的单独升级,无需将电能表的单片机ROM区擦除后整体更新程序,升级方式简单,升级效率得到了大大提高。In the present invention, the electric energy meter software is divided into modules according to the functions of the electric energy meter, and each functional module is compiled to generate a modular file, and each modular file is respectively upgraded to the designated storage area of the electric energy meter chip computer, thereby realizing the individual upgrade of each module, There is no need to update the program after erasing the ROM area of the single-chip microcomputer of the electric energy meter, the upgrade method is simple, and the upgrade efficiency is greatly improved.

方法方案二:在方法方案一的基础上,所述步骤1)中应用程序存储空间采用间接寻址方式进行空间分配。Method scheme two: on the basis of method scheme one, in the step 1), the application program storage space is allocated in an indirect addressing manner.

方法方案三:在方法方案二的基础上,采用间接寻址方式进行空间分配过程为:采用Boot程序定义各应用程序功能模块的入口地址为各应用程序功能模块在对应存储子空间中的起始位置,利用应用程序功能模块的入口地址对各应用程序进行升级操作。Method 3: On the basis of method 2, the process of space allocation using indirect addressing is as follows: use the Boot program to define the entry address of each application function module as the start of each application function module in the corresponding storage subspace location, use the entry address of the application program function module to upgrade each application program.

本发明通过间接寻址方式进行空间分配,当功能模块位置改变时修改对应的变量值即可,实现方便,使得升级效率得到进一步提高。The present invention allocates space through the indirect addressing mode, and only needs to modify the corresponding variable value when the position of the function module changes, which is convenient to implement and further improves the upgrading efficiency.

方法方案四:在方法方案一的基础上,在将放到存储芯片的升级区域中升级文件搬运至相应的存储子空间前,需备份该电能表应用程序功能模块到存储芯片相应的备份区域。Method 4: On the basis of method 1, before transferring the upgrade file in the upgrade area of the memory chip to the corresponding storage subspace, the application function module of the electric energy meter needs to be backed up to the corresponding backup area of the memory chip.

本发明在对功能模块进行升级前,现将功能模块的程序内容备份,防止升级过程出现异常,导致该功能模块损坏,影响整个系统,提高了升级可靠性。Before the upgrade of the functional modules, the present invention backs up the program content of the functional modules to prevent abnormalities in the upgrade process from causing damage to the functional modules and affecting the entire system, thereby improving the reliability of the upgrade.

方法方案五:在方法方案一的基础上,在将待升级的电能表应用程序功能模块的升级文件存放到存储芯片的升级区域时,需对存储的升级文件进行校验。通过对升级文件的校验,进一步提高了升级的可靠性。Method scheme five: On the basis of method scheme one, when storing the upgrade file of the application function module of the electric energy meter to be upgraded in the upgrade area of the memory chip, the stored upgrade file needs to be verified. Through the verification of the upgrade file, the reliability of the upgrade is further improved.

方法方案六:在方法方案五的基础上,若升级文件校验正确,则在该升级文件存放位置的指定区域增加升级成功标志。Method 6: On the basis of method 5, if the upgrade file is verified correctly, add an upgrade success mark in the designated area where the upgrade file is stored.

方法方案七:在方法方案六的基础上,在检测到升级成功标志时,备份电能表应用程序功能模块到存储芯片备份区域,并清除相应的升级成功标志。Method scheme seven: on the basis of method scheme six, when the upgrade success flag is detected, back up the application program function module of the electric energy meter to the memory chip backup area, and clear the corresponding upgrade success flag.

方法方案八:在方法方案四的基础上,当应用程序功能模块需要从升级后恢复到升级前时,将对应备份区域的应用程序功能模块复制到对应的升级区域,实现对该应用程序的恢复。Method 8: On the basis of method 4, when the application function module needs to be restored from after the upgrade to before the upgrade, copy the application function module in the corresponding backup area to the corresponding upgrade area to realize the restoration of the application .

本发明还提供了一种电能表系统,包括以下方案,系统方案一:包括单片机芯片、存储芯片以及运行的Boot程序和电能表应用程序,所述的电能表应用程序按程序功能进行模块化划分,电能表软件的应用程序存储空间进行划分,得到至少两个存储子空间,分别用于存储电能表应用程序的各功能模块;电能表的应用程序中各功能模块的目标文件被编译到对应存储子空间的指定起始地址;待升级的电能表应用程序功能模块的升级文件被存放到存储芯片对应的升级区域,存放到存储芯片的升级区域中升级文件被搬运至相应的存储子空间。The present invention also provides an electric energy meter system, including the following schemes, system scheme one: including a single-chip microcomputer chip, a memory chip, and a running Boot program and an electric energy meter application program, and the electric energy meter application program is modularly divided according to program functions , the application storage space of the electric energy meter software is divided to obtain at least two storage subspaces, which are respectively used to store each functional module of the electric energy meter application program; the target files of each functional module in the electric energy meter application program are compiled into the corresponding storage The specified starting address of the subspace; the upgrade file of the application function module of the electric energy meter to be upgraded is stored in the upgrade area corresponding to the memory chip, and the upgrade file stored in the upgrade area of the memory chip is transferred to the corresponding storage subspace.

系统方案二:在系统方案一的基础上,应用程序存储空间采用间接寻址方式进行空间分配。System Solution 2: On the basis of System Solution 1, the application storage space is allocated using indirect addressing.

系统方案三:在系统方案二的基础上,采用间接寻址方式进行空间分配过程为:采用Boot程序定义各应用程序功能模块的入口地址为各应用程序功能模块在对应存储子空间中的起始位置,利用应用程序功能模块的入口地址对各应用程序进行升级操作。System Solution 3: On the basis of System Solution 2, the space allocation process using indirect addressing is as follows: use the Boot program to define the entry address of each application program function module as the start of each application program function module in the corresponding storage subspace location, use the entry address of the application program function module to upgrade each application program.

系统方案四:在系统方案一的基础上,在将放到存储芯片的升级区域中升级文件搬运至相应的存储子空间前,需备份该电能表应用程序功能模块到存储芯片相应的备份区域。System solution 4: On the basis of system solution 1, before moving the upgrade file in the upgrade area of the memory chip to the corresponding storage subspace, the application function module of the electric energy meter needs to be backed up to the corresponding backup area of the memory chip.

系统方案五:在系统方案一的基础上,在将待升级的电能表应用程序功能模块的升级文件存放到存储芯片的升级区域时,需对存储的升级文件进行校验。System solution five: On the basis of system solution one, when storing the upgrade file of the application function module of the electric energy meter to be upgraded in the upgrade area of the memory chip, the stored upgrade file needs to be verified.

系统方案六:在系统方案五的基础上,若升级文件校验正确,则在该升级文件存放位置的指定区域增加升级成功标志。System solution 6: On the basis of system solution 5, if the upgrade file is verified correctly, an upgrade success mark will be added to the designated area where the upgrade file is stored.

系统方案七:在系统方案六的基础上在检测到升级成功标志时,备份电能表应用程序功能模块到存储芯片备份区域,并清除相应的升级成功标志。System solution seven: On the basis of system solution six, when the upgrade success sign is detected, back up the application program function module of the electric energy meter to the memory chip backup area, and clear the corresponding upgrade success sign.

系统方案八:在系统方案四的基础上,当应用程序功能模块需要从升级后恢复到升级前时,将对应备份区域的应用程序功能模块复制到对应的升级区域,实现对该应用程序的恢复。System Solution 8: On the basis of System Solution 4, when the application function module needs to be restored from after the upgrade to before the upgrade, copy the application function module in the corresponding backup area to the corresponding upgrade area to realize the recovery of the application program .

附图说明Description of drawings

图1是电能表软件模块化升级流程图;Figure 1 is a flowchart of the modular upgrade of the electric energy meter software;

图2是电能表软件模块化升级过程中的备份流程图;Fig. 2 is a backup flow chart in the process of upgrading the electric energy meter software modularization;

图3是电能表软件模块化升级恢复流程图;Fig. 3 is a flow chart of upgrading and restoring the electric energy meter software modularization;

图4是本发明实施例中生成GPRS模块目标码段空间配置示意图;Fig. 4 is a schematic diagram of generating a GPRS module target code segment space configuration in an embodiment of the present invention;

图5是本发明实施例中生成gprs.hex目标码配置示意图。Fig. 5 is a schematic diagram of the configuration for generating the gprs.hex object code in the embodiment of the present invention.

具体实施方式Detailed ways

下面结合附图对本发明的具体实施方式做进一步的说明。The specific embodiments of the present invention will be further described below in conjunction with the accompanying drawings.

本发明通过将电能表应用程序按程序功能进行模块化划分,将电能表软件的应用程序存储空间进行划分,得到至少两个存储子空间,分别用于存储电能表应用程序的各功能模块;然后将电能表的应用程序中各功能模块的目标文件编译到对应存储子空间的指定起始地址;最后将待升级的电能表应用程序功能模块的升级文件存放到存储芯片对应的升级区域,并将放到存储芯片的升级区域中升级文件搬运至相应的存储子空间,对该功能模块进行升级。该方法的流程如图1和图2所示,具体实现过程如下:In the present invention, by modularizing the application program of the electric energy meter according to the program function, the application program storage space of the electric energy meter software is divided to obtain at least two storage subspaces, which are respectively used to store the functional modules of the electric energy meter application program; and then Compile the target files of each function module in the application program of the electric energy meter to the specified starting address of the corresponding storage subspace; finally store the upgrade file of the application program function module of the electric energy meter to be upgraded in the corresponding upgrade area of the memory chip, and store the Put the upgrade file in the upgrade area of the memory chip and move it to the corresponding storage subspace to upgrade the functional module. The flow of this method is shown in Figure 1 and Figure 2, and the specific implementation process is as follows:

1.将电能表应用程序按程序功能进行模块化划分,将电能表软件的应用程序存储空间进行划分。1. Divide the energy meter application program into modules according to program functions, and divide the application program storage space of the energy meter software.

本实施例以瑞萨RX65N7A单片机的电能表为例进行说明,电能表硬件上由RX65N7A单片机、NorFlash存储芯片及其它电路组成,电能表软件由Boot程序和电能表应用程序组成,电能表应用程序按程序功能进行模块化划分为module_1,module_2,module_n等组成。单片机ROM存放单片机的指令代码和一些固定数值,程序运行后不可改动,瑞萨RX65N7A单片机ROM空间736K,共30个Block,每个Block空间分配如表1所示。This embodiment takes Renesas RX65N7A single-chip electric energy meter as an example for illustration. The electric energy meter hardware is composed of RX65N7A single-chip microcomputer, NorFlash memory chip and other circuits. The electric energy meter software is composed of Boot program and electric energy meter application program. The program function is modularized and divided into module_1, module_2, module_n and so on. The single-chip ROM stores the instruction code and some fixed values of the single-chip microcomputer, which cannot be changed after the program is running. The ROM space of the Renesas RX65N7A single-chip microcomputer is 736K, with a total of 30 blocks. The space allocation of each block is shown in Table 1.

表1Table 1

单片机ROM区是按Block为单元进行擦除,因此同一Block不能存放一个以上模块程序。Boot程序占用0xFFFF8000-0xFFFFFFFF(Block3–Block0)32KB大小空间,其它Block空间分配给电能表应用程序。每个应用模块先分配32KB空间,后续根据实际编译结果进行调整,每个模块分配空间预留20%余量。各模块ROM空间起始地址及大小见表2所示。The ROM area of the single-chip microcomputer is erased according to the unit of Block, so the same Block cannot store more than one module program. The Boot program occupies 0xFFFF8000-0xFFFFFFFF (Block3–Block0) 32KB space, and other Block spaces are allocated to the energy meter application program. Each application module first allocates 32KB of space, and then adjusts it according to the actual compilation results, and reserves 20% of the space allocated for each module. The starting address and size of each module ROM space are shown in Table 2.

表2Table 2

其中GPRS通信模块(与计量芯通信模块)分配的程序空间起始地址为0xFFFF0000,如图4所示The starting address of the program space allocated by the GPRS communication module (communication module with the metering core) is 0xFFFF0000, as shown in Figure 4

2.将电能表的应用程序中的各应用模块的目标文件编译到对应模块化存储子空间的指定起始地址。2. Compile the target files of each application module in the application program of the electric energy meter to the specified starting address of the corresponding modular storage subspace.

编译器支持将变量存放在模块程序空间的起始位置,保证每个模块对外的接口函数地址空间不改变。模块化程序ROM空间预先分配,采用间接寻址方式进行空间分配,可解决某一模块编译后模块文件大小超出预期预留空间值时导致占用其它模块空间问题。The compiler supports storing variables at the beginning of the module program space to ensure that the address space of the external interface functions of each module does not change. The ROM space of the modular program is pre-allocated, and the indirect addressing method is used for space allocation, which can solve the problem of occupying other modules when the size of the module file exceeds the expected reserved space value after a certain module is compiled.

间接寻址方式空间分配方法:Indirect addressing mode space allocation method:

Boot程序中定义各模块入口地址:The entry address of each module is defined in the Boot program:

Const u32moduleAddr[]={0xffff0000,0xfffe8000,0xfffe0000,0xfffd8000,……};其中moduleAddr编译到Boot程序ROM空间的固定位置,如0xfffff800。moduleAddr[]数组中的数值为电能表各软件模块在ROM中的起始位置。模块化升级时通过协议将模块的ROM起始位置传输进来,当模块位置改变时修改moduleAddr[]中对应的变量值即可。Const u32moduleAddr[]={0xffff0000, 0xfffe8000, 0xfffe0000, 0xfffd8000, ...}; where moduleAddr is compiled to a fixed location in the Boot program ROM space, such as 0xfffff800. The value in the moduleAddr[] array is the starting position of each software module of the electric energy meter in ROM. When the module is upgraded, the ROM start position of the module is transmitted through the protocol. When the module position changes, the corresponding variable value in moduleAddr[] can be modified.

编译时产生不同模块的***.hex或***.bin目标码,对GPRS通信模块而言,编译生成gprs.hex模块的目标码,如图5所示。The ***.hex or ***.bin object codes of different modules are generated during compilation. For the GPRS communication module, the object code of the gprs.hex module is compiled and generated, as shown in Figure 5.

3.对电能表进行模块化升级。3. Modular upgrade of the electric energy meter.

将待升级的电能表应用程序功能模块的升级文件存放到存储芯片对应的升级区域,并将放到存储芯片的升级区域中升级文件搬运至相应的存储子空间,对该功能模块进行升级Store the upgrade file of the application function module of the electric energy meter to be upgraded in the upgrade area corresponding to the memory chip, and put the upgrade file in the upgrade area of the memory chip and move the upgrade file to the corresponding storage subspace to upgrade the function module

本发明使用norFlash作为存储芯片,其中30~31M区域作为模块程序升级区域,升级完并CRC效验正确后写Flash指定位置升级完成标志0x55aa,重启芯片。芯片boot程序检测Flash指定位置0x55aa标志,进行程序备份和覆盖升级,清除Flash指定位置0x55aa标志,各模块升级标志存放地址和模块程序存放地址见表3所示。The present invention uses norFlash as the storage chip, wherein the 30-31M area is used as the module program upgrade area, after the upgrade is completed and the CRC check is correct, the upgrade completion flag 0x55aa is written at the designated position of the Flash, and the chip is restarted. The chip boot program detects the 0x55aa mark at the designated location of Flash, performs program backup and overwrite upgrade, and clears the 0x55aa mark at the designated location of Flash.

表3table 3

模块名称module name地址范围address range空间大小size of space与计量芯通信模块Communication module with metering core0x1E00000-0x1E18FFF0x1E00000-0x1E18FFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag上行载波通信模块Uplink carrier communication module0x1E19000-0x1E31FFF0x1E19000-0x1E31FFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag下行通信模块Downlink communication module0x1E32000-0x1E4AFFF0x1E32000-0x1E4AFFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag红外通信模块Infrared communication module0x1E4B000–0x1E63FFF0x1E4B000–0x1E63FFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag485通信模块485 communication module0x1E64000–0x1E7CFFF0x1E64000–0x1E7CFFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag协议库protocol library0x1E7D000–0x1E95FFF0x1E7D000–0x1E95FFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag系统管理模块System Management Module0x1E96000–0x1EAEFFF0x1E96000–0x1EAEFFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag统计模块Statistics module0x1EAF000–0x1EC7FFF0x1EAF000–0x1EC7FFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag控制模块control module0x1EC8000–0x1EE0FFF0x1EC8000–0x1EE0FFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag数据访问模块data access module0x1EE1000–0x1EF9FFF0x1EE1000–0x1EF9FFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag显示模块display module0x1EFA000–0x1F12FFF0x1EFA000–0x1F12FFF100KB前2字节存放升级标志The first 2 bytes of 100KB store the upgrade flag

每次升级一个模块方案:目标文件合成,通过第3方软件将模块目标文件aaa.bin合成模块编号和crc32码,如表4所示。Upgrade one module plan at a time: Synthesize the target file, and synthesize the module target file aaa.bin into the module number and crc32 code through the third-party software, as shown in Table 4.

表4Table 4

模块编号1字节Module number 1 byteCrc32码Crc32 code模块目标码module object code

每次升级N个模块方案:目标文件合成,通过第3方软件按如下格式合成软件,具体格式如表5所示。Upgrade N modules each time: Synthesize the target file, and synthesize the software through the third-party software according to the following format. The specific format is shown in Table 5.

表5table 5

4.程序备份及启用4. Program backup and activation

模块程序升级后需要通过命令恢复到升级前的版本时,需要程序备份功能。使用外部FLASH 28~30M区域作为模块备份区域,boot启动判断有模块要升级时,将原ROM区域程序拷贝到对应备份区空间。CPU芯片接收到指令恢复模块原版本程序时,将备份区程序拷贝到对应的升级区Flash空间,并写对应0x55aa升级标志,重启CPU,如表6所示。When the module program needs to be restored to the version before the upgrade through commands after the upgrade, the program backup function is required. Use the external FLASH 28~30M area as the module backup area. When the boot starts to judge that there is a module to be upgraded, copy the original ROM area program to the corresponding backup area space. When the CPU chip receives the command to restore the original program of the module, copy the backup area program to the corresponding upgrade area Flash space, write the corresponding 0x55aa upgrade flag, and restart the CPU, as shown in Table 6.

表6Table 6

模块名称module name地址范围address range空间大小size of space与计量芯通信模块Communication module with metering core0x1C00000-0x1C18FFF0x1C00000-0x1C18FFF100KB100KB上行载波通信模块Uplink carrier communication module0x1C19000-0x1C31FFF0x1C19000-0x1C31FFF100KB100KB下行通信模块Downlink communication module0x1C32000-0x1C4AFFF0x1C32000-0x1C4AFFF100KB100KB红外通信模块Infrared communication module0x1C4B000–0x1C63FFF0x1C4B000–0x1C63FFF100KB100KB485通信模块485 communication module0x1C64000–0x1C7CFFF0x1C64000–0x1C7CFFF100KB100KB协议库protocol library0x1C7D000–0x1C95FFF0x1C7D000–0x1C95FFF100KB100KB系统管理模块System Management Module0x1C96000–0x1CAEFFF0x1C96000–0x1CAEFFF100KB100KB统计模块Statistics module0x1CAF000–0x1CC7FFF0x1CAF000–0x1CC7FFF100KB100KB控制模块control module0x1CC8000–0x1CE0FFF0x1CC8000–0x1CE0FFF100KB100KB数据访问模块data access module0x1CE1000–0x1CF9FFF0x1CE1000–0x1CF9FFF100KB100KB显示模块display module0x1CFA000–0x1D12FFF0x1CFA000–0x1D12FFF100KB100KB

模块程序升级后若想恢复升级前的版本,可通过外部命令进行模块程序恢复,其流程如图3所示。After the module program is upgraded, if you want to restore the version before the upgrade, you can restore the module program through an external command. The process is shown in Figure 3.

本发明将电能表软件按照电能表的功能进行模块划分,每个功能模块编译产生模块化文件,将各模块化文件分别升级到电能表单片机ROM的指定区域;可实现对各模块的单独升级。升级方式简单,大大提高了升级效率。The invention divides the electric energy meter software into modules according to the functions of the electric energy meter, compiles and generates modularized files for each functional module, and upgrades each modularized file to a designated area of the ROM of the electric energy meter chip computer; the individual upgrade of each module can be realized. The upgrade method is simple, which greatly improves the upgrade efficiency.

Claims (10)

Translated fromChinese
1.一种电能表软件模块化升级方法,其特征在于,该模块化升级方法包括以下步骤:1. A method for upgrading electric energy meter software modularization, it is characterized in that, this modularization method for upgrading comprises the following steps:1)将电能表应用程序按程序功能进行模块化划分,将电能表软件的应用程序存储空间进行划分,得到至少两个存储子空间,分别用于存储电能表应用程序的各功能模块;1) Carry out modular division of the electric energy meter application program according to the program function, divide the application program storage space of the electric energy meter software, obtain at least two storage subspaces, which are respectively used to store each functional module of the electric energy meter application program;2)将电能表的应用程序中各功能模块的目标文件编译到对应存储子空间的指定起始地址;2) compiling the target files of each function module in the application program of the electric energy meter to the specified starting address of the corresponding storage subspace;3)将待升级的电能表应用程序功能模块的升级文件存放到存储芯片对应的升级区域,并将放到存储芯片的升级区域中升级文件搬运至相应的存储子空间,对该功能模块进行升级。3) Store the upgrade file of the application function module of the electric energy meter to be upgraded in the upgrade area corresponding to the memory chip, and place the upgrade file in the upgrade area of the memory chip and move the upgrade file to the corresponding storage subspace to upgrade the function module .2.根据权利要求1所述的电能表软件模块化升级方法,其特征在于,所述步骤1)中应用程序存储空间采用间接寻址方式进行空间分配。2. The method for upgrading the electric energy meter software modularization according to claim 1, characterized in that, in the step 1), the storage space of the application program adopts an indirect addressing method for space allocation.3.根据权利要求2所述的电能表软件模块化升级方法,其特征在于,采用间接寻址方式进行空间分配过程为:采用Boot程序定义各应用程序功能模块的入口地址为各应用程序功能模块在对应存储子空间中的起始位置,利用应用程序功能模块的入口地址对各应用程序进行升级操作。3. the electric energy meter software modularization upgrade method according to claim 2, is characterized in that, adopts indirect addressing mode to carry out space allocation process as: adopt Boot program to define the entry address of each application program function module as each application program function module At the starting position in the corresponding storage subspace, each application program is upgraded using the entry address of the application program function module.4.根据权利要求1所述的电能表软件模块化升级方法,其特征在于,在将待升级的电能表应用程序功能模块的升级文件存放到存储芯片的升级区域时,需对存储的升级文件进行校验。4. The method for upgrading the electric energy meter software modularization according to claim 1, characterized in that, when the upgrade file of the electric energy meter application program function module to be upgraded is stored in the upgrade area of the memory chip, the stored upgrade file needs to be updated. Verify.5.根据权利要求4所述的电能表软件模块化升级方法,其特征在于,若升级文件校验正确,则在该升级文件存放位置的指定区域增加升级成功标志。5. The method for upgrading the electric energy meter software modularization according to claim 4, wherein if the upgrade file is verified to be correct, an upgrade success mark is added in the designated area where the upgrade file is stored.6.根据权利要求5所述的电能表软件模块化升级方法,其特征在于,在检测到升级成功标志时,备份电能表应用程序功能模块到存储芯片备份区域,并清除相应的升级成功标志。6. The method for upgrading the electric energy meter software modularization according to claim 5, characterized in that, when the upgrade success flag is detected, the electric energy meter application program function module is backed up to the memory chip backup area, and the corresponding upgrade success flag is cleared.7.一种电能表系统,包括单片机芯片、存储芯片以及运行的Boot程序和电能表应用程序,其特征在于,所述的电能表应用程序按程序功能进行模块化划分,电能表软件的应用程序存储空间进行划分,得到至少两个存储子空间,分别用于存储电能表应用程序的各功能模块;电能表的应用程序中各功能模块的目标文件被编译到对应存储子空间的指定起始地址;待升级的电能表应用程序功能模块的升级文件被存放到存储芯片对应的升级区域,存放到存储芯片的升级区域中升级文件被搬运至相应的存储子空间。7. A kind of electric energy meter system, comprises single-chip microcomputer chip, storage chip and the Boot program of operation and electric energy meter application program, it is characterized in that, described electric energy meter application program is carried out modular division by program function, the application program of electric energy meter software The storage space is divided to obtain at least two storage subspaces, which are respectively used to store the functional modules of the application program of the electric energy meter; the target files of each functional module in the application program of the electric energy meter are compiled to the specified start address of the corresponding storage subspace ; The upgrade file of the application function module of the electric energy meter to be upgraded is stored in the upgrade area corresponding to the memory chip, and the upgrade file stored in the upgrade area of the memory chip is transferred to the corresponding storage subspace.8.根据权利要求7所述的电能表系统,其特征在于,应用程序存储空间采用间接寻址方式进行空间分配。8. The electric energy meter system according to claim 7, wherein the storage space of the application program is allocated in an indirect addressing manner.9.根据权利要求8所述的电能表系统,其特征在于,采用间接寻址方式进行空间分配过程为:采用Boot程序定义各应用程序功能模块的入口地址为各应用程序功能模块在对应存储子空间中的起始位置,利用应用程序功能模块的入口地址对各应用程序进行升级操作。9. The electric energy meter system according to claim 8, characterized in that, adopting indirect addressing mode to carry out space allocation process is: adopt Boot program to define the entry address of each application program function module as each application program function module in the corresponding memory sub Each application program is upgraded using the entry address of the application program function module.10.根据权利要求7所述的电能表系统,其特征在于,在将放到存储芯片的升级区域中升级文件搬运至相应的存储子空间前,需备份该电能表应用程序功能模块到存储芯片相应的备份区域。10. The electric energy meter system according to claim 7, characterized in that, before the upgrade file in the upgrade area of the memory chip is transferred to the corresponding storage subspace, the electric energy meter application function module needs to be backed up to the memory chip corresponding backup area.
CN201810124992.7A2018-02-072018-02-07A kind of electric energy meter software modularization upgrading method and electric energy meter systemPendingCN110119281A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201810124992.7ACN110119281A (en)2018-02-072018-02-07A kind of electric energy meter software modularization upgrading method and electric energy meter system

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201810124992.7ACN110119281A (en)2018-02-072018-02-07A kind of electric energy meter software modularization upgrading method and electric energy meter system

Publications (1)

Publication NumberPublication Date
CN110119281Atrue CN110119281A (en)2019-08-13

Family

ID=67519645

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201810124992.7APendingCN110119281A (en)2018-02-072018-02-07A kind of electric energy meter software modularization upgrading method and electric energy meter system

Country Status (1)

CountryLink
CN (1)CN110119281A (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111314133A (en)*2020-02-142020-06-19宁波三星智能电气有限公司Ammeter communication module upgrading method, ammeter control module and ammeter communication module
CN112230962A (en)*2020-10-282021-01-15山东超越数控电子股份有限公司BIOS configuration storage method and system for processor platform
CN112650520A (en)*2020-12-312021-04-13威胜集团有限公司Ammeter upgrading method and system, intelligent ammeter and storage medium
CN112667272A (en)*2020-12-312021-04-16威胜集团有限公司Ammeter upgrading method and system, intelligent ammeter and storage medium
CN113031984A (en)*2021-02-072021-06-25南方电网数字电网研究院有限公司Remote online upgrading method and device for application program of double-core intelligent ammeter management unit
CN113282319A (en)*2021-05-282021-08-20武汉天喻信息产业股份有限公司Smart card and updating method thereof
CN113312078A (en)*2021-05-072021-08-27南方电网数字电网研究院有限公司Electric energy meter software modularization difference upgrading method and electric energy meter system
CN114138201A (en)*2021-12-022022-03-04国网山东省电力公司营销服务中心(计量中心)Electric energy meter built-in memory data storage monitoring method and system
CN114490178A (en)*2021-12-222022-05-13青岛乾程科技股份有限公司 Method for upgrading electric energy meter software and electric energy meter
CN115080064A (en)*2022-05-132022-09-20深圳市科陆电子科技股份有限公司Electric meter function updating method, upper computer, electric meter and computer readable storage medium
CN115098138A (en)*2022-07-082022-09-23珠海冠宇电源有限公司Function upgrading method and device of battery management system, electronic equipment and medium
CN115729602A (en)*2021-08-312023-03-03佛山市顺德区美的电子科技有限公司Program upgrading method and device for air conditioner, air conditioner and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN103019788A (en)*2012-12-142013-04-03上海邮政科学研究院Remote online upgrading method based on CAN (Controller Area Network) bus
CN103425505A (en)*2012-05-212013-12-04深圳市金正方科技有限公司IC card electric energy meter on-line upgrading method and system
CN104090796A (en)*2014-07-082014-10-08成都万维图新信息技术有限公司Embedded device program updating method and system
CN105487909A (en)*2016-01-142016-04-13江苏林洋能源股份有限公司Method for reducing firmware upgrading amount of electrical equipment
CN105912356A (en)*2016-03-312016-08-31武汉光迅科技股份有限公司Optical module firmware program online upgrade method supporting version fallback

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN103425505A (en)*2012-05-212013-12-04深圳市金正方科技有限公司IC card electric energy meter on-line upgrading method and system
CN103019788A (en)*2012-12-142013-04-03上海邮政科学研究院Remote online upgrading method based on CAN (Controller Area Network) bus
CN104090796A (en)*2014-07-082014-10-08成都万维图新信息技术有限公司Embedded device program updating method and system
CN105487909A (en)*2016-01-142016-04-13江苏林洋能源股份有限公司Method for reducing firmware upgrading amount of electrical equipment
CN105912356A (en)*2016-03-312016-08-31武汉光迅科技股份有限公司Optical module firmware program online upgrade method supporting version fallback

Cited By (14)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111314133A (en)*2020-02-142020-06-19宁波三星智能电气有限公司Ammeter communication module upgrading method, ammeter control module and ammeter communication module
CN112230962A (en)*2020-10-282021-01-15山东超越数控电子股份有限公司BIOS configuration storage method and system for processor platform
CN112230962B (en)*2020-10-282023-12-22超越科技股份有限公司BIOS configuration storage method and system for processor platform
WO2022142153A1 (en)*2020-12-312022-07-07威胜集团有限公司Electricity meter upgrading method and system, smart meter, and storage medium
CN112667272A (en)*2020-12-312021-04-16威胜集团有限公司Ammeter upgrading method and system, intelligent ammeter and storage medium
CN112650520A (en)*2020-12-312021-04-13威胜集团有限公司Ammeter upgrading method and system, intelligent ammeter and storage medium
CN113031984A (en)*2021-02-072021-06-25南方电网数字电网研究院有限公司Remote online upgrading method and device for application program of double-core intelligent ammeter management unit
CN113312078A (en)*2021-05-072021-08-27南方电网数字电网研究院有限公司Electric energy meter software modularization difference upgrading method and electric energy meter system
CN113282319A (en)*2021-05-282021-08-20武汉天喻信息产业股份有限公司Smart card and updating method thereof
CN115729602A (en)*2021-08-312023-03-03佛山市顺德区美的电子科技有限公司Program upgrading method and device for air conditioner, air conditioner and readable storage medium
CN114138201A (en)*2021-12-022022-03-04国网山东省电力公司营销服务中心(计量中心)Electric energy meter built-in memory data storage monitoring method and system
CN114490178A (en)*2021-12-222022-05-13青岛乾程科技股份有限公司 Method for upgrading electric energy meter software and electric energy meter
CN115080064A (en)*2022-05-132022-09-20深圳市科陆电子科技股份有限公司Electric meter function updating method, upper computer, electric meter and computer readable storage medium
CN115098138A (en)*2022-07-082022-09-23珠海冠宇电源有限公司Function upgrading method and device of battery management system, electronic equipment and medium

Similar Documents

PublicationPublication DateTitle
CN110119281A (en)A kind of electric energy meter software modularization upgrading method and electric energy meter system
CN111309364B (en)Chip program upgrading method and device and storage medium
CN105740157B (en)data storage device and flash memory control method
WO2015070521A1 (en)Method for making ubi format system file into factory burnt image file
CN102360304B (en)Embedded microprocessor system and method for updating firmware thereof
CN110633091A (en)Electronic module and software wireless upgrading method thereof
CN105117253A (en)BootLoader based remote upgrade method for UV LED (Ultraviolet Light Emitting Diode) curing system
CN103793238A (en)Rack and method for simultaneously updating multiple basic input output systems thereof
CN113672270B (en) Upgrading method, computer system and remote upgrading device
CN102945174A (en) The Method of Upgrading the Program of Single-chip Microcomputer by Attaching the External Flash
CN111782246A (en) Method of Upgrading Embedded Program of Multi-node Equipment Based on Bus
CN105988722A (en)Data storage method and embedded system
CN102662852A (en)Method for storing nonvolatile data by using MCU internal data Flash
CN104965725A (en)SD-card based full-automatic firmware programming method for embedded equipment
CN120086162B (en) A memory and firmware optimization method thereof
CN103578566B (en) Memory storage device and repair method thereof
CN108255510B (en)IAP-based transmission verification design method for online upgrading of firmware to be upgraded
CN111176665B (en)High-capacity emmc mirror image manufacturing method and device
CN105095101A (en)Method and device for writing data in memorizer and intelligent card
CN102005245A (en)Intelligent card erasing and writing protection method
CN112083927B (en)Method for acquiring SVN version information of software in power acquisition terminal on site
CN118779150A (en) Method, system and application for implementing dual backup of upgrade by multiplexing user data area
CN117742763A (en)ECU firmware upgrading method, device, system, automobile and storage medium
CN116719573A (en) A two-level boot loader controller program startup and flashing method
CN115756651A (en)Business module dynamic loading system and method based on Internet of things

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication
RJ01Rejection of invention patent application after publication

Application publication date:20190813


[8]ページ先頭

©2009-2025 Movatter.jp