CN110162421B - Embedded software watchdog test method and device containing interrupt function - Google Patents

Embedded software watchdog test method and device containing interrupt function Download PDF

Info

Publication number
CN110162421B
CN110162421B CN201910347841.2A CN201910347841A CN110162421B CN 110162421 B CN110162421 B CN 110162421B CN 201910347841 A CN201910347841 A CN 201910347841A CN 110162421 B CN110162421 B CN 110162421B
Authority
CN
China
Prior art keywords
watchdog
function
software
program
signal
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.)
Active
Application number
CN201910347841.2A
Other languages
Chinese (zh)
Other versions
CN110162421A (en
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.)
Beihang University
Original Assignee
Beihang University
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 Beihang University filed Critical Beihang University
Priority to CN201910347841.2A priority Critical patent/CN110162421B/en
Publication of CN110162421A publication Critical patent/CN110162421A/en
Application granted granted Critical
Publication of CN110162421B publication Critical patent/CN110162421B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/24Resetting means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/0736Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in functional embedded systems, i.e. in a data processing system designed as a combination of hardware and software dedicated to performing a certain function
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/0757Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0793Remedial or corrective actions

Abstract

The invention relates to a method and a device for testing an embedded software watchdog containing an interrupt function. And for a program without an interrupt function, directly implanting a dead loop code triggering a watchdog reset signal, and judging whether the program has the function of verifying the correctness of the software watchdog by resetting the watchdog. For a program with an interrupt function, besides executing the steps, a dead loop code for triggering a watchdog reset signal needs to be implanted in the interrupt program, and whether the program realizes the correctness of the watchdog function of the watchdog reset verification software is judged. Therefore, the software can correctly utilize the watchdog function to realize the program reset function after the running. The traditional watchdog testing method is improved perfectly, the reliability of military products is improved, and the method has good operability and observability.

Description

