Background technology
The monitoring software that moves on the direct amplifying station monitoring need be upgraded.Because the position that is provided with of repeater relatively disperses, and the operated by rotary motion position is more remote, field upgrade is cumbersome.Therefore, it is necessary that monitoring software on the direct amplifying station monitoring is carried out remote upgrade, promptly, in Surveillance center at selected repeater, the monitoring software of upgrading and moving on its supervisory control system by the mode of remote download, with timely realization new monitoring function or solution software defect, reduce maintenance cost.Remote upgrade requires high reliability, high success rate, high efficiency.
Application number is that 200610052609.9 Chinese invention patent application discloses and a kind of the monitoring software that moves on the repeater carried out the method for remote upgrade, and this method mainly comprises following process:
1, OMT software is installed on operation maintenance center's computer, is prepared new embedded software;
2, operation maintenance center's computer and direct amplifying station monitoring carry out wireless connections;
3, enter application area after repeater equipment powers on and carry out normal monitor task program, and wait for the monitored instruction of operation maintenance center;
4, the OMT in the operation maintenance center sends software upgrade instruction by wireless module;
5, several head of repeater equipment just reply scalable information and give operation maintenance center to software upgrade instruction as upgrading, and prepare to receive new software code;
6, operation maintenance center sends new software code, and repeater equipment receives new software code, and code is temporarily stored in the high address district of RAM;
7, after repeater equipment is received whole codes and verification correctly, jump to IAP program area execution flash and write with a brush dipped in Chinese ink program, new software is write with a brush dipped in Chinese ink application area;
8, IAP writes with a brush dipped in Chinese ink successfully back resetting system, carries out new software, finishes at applied remote upgrade to this embedded software.
Said method has following shortcoming,
1, direct amplifying station monitoring stores the fresh code that receives in the internal memory (RAM) into, if system cut-off in the transmission course, then whole upgrade process is interrupted, and can't preserve the fresh code of having downloaded, and can only download again next time, loses time.
2, fresh code is just directly write with a brush dipped in Chinese ink application area after downloading and finishing, the application program of legacy version can't be preserved, if new program defectiveness or can not normally move for some reason in running, then the supervisory control system of whole repeater will quit work, and the application program that can not return to legacy version continues to use.
Summary of the invention
The remote upgrade and the version-switching method that the purpose of this invention is to provide a kind of repeater equipment embedded software use this method not only can carry out remote upgrade, and can realize the switching between the software new and old edition.
For achieving the above object, the invention provides following technical scheme:
The remote upgrade of repeater equipment embedded software and version-switching method,
Wherein,
The Single Chip Microcomputer (SCM) program of repeater equipment supervisory control system is divided into Bootloader program and application program 2 parts, and the preceding 124K byte of Flash is an application area on the sheet of described single-chip microcomputer, and back 4K byte is the Bootloader program area; Application program is divided into monitoring mode and 2 kinds of exclusive mode of upgrade mode, receives the upgrade file packet under the upgrade mode, and monitoring mode is carried out policer operation down; Redaction program storage area, legacy version program storage area and each the 124k byte of memory block that downloads are arranged among Flash or the outside Flash on the sheet of single-chip microcomputer; In Bootloader program and application program, distribute the flag data space of same address to be used for the mutual purpose of parameter, these flag datas all are stored on the sheet of single-chip microcomputer among the EEPROM, described flag data comprises, remote upgrade result, new/old program have been preserved sign, software upgrading sign, remote upgrade sign, program backup sign, upgrading failure flags, program fail sign, software switching mark, have been switched acknowledgement indicator, current working procedure sign, newly/old program switches to old/new procedures failure flags;
Step 1, the repeater equipment supervisory control system receives the instruction of OMC or OMT in real time, if the instruction that OMC or OMT send is a upgrade command, enter step 2,, jump to step 5 if be the version switching command, if do not receive the instruction that OMC or OMT send, jump to step 6;
Step 2 receives the upgrade file packet from OMC or OMT, and the upgrade file packet that receives is saved to the described memory block that downloads;
Step 3 is programmed into the The application of single-chip computer program area with the download program code in the memory block that downloads;
Step 4, the byte-by-byte application area code data of reading writes described redaction program storage area, finishes the backup of new procedures code;
Step 5, if current working procedure is the redaction program, program code in the legacy version program storage area is programmed into the The application of single-chip computer program area,, the program code in the redaction program storage area is programmed into the The application of single-chip computer program area if current working procedure is the legacy version program;
Step 6, the monitoring mode of executive utility carries out policer operation, and the repeater equipment supervisory control system receives the instruction of OMC or OMT in real time.
In the said method, Flash or outside Flash store newly downloaded program code on the sheet of employing single-chip microcomputer, and new, old code all preserved, if newly downloaded program code can't use, perhaps, can conveniently carry out the switching of new and old program version owing to other reasons needs to use old program code.And can realize breakpoint transmission to newly downloaded program code, save the download time of new procedures code.
Embodiment
1, program file explanation
The repeater equipment monitoring software is based on the ATmega128 microcomputer development.The ATmega128 Single Chip Microcomputer (SCM) program is divided into Bootloader program and application program 2 parts.By revising the Makefile file of Bootloader program, the Bootloader program is positioned place, 0x1F000 address.Application program is then given tacit consent to and is positioned 0x00000 address place.
Chip program must be downloaded with fever writes first, could realize the remote upgrade function afterwards.The programming program file is the merge file of Bootloader program and application program Hex file, and the ROMPaq file is the Binary file of application program.Only refresh application area during remote upgrade, the Bootloader program area is constant.Still is the Binary form by revising Makefile file selection compiling output file for the Hex form, and the Binary file size is less than 1/3rd of the Hex file.
Hex file merging method: Bootloader program and application program are compiled as the Hex form respectively, open Bootloader program Hex file and application program Hex file after the compiling respectively with UltraEdit32 software, last 1 row of deletion application program Hex file, Bootloader program Hex file copy to application program Hex file back, is about to two Hex program files merging and obtains final programming program file.
2, routine data allocation of space
ATmega128 is total to Flash on the 128K chunk, and preceding 124K byte is an application area, and back 4K byte is the Bootloader program area.This fuse bit by programming ATmega128 single-chip microcomputer is selected.Initial address from the Bootloader district during electrification reset begins executive program, sees Fig. 1.
Outside 512K bytes Flash is used for the storage backup program, certainly, if the Flash space is enough on the sheet of single-chip microcomputer, also can use Flash on the sheet.Wherein, the 124K space of 0x00000~0x1EFFF is the redaction program storage area; The 124K space of 0x20000~0x3EFFF is the legacy version program storage area; The 124K space of 0x40000~0x5EFFF is the memory block that downloads; All the other space to be preserved.
3, the flag data of Bootloader program and application program is mutual
In Bootloader program and application program, distribute the flag data space of same address to be used for the mutual purpose of parameter.These flag datas all are stored on the sheet of ATmega128 among the EEPROM.Part key point data have also been done back-up processing in EEPROM, strengthening reliability, when reading as long as one of memory block or backup area for very, memory block and backup area all write when writing.
These flag datas comprise: remote upgrade result, new/old program have been preserved sign, software upgrading sign, remote upgrade sign, program backup sign, upgrading failure flags, program fail sign, software switching mark, have been switched acknowledgement indicator, current working procedure sign, newly/old program switches to old/new procedures failure flags.
4, the rollback operation principle when upgrading or version handoff failure
The Bootloader program is from outside Flash memory block (or new, legacy version program storage area) the fetch program data that download, after refreshing the application program area code, earlier refresh failure flags by the setting of Bootloader program, promptly hypothesis refreshes failure, when application program is carried out certain position, can confirm the application program Flushing success, promptly confirm software upgrading or version handover success, remove again this moment and refresh failure flags.If program updating is made mistakes, then application program can't normally be carried out, and watchdog function makes single-chip microcomputer reset, and carries out the Bootloader program once more, detects and refreshes failure flags, reads the original version routine data from outside Flash, refreshes the application program area code again.Idiographic flow is seen Fig. 1, Fig. 2.
5, program backup principle
Power on when restarting for the 1st time after the device program programming, the Bootloader program reads the application program area code, with its redaction program storage area that backs up to outside Flash, sees Fig. 2.
Software upgrading finishes, and carries out the stand-by program operation by application program, sees Fig. 3.If current working procedure is a new procedures, the redaction program storage area data with outside Flash are transferred to the legacy version program storage area earlier, and the storage area data that will download again is transferred to the redaction program storage area.If current working procedure is old program, the storage area data that directly will download is transferred to the redaction program storage area, changes current working procedure sign into new procedures again.
6, ROMPaq file downloading mode
The ROMPaq file both can pass through remote monitoring center (OMC) to be downloaded, and also can download by the direct-connected software of local serial ports (OMT).The communication protocol data interactive mode is in full accord, and just the former adopts GPRSModem, and the latter adopts the RS232 serial ports.The GPRS transmission can be adopted TCP or UDP mode.
Application program is divided into monitoring mode and 2 kinds of exclusive mode of upgrade mode, receives the upgrade file packet under the upgrade mode, and monitoring mode is carried out policer operation down, and idiographic flow is seen Fig. 1, Fig. 4.
7, the automatic recognition principle of illegal update file
Preceding tens bytes of the Binary program file of ATmega128 are fixing character string, if preceding some bytes and this character string of upgrade file the 1st bag data do not match, think that then this file in download is illegal.
In program source file, insert one section specific character string that comprises producer's sign and device type identification information, this character string will appear at certain position, front of Binary file after the compiling, if before upgrade file, search this character string in some bag data, whether the compare facilities type identification information is consistent with this equipment, thereby prevents that upgrade file from artificially selecting the generation of wrong phenomenon.
When detecting the illegal update file, withdraw from upgrade mode immediately and restart, idiographic flow is seen Fig. 4.
8, breakpoint transmission principle
When OMC or OMT cancellation upgrading, or communication link causes upgrade file to be downloaded when interrupting unusually, equipment is preserved last 1 complete data packet sequence number value (being the breakpoint data), because data packet length is fixed, when OMC or OMT start upgrading next time, can begin to send packet from breakpoint, idiographic flow is seen Fig. 1, Fig. 4.
9, software version switching principle
Equipment checks whether new and old program all preserves after receiving the software version switching command from OMC or OMT, if all preserve, the software switching mark then is set, and returns handover success and reply to OMC or OMT, sees Fig. 5.
Equipment is restarted automatically with executive software version handover operation, and upgrades current working procedure sign, and idiographic flow is seen Fig. 1, Fig. 2.After a few minutes, OMC or OMT confirm by query facility monitoring software version information whether software version switches successful.
The remote upgrade of repeater equipment embedded software of the present invention and the basic procedure of version-switching method be,
Step 1, the repeater equipment supervisory control system receives the instruction of OMC or OMT in real time, if the instruction that OMC or OMT send is a upgrade command, enter step 2,, jump to step 5 if be the version switching command, if do not receive the instruction that OMC or OMT send, jump to step 6;
Step 2 receives the upgrade file packet from OMC or OMT, and the upgrade file packet that receives is saved to the described memory block that downloads;
Step 3 is programmed into the The application of single-chip computer program area with the download program code in the memory block that downloads;
Step 4, the byte-by-byte application area code data of reading writes described redaction program storage area, finishes the backup of new procedures code;
Step 5, if current working procedure is the redaction program, program code in the legacy version program storage area is programmed into the The application of single-chip computer program area,, the program code in the redaction program storage area is programmed into the The application of single-chip computer program area if current working procedure is the legacy version program;
Step 6, the monitoring mode of executive utility carries out policer operation, and the repeater equipment supervisory control system receives the instruction of OMC or OMT in real time.
Specifically carrying out remote upgrade is (combining Fig. 1) with the concrete handling process that version switches,
1, Bootloader district program brings into operation from the 0x1F000 address;
2, the application area program brings into operation from the 0x00000 address;
3, software upgrading and switching initialization are handled;
4, judge whether the current operation of application program is upgrade mode, if, enter 5, if not, be transferred to 15;
5, judge whether to receive the upgrade file packet from OMC or OMT, if, enter 6, if not, jump to 7;
6, the upgrade file download process;
7, check upgrade file download finishing sign, if upgrade file is downloaded to finish to be masked as be, enter 8, if downloading to finish, upgrade file is masked as not, jump to 12;
8, judge whether the upgrade file CRC check is successful, if success enters 9, if failure jumps to 11;
9, the software upgrading sign is set;
10, the breakpoint data are clear 0, and reboot flag is set, and application program changes monitoring mode over to, and jumps to 15;
11, preserve the upgrade file CRC result that makes mistakes, reboot flag is set, and jumps to 10;
12, the inspection upgrade file is being downloaded sign, if upgrade file is being downloaded to be masked as is, enters 13, is masked as not if upgrade file is being downloaded, and jumps to 15;
13, judge whether communication link is overtime, if, enter 14, if not, jump to 15;
14, preserve the overtime result of remote upgrade link, preserve the breakpoint data, reboot flag is set, application program changes monitoring mode over to, enters 15;
15, judge whether to receive order or data from OMC or OMT, if, enter 16, if not, jump to 17;
16, execution OMC or OMT give an order and operate accordingly, and enter 17;
17, check the remote upgrade sign, if remote upgrade is masked as be, jump to 19, if remote upgrade is masked as not, enter 18;
18, check reboot flag, if this reboot flag turns back to 2 for being, if this reboot flag enters 20 for not;
19, the remote upgrade result is reported to OMC or OMT, remove the remote upgrade sign, and enter 18;
20, check software upgrading sign or software switching mark, if institute's checkmark turns back to 1 for being, if institute's checkmark turns back to 4 for not.
The process chart of Fig. 2 Bootloader program, the idiographic flow of promptly above-mentioned 1 step, Fig. 3 are 3 steps ground idiographic flows.Owing among each figure explanatory note is arranged all, does not do at this and give unnecessary details.
Certainly, the remote upgrade of repeater equipment embedded software of the present invention and version-switching method also can have other distortion.In a word, do conspicuous change, and other every change that does not break away from essence of the present invention all should be included within the described scope of claim according to the prompting of above-mentioned example.