Embedded software watchdog test method and device containing interrupt function
Technical Field
The invention belongs to the technical field of software test and verification, and particularly relates to a method and a device for testing an embedded software watchdog containing an interrupt function.
Background
In a commercialized embedded system, a watchdog is generally required to be introduced in order to enable the system to automatically reset under an abnormal condition.
A watchdog is a counter that can be reset within a certain time. When the watchdog is started, the counter starts to count automatically, and after a certain time, if the counter is not reset, the overflow of the counter generates a reset signal to the CPU to restart the system (commonly called 'dog biting'). When the system normally operates, the watchdog counter needs to be cleared (commonly called "feeding dog") within the time interval allowed by the watchdog, and a reset signal is not generated. If the system is out of order, the program ensures to feed dogs on time, once the program runs away, no dogs are fed, and the system is bitten and reset.
There are two main types of watchdog that can be classified in embedded systems today:
1. watchdog built in CPU: the watchdog is generally a timer in a chip, and is initialized by a program, written with an initial value, set with an overflow time, and started with the timer. The program initializes (or resets) the timer on time to avoid being bitten. The watchdog may be disabled (as long as the timer is stopped).
The advantages are that: the overflow time can be changed by a program and can be disabled at any time.
The disadvantages are as follows: initialization is required; if the program runs before initialization and startup are completed or runs after the program is disabled, the watchdog cannot reset the system, so that the watchdog does not have the function and the recovery capability of the system is reduced.
2. Independent watchdog chip: the watchdog mainly comprises a pin for feeding the watchdog (generally connected with a GPIO of a CPU) and a RESET pin (connected with a RESET pin of a system), wherein if the level of the pin for feeding the watchdog is not changed within a certain time, the RESET pin changes the state to RESET the CPU. Such watchdog will start working as soon as it is powered on and cannot be disabled.
The advantages are that: the power is used when the power is on without configuration. The system can not be forbidden, the system must feed dogs on time, and the recovery capability of the system is high.
The disadvantages are as follows: the overflow time cannot be flexibly configured, the forbidden operation cannot be performed, and the flexibility is reduced.
In the existing military system, the requirements of reliability and recoverability of products are considered, and the products are required to have extremely high stability. Most military embedded software adopts a watchdog reset technology of an independent watchdog chip.
In a traditional test work of the software watchdog, a mode of implanting while (1) dead loop in a program is often adopted to trigger the watchdog to reset. If the watchdog can be correctly reset, the software watchdog is indicated to be normal in function. If the watchdog can not be correctly reset, the software watchdog is abnormal in function realization.
However, the above method does not consider an abnormal situation in which the program includes an interrupt function. When the timer interrupt function is internally operated to feed the dog, and the timer period of the timer interrupt is less than the reset time of the watchdog, even if the white (1) dead loop is implanted outside the interrupt function by adopting the traditional method, the software watchdog can not be reset. At this point, the software watchdog function implementation is disabled.
Disclosure of Invention
In order to solve the above problems, the present invention provides a military embedded software watchdog test method with an independent watchdog chip considering the interrupt function. The method comprises the steps of triggering while (1) statements of a watchdog reset function outside and inside an interrupt function of a program respectively, compiling and executing, monitoring the watchdog reset model in real time, and testing and verifying the correctness of software watchdog function realization.
A test method for embedded software watchdog containing interrupt function includes the following steps:
step one, obtaining a tested program, inserting while (1) dead loop codes at any position in a software main body of the tested program, compiling, generating and executing a simulation main program which is not successfully fed by a dog;
monitoring a watchdog reset signal in real time, and reporting that the watchdog function is abnormal if the software watchdog does not execute reset operation;
step three, if the software watchdog in the step two executes the reset operation, judging whether the software has a timed interrupt function;
if the software has no timed interrupt program, when the software watchdog executes the reset operation, the reporting watchdog functions normally;
if the software has a timed interrupt program, inserting while (1) dead loop codes at any position in the interrupt function, and generating a simulation main program which is not successfully fed;
monitoring a watchdog reset signal in real time, and reporting the abnormal function of the watchdog when the software watchdog does not execute reset operation; when the software watchdog executes the reset operation, the watchdog reporting function is normal.
Preferably, the software watchdog does not perform the reset operation, that is, does not receive the watchdog reset signal, and the software watchdog performs the reset operation, that is, receives the watchdog reset signal.
An embedded software watchdog testing device containing an interrupt function is provided with a signal lamp connected with a discrete magnitude signal, wherein the discrete magnitude is 1, and the signal lamp is on; the discrete amount is 0 and the lamp goes out.
Preferably, the testing step of the testing device is as follows:
firstly, burning a tested program by a testing device, adding a signal variable of the discrete quantity into the tested program, and initializing the signal variable to 1;
inserting a watchdog into a test program to realize a test function, and setting a discrete quantity signal as 0 in the test function;
thirdly, judging whether the watchdog is normally realized by utilizing the test method generation program of claim 1;
step four, when the software watchdog function is normal, the signal lamp is periodically and circularly turned on and off;
and step five, when the software watchdog function is abnormal, keeping the lamp off after the signal lamp is turned on once.
Preferably, the testing device is a control panel based on a single chip microcomputer.
The invention has the beneficial effects that: the invention provides a test method for embedded software with an independent watchdog chip to have special conditions of a timed interrupt function when the watchdog function is realized, which comprises the steps of triggering while (1) statements of a watchdog reset function outside and inside the interrupt function of a program, compiling and executing, monitoring a watchdog reset signal in real time, and testing and verifying the correctness of the realization of the software watchdog function. And a testing device for realizing the watchdog function capable of being directly observed is designed. The traditional watchdog testing method is improved perfectly, the reliability of military products is improved, and the method has good operability and observability.
Drawings
Fig. 1 is a flow chart of a watchdog testing method according to the present invention.
Fig. 2 is a schematic structural diagram of a test apparatus for monitoring an output signal of a watchdog test method according to the present invention.
Detailed Description
The invention will now be described in further detail with reference to the accompanying drawings:
as shown in fig. 1, a military embedded software watchdog test method with an independent watchdog chip having an interrupt function. The method comprises the following steps: acquiring a tested program; the watchdog reset is triggered by implanting a while (1) dead loop at any position in the program body (non-interrupt function). If the watchdog can not be correctly reset, the software watchdog is abnormal in function realization. Judging whether an interrupt function exists in the software: if the software has no interrupt function, if the watchdog is correctly reset, the software watchdog function is normal; an interrupt function exists in software, and a while (1) dead loop mode is implanted in any position in the interrupt function again to trigger watchdog reset. If the watchdog can not be correctly reset, the software watchdog is abnormal in function realization. If the watchdog is correctly reset, the software watchdog is normal in function.
The specific process is as follows:
firstly, acquiring a tested program;
secondly, inserting a dead loop code at any position in a tested program main body (non-interrupt function), compiling, generating and executing a simulated main program which is not successfully fed by the dog;
thirdly, monitoring a watchdog reset signal in real time;
fourthly, the software watchdog does not execute reset operation (does not receive a watchdog reset signal), and reports that the watchdog is abnormal in function;
judging whether a timed interrupt function exists or not, if no timed interrupt program exists, and when the software watchdog executes reset operation (receives a watchdog reset signal), reporting that the watchdog function is normal;
if the program is a timed interrupt program, inserting a dead loop code at any position in the interrupt function, and generating the simulation main program which is not successfully fed with the dog again;
seventhly, monitoring a watchdog reset signal in real time:
when the software watchdog does not execute reset operation (the watchdog reset signal is not received), reporting that the watchdog is abnormal in function;
when the software watchdog executes the reset operation (receives the watchdog reset signal), the watchdog functions normally.
As shown in fig. 2, a military embedded software watchdog test apparatus with a separate watchdog chip having an interrupt function.
The method comprises the step of inserting a signal test function into a software program, wherein the function contains discrete quantity signals connected with an external signal lamp. The signal is initialized to 1 outside the function and the lamp is on. When the discrete quantity is set to 0 when executed inside the function, the lamp is turned off. When the scheme of the first purpose is adopted for carrying out the watchdog test, if the watchdog function is normal, the signal lamp is circularly turned on and off approximately in the period of the watchdog reset time. If the watchdog is abnormal, the signal lamp is kept off after being turned on once.
The specific process is as follows:
firstly, a signal lamp connected with the discrete quantity signal is installed on the testing device. The discrete quantity is 1, and the lamp is on; when the discrete quantity is 0, the lamp is turned off;
secondly, adding discrete quantity signal variables in a tested program, and initializing the discrete quantity signal variables to 1;
inserting a watchdog to realize a test function, and setting a discrete quantity signal as 0 in the function;
fourthly, generating a program by using the test method of the figure 1, and judging whether the watchdog is normally realized;
and fifthly, when the software watchdog function is normal, periodically and circularly turning on and off the signal lamp, and the principle is as follows: when the function of the watchdog is normal, the system is continuously reset under the action of the watchdog after the fault is put in, and the second step and the third step are cycled from on to off, so that the signal lamp is periodically and cyclically turned on and off.
And sixthly, when the software watchdog function is abnormal, the signal lamp is kept off after being turned on once. The principle is as follows: when the watchdog function is abnormal, the software reset operation is only carried out once after the fault is put in. And the process from turning on to turning off of the lamp is performed once in the step two and the step three. Therefore, the lamp is kept off after the signal lamp is turned on once.

Claims (3)

1. A method for testing an embedded software watchdog containing an interrupt function is characterized by comprising the following steps:
step one, obtaining a tested program, inserting while (1) dead loop codes at any position in a software main body of the tested program, compiling, generating and executing a simulation main program which is not successfully fed by a dog;
monitoring a watchdog reset signal in real time, and reporting that the watchdog function is abnormal if the software watchdog does not execute reset operation;
step three, if the software watchdog in the step two executes the reset operation, judging whether the software has a timed interrupt function;
if the software has no timed interrupt program, when the software watchdog executes the reset operation, the reporting watchdog functions normally;
if the software has a timed interrupt program, inserting while (1) dead loop codes at any position in the interrupt function, and generating a simulation main program which is not successfully fed;
monitoring a watchdog reset signal in real time, and reporting the abnormal function of the watchdog when the software watchdog does not execute reset operation; when the software watchdog executes the reset operation, the watchdog reporting function is normal.
2. The method of claim 1, wherein the embedded software watchdog test method comprises: the software watchdog does not execute the reset operation, namely does not receive the watchdog reset signal, and the software watchdog executes the reset operation, namely receives the watchdog reset signal.
3. An embedded software watchdog testing device containing an interrupt function is characterized in that: the testing device is provided with a signal lamp connected with the discrete magnitude signal, the discrete magnitude is 1, and the signal lamp is on; when the discrete quantity is 0, the lamp is turned off; the testing steps of the testing device are as follows:
firstly, burning a tested program by a testing device, adding a signal variable of the discrete quantity into the tested program, and initializing the signal variable to 1;
step two, inserting a watchdog in the test program to realize a test function, setting the discrete quantity signal as 0 in the test function:
thirdly, judging whether the watchdog is normally realized by utilizing the test method generation program of claim 1;
step four, when the software watchdog function is normal, the signal lamp is periodically and circularly turned on and off;
and step five, when the software watchdog function is abnormal, keeping the lamp off after the signal lamp is turned on once.
CN201910347841.2A 2019-04-28 2019-04-28 Embedded software watchdog test method and device containing interrupt function Active CN110162421B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910347841.2A CN110162421B (en) 2019-04-28 2019-04-28 Embedded software watchdog test method and device containing interrupt function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910347841.2A CN110162421B (en) 2019-04-28 2019-04-28 Embedded software watchdog test method and device containing interrupt function

Publications (2)

Publication Number Publication Date
CN110162421A CN110162421A (en) 2019-08-23
CN110162421B true CN110162421B (en) 2020-11-10

Family

ID=67640157

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910347841.2A Active CN110162421B (en) 2019-04-28 2019-04-28 Embedded software watchdog test method and device containing interrupt function

Country Status (1)

Country Link
CN (1) CN110162421B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110716821B (en) * 2019-10-14 2023-07-25 深圳市凌壹科技有限公司 Communication method and device for watchdog

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1790282A (en) * 2004-12-17 2006-06-21 日本电气株式会社 Context save method, information processor and interrupt generator

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN203838691U (en) * 2014-05-27 2014-09-17 山东美核自动化科技有限公司 Watchdog fault monitoring device
JP6498043B2 (en) * 2015-05-29 2019-04-10 キヤノン株式会社 Electronics
CN104899110A (en) * 2015-06-05 2015-09-09 宁波三星智能电气有限公司 Setting and feeding method for watchdog
CN108205490B (en) * 2016-12-19 2021-05-14 比亚迪股份有限公司 Software watchdog test method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1790282A (en) * 2004-12-17 2006-06-21 日本电气株式会社 Context save method, information processor and interrupt generator

Also Published As

Publication number Publication date
CN110162421A (en) 2019-08-23

Similar Documents

Publication Publication Date Title
CN100568191C (en) The full-range dog-feeding method of embedded system
CN105446851B (en) Processor monitoring method and system and MCU for monitoring processor
US6915416B2 (en) Apparatus and method for microcontroller debugging
CN106527249B (en) Timer for peripheral watchdog
CN110162421B (en) Embedded software watchdog test method and device containing interrupt function
CN104503859A (en) Method for monitoring computer operating system in starting process
CN106648768B (en) Method and system for upgrading equipment
CN109710320A (en) A kind of starting guidance BootLoader method of two-stage drive
CN111914497B (en) DSP core module fault recovery method
CN104679601A (en) Watchdog starting method of interference preventing system
CN109614258A (en) The control method of the electronic operating system of built-in Linux and its external monitoring module
CN110750374A (en) Watchdog circuit and control method thereof
US20070234122A1 (en) Computer program runtime bottleneck diagnostic method and system
CN114911642A (en) Firmware restarting method based on UEFI event mechanism and watchdog
CN203849730U (en) Watchdog circuit of electronic system
CN105676981B (en) Reset circuit, working method and reset method
CN115220944A (en) Control method applied to watchdog of multi-core heterogeneous processor
CN103713960A (en) Watchdog circuit used for embedded system
US10921875B2 (en) Computer system, operational method for a microcontroller, and computer program product
JPS5981745A (en) Malfunction preventing device of microcomputer
CN216649827U (en) Enabling type watchdog circuit and control system
CN101739021B (en) Equipment self-inspection control device
CN115248739A (en) Intelligent watchdog system based on single chip microcomputer
US20130117612A1 (en) Starting a Field Device
CN105718326B (en) The restorability test method of embedded system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant