KR19980085727A - How to Prevent Stack Overflow Using the Watchdog Timer's Lighting Values - Google Patents

How to Prevent Stack Overflow Using the Watchdog Timer's Lighting Values Download PDF

Info

Publication number
KR19980085727A
KR19980085727A KR1019970021887A KR19970021887A KR19980085727A KR 19980085727 A KR19980085727 A KR 19980085727A KR 1019970021887 A KR1019970021887 A KR 1019970021887A KR 19970021887 A KR19970021887 A KR 19970021887A KR 19980085727 A KR19980085727 A KR 19980085727A
Authority
KR
South Korea
Prior art keywords
memory area
watchdog timer
user
area
data
Prior art date
Application number
KR1019970021887A
Other languages
Korean (ko)
Inventor
이장환
Original Assignee
배순훈
대우전자 주식회사
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 배순훈, 대우전자 주식회사 filed Critical 배순훈
Priority to KR1019970021887A priority Critical patent/KR19980085727A/en
Publication of KR19980085727A publication Critical patent/KR19980085727A/en

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

본 발명은 메인 프로그램을 저장하고 있는 메모리 영역(A)과 사용자가 특정 명령 또는 제어의 편의성을 위해 임의로 사용할 수 있는 사용자 정의용 메모리 영역(B)의 사이에 존재하는 스택의 오버 플로우 검출 방법에 관한 것으로 특히, 시스템 초기 동작시 상기 사용자 정의용 메모리 영역(B)의 제 1 메모리 영역에 기설정된 특정 데이터를 저장하는 제 1 단계와, 시스템 동작을 정상적으로 수행하는 가운데 소정시간 간격으로 상기 제 1 단계를 통해 상기 사용자 정의용 메모리 영역(B)의 제 1 메모리 영역에 저장된 특정 데이터를 억세스하여 워치독 타이머의 영역에 저장하는 제 2 단계와, 상기 워치독 타이머의 영역에 저장된 데이터가 기설정된 특정 데이터인가를 판단하는 제 3 단계, 및 상기 제 3 단계에서 워치독 타이머의 영역에 저장된 데이터가 기설정된 특정 데이터가 아니라고 판단되는 경우 시스템을 리세팅 시키는 제 4 단계를 포함하는 것을 특징으로 하는 워치독 타이머의 라이팅 값을 이용한 스택 오버 플로우 방지 방법에 관한 것이다.The present invention relates to a stack overflow detection method existing between a memory area A storing a main program and a user-defined memory area B that a user can arbitrarily use for convenience of a specific command or control. In particular, a first step of storing predetermined data in the first memory area of the user-defined memory area B during an initial system operation, and the first step at predetermined time intervals during a normal system operation. A second step of accessing and storing specific data stored in the first memory area of the user-defined memory area B in the watchdog timer area, and determining whether the data stored in the watchdog timer area is predetermined data; In the third step and the third step, the data stored in the watchdog timer area is preset. And a fourth step of resetting the system when it is determined that the data is not the specific data. The stack overflow preventing method using the writing value of the watchdog timer is provided.

Description

워치독 타이머의 라이팅 값을 이용한 스택 오버 플로우 방지 방법How to Prevent Stack Overflow Using the Watchdog Timer's Lighting Values

본 발명은 제어 시스템에서 시스템 운영상의 각 기능 동작중 인터럽트 발생등에 의해 해당 동작순서를 기억시키는 스택의 오버 플로우 발생여부를 감시하고 그에 따른 오버 플로우 발생을 방지하기 위한 워치독 타이머를 이용한 스택 오버 플로우 방지를 위한 방법에 관한 것이다.The present invention is to prevent stack overflow using a watchdog timer for monitoring whether the stack overflows by the occurrence of an interrupt during the operation of each function in the system operation in the control system and monitoring the overflow of the stack. It relates to a method for.

근래들어, 반도체 칩의 급속한 발전과 전자기술의 발전에 편승하여 대단위 전자시스템 또는 건물, 공장에서부터 일반적인 가전제품에 이르기까지 아날로그적인 제어방식에서 디지털 방식의 제어가 수행되고 있다.In recent years, with the rapid development of semiconductor chips and the development of electronic technology, digital control has been performed in the analog control method from large electronic systems or buildings and factories to general home appliances.

따라서, 각 전자기기를 구성하는 주요 부분은 반도체 칩으로 모듈화되고, 그에 따라 각각의 디바이스들은 마이컴 또는 중앙처리 장치의 제어에 따라 어느 정도 독립적으로 동작하고 그에 따른 운영상의 정보를 중앙처리 장치에 전달하게 된다.Thus, the main part constituting each electronic device is modularized into a semiconductor chip, so that each device operates to some degree independently under the control of a microcomputer or a central processing unit and thus transmits operational information to the central processing unit. do.

이때, 각 디바이스들이 자신의 기능을 거의 독립적으로 수행하기 때문에 중앙처리 장치에서는 이들의 동작상의 충돌을 방지하기 위하여 특정 순서에 따른 인터럽트나 동작상의 우선순위를 제공하게 되는데, 이러한 기준은 첨부한 도1에 도시되어 있는 바와같은 메모리 영역에 저장되어 있는 프로그램 또는 각종 정보를 기준으로 사용하게 된다.In this case, since each device performs its function almost independently, the central processing unit provides interrupts or operational priorities according to a specific order in order to prevent their operational conflicts. A program or various information stored in a memory area as shown in FIG. 3 are used as a reference.

도1에 도시되어 있는 메모리 영역에 대한 예시도에서는 각종 인터럽트의 발생시 그에 따라 운영중이던 메인 프로그램의 다음 순서에 대한 정보 또는 각종 디바이스들로부터 전달받은 데이터의 저장을 위해 제공되는 스택의 영역의 위치를 설명하기 위한 예시도이다.In the exemplary diagram of the memory area illustrated in FIG. 1, the location of a stack area provided for storing information received from various devices or information on the next order of a main program which is operating according to the occurrence of various interrupts will be described. It is an exemplary figure for following.

그런데, 기존의 스택 영역은 메인 프로그램을 저장하고 있는 메모리 영역(A)과 사용자가 특정 명령 또는 제어의 편의성을 위해 임의로 사용할 수 있는 사용자 정의용 메모리 영역(B)의 사이에 존재하기 때문에, 스택 오버 플로우가 발생시 사용자 영역에 해당하는 메모리 영역까지 스택으로 사용될 수 있으나, 이러한 경우 사용자 정의 데이터가 바뀌게 되어 오동작이 일어나거나 또는 스택에 어드레스가 저장된 동안 사용자 영역으로 이 부부분을 억세스함으로써 POP동작시 다음 데이터가 들어와서 오동작을 일으킬 수 있다는 문제점이 발생되었다.However, since the existing stack area exists between the memory area A storing the main program and the user-defined memory area B that the user can use arbitrarily for convenience of a specific command or control, the stack overflows. Can be used as a stack up to the memory area corresponding to the user area, but in this case, the user-defined data is changed, causing a malfunction or accessing this portion to the user area while the address is stored on the stack. There is a problem that can cause a malfunction by coming in.

상기와 같은 문제점을 해소하기 위한 본 발명의 목적은 워치독 타이머 인터럽트를 이용하여 스택의 오버플로우를 감지하고 오버플로우가 발생되는 경우 일어날 수 있는 오동작을 방지하며 시스템을 리세팅시킴으로써 스텍의 오버 플로우를 방지할 수 있는 워치독 타이머를 이용한 스택 오버 플로우 방지를 위한 방법를 제공하는 데 있다.An object of the present invention to solve the above problems is to detect the overflow of the stack by using the watchdog timer interrupt, to prevent the malfunction that can occur when the overflow occurs and to reset the stack by resetting the system The present invention provides a method for preventing stack overflow using a watchdog timer that can be prevented.

도1은 제어 시스템에서의 일반적인 스택 구조를 설명하기 위한 예시도1 is an exemplary view for explaining a general stack structure in a control system

도2는 본 발명에 따른 워치독 타이머의 라이팅 값을 이용한 스택 오버 플로우 검출 방법을 설명하기 위한 동작 순서도2 is a flowchart illustrating a stack overflow detection method using a writing value of a watchdog timer according to the present invention.

상기 목적을 달성하기 위한 본 발명의 특징은, 메인 프로그램을 저장하고 있는 메모리 영역(A)과 사용자가 특정 명령 또는 제어의 편의성을 위해 임의로 사용할 수 있는 사용자 정의용 메모리 영역(B)의 사이에 존재하는 스택의 오버 플로우 검출 방법에 있어서, 시스템 초기 동작시 상기 사용자 정의용 메모리 영역(B)의 제 1 메모리 영역에 기설정된 특정 데이터를 저장하는 제 1 단계와, 시스템 동작을 정상적으로 수행하는 가운데 소정시간 간격으로 상기 제 1 단계를 통해 상기 사용자 정의용 메모리 영역(B)의 제 1 메모리 영역에 저장된 특정 데이터를 억세스하여 워치독 타이머의 영역에 저장하는 제 2 단계와, 상기 워치독 타이머의 영역에 저장된 데이터가 기설정된 특정 데이터인가를 판단하는 제 3 단계, 및 상기 제 3 단계에서 워치독 타이머의 영역에 저장된 데이터가 기설정된 특정 데이터가 아니라고 판단되는 경우 시스템을 리세팅 시키는 제 4 단계를 포함하는 데 있다.A feature of the present invention for achieving the above object lies between a memory area A storing a main program and a user-defined memory area B that a user can arbitrarily use for convenience of a specific command or control. A stack overflow detection method comprising: a first step of storing predetermined data in a first memory area of a user-defined memory area (B) during a system initial operation, and at a predetermined time interval while performing a system operation normally; A second step of accessing and storing specific data stored in the first memory area of the user-defined memory area B through the first step in the watchdog timer area; and data stored in the watchdog timer area. A third step of determining whether the specific data is set, and an area of the watchdog timer in the third step If it is determined not to be the specific data stored in the data group it is set to a fourth step of resetting the system.

이하, 첨부한 도면을 참조하여 본 발명에 따른 바람직한 일 실시예를 상세히 설명하면 다음과 같다.Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings.

우선, 본 발명에서 사용하고자 하는 워치독의 개념을 살펴보면, 그 기능상의 특징은 시스템이 기계적인 고장으로 휴지상태가 되거나 또는 프로그램의 착오로 무제한의 루프에 들어가는 것을 감시하는 것이다. 상술한 바와같은 오동작을 방지하기 위하여 프로그램으로 설정된 타이머로 어떤 특정 조건을 만족하면 경보를 발하게 하는 기능을 수행하는 것을 워치독 타이머라고 칭한다.First, looking at the concept of the watchdog to be used in the present invention, its functional feature is to monitor that the system goes into an idle loop due to mechanical failure or enters an unlimited loop due to a program error. A watchdog timer is a watchdog timer that performs a function of causing an alarm when a certain condition is satisfied by a timer set as a program to prevent a malfunction as described above.

도2는 본 발명에 따른 워치독 타이머의 라이팅 값을 이용한 스택 오버 플로우 검출 방법을 설명하기 위한 동작 순서도이다.2 is a flowchart illustrating a stack overflow detection method using a writing value of a watchdog timer according to the present invention.

스텝 S101에서 중앙처리장치는 시스템이 초기 동작 상태인가를 판단하여 초기 동작인 경우 스텝 S102로 진행하여 사용자 정의용 메모리 영역(B: 첨부한 도1 참조)의 제 1 메모리 영역에 기설정된 특정 데이터(예를들어, 00h)를 저장하게 된다. 이후 스텝 S103에서는 통상적인 시스템의 운영을 수행하게 되는데, 이때 스텝 S104에서는 소정시간 간격으로 도시하지 않은 워치독 타이머 영역에 상기 스텝 S102에서 상기 사용자 정의용 메모리 영역(B)의 제 1 메모리 영역에 저장된 데이터를 저장하게 된다.In step S101, the CPU determines whether the system is in the initial operation state, and if it is the initial operation, the process proceeds to step S102, in which the specific data preset in the first memory area of the user-defined memory area B (see FIG. For example, 00h). Subsequently, the operation of the normal system is performed in step S103. In this case, in step S104, the data stored in the first memory area of the user-defined memory area B is stored in the watchdog timer area, which is not shown at predetermined time intervals, in step S102. Will be saved.

상술한 바와같이 상기 스텝 S104의 과정을 통하여 워치독 타이머 영역에 저장된 데이터가 기설정된 특정 데이터인가를 스텝 S105의 과정을 통하여 판단하게 된느데, 특정 데이터라고 판단되면 상기 스템 S103으로 재 진행하고 만약, 특정 데이터가 아니라고 판단되면 스텝 S106으로 진행하여 스택 영역에서 오버 플로우가 발생되었다고 판단한 후 시스템을 리세팅시키게 된다.As described above, it is determined through the process of step S104 whether the data stored in the watchdog timer area is predetermined specific data through the process of step S105. If it is determined that the data is not specific, the process proceeds to step S106, where it is determined that an overflow has occurred in the stack area, and then the system is reset.

상기와 같이 동작하는 본 발명에 따른 워치독 타이머의 라이팅 값을 이용한 스택 오버 플로우 방지 방법을 제공하면, 전자 제어 시스템에서 중앙 처리 장치가 시스템 운영상 발생되는 각종의 데이터를 임시 저장하는 스택 구조에서 오버 플로우가 발생되면 이 때 발생된 오버플로우가 워치독 타이머의 데이터를 변경시킴으로써 시스템 리세팅이 수행되어 시스템의 오동작을 방지하는 하는 효과가 있다.When the stack overflow prevention method using the lighting value of the watchdog timer according to the present invention operating as described above is provided, the central processing unit in the electronic control system overflows in a stack structure for temporarily storing a variety of data generated during system operation If is generated, the overflow generated at this time changes the data of the watchdog timer, so that the system reset is performed, thereby preventing the system from malfunctioning.

Claims (1)

메인 프로그램을 저장하고 있는 메모리 영역(A)과 사용자가 특정 명령 또는 제어의 편의성을 위해 임의로 사용할 수 있는 사용자 정의용 메모리 영역(B)의 사이에 존재하는 스택의 오버 플로우 검출 방법에 있어서,In the stack overflow detection method which exists between the memory area A which stores a main program, and the user-defined memory area B which a user can use arbitrarily for the convenience of a specific command or control, 시스템 초기 동작시 상기 사용자 정의용 메모리 영역(B)의 제 1 메모리 영역에 기설정된 특정 데이터를 저장하는 제 1 단계와;A first step of storing predetermined data in a first memory area of the user-defined memory area B during a system initial operation; 시스템 동작을 정상적으로 수행하는 가운데 소정시간 간격으로 상기 제 1 단계를 통해 상기 사용자 정의용 메모리 영역(B)의 제 1 메모리 영역에 저장된 특정 데이터를 억세스하여 워치독 타이머의 영역에 저장하는 제 2 단계와;A second step of accessing specific data stored in the first memory area of the user-defined memory area (B) at a predetermined time interval while performing a system operation normally and storing the specific data in the watchdog timer area; 상기 워치독 타이머의 영역에 저장된 데이터가 기설정된 특정 데이터인가를 판단하는 제 3 단계; 및Determining whether data stored in an area of the watchdog timer is predetermined specific data; And 상기 제 3 단계에서 워치독 타이머의 영역에 저장된 데이터가 기설정된 특정 데이터가 아니라고 판단되는 경우 시스템을 리세팅 시키는 제 4 단계를 포함하는 것을 특징으로 하는 워치독 타이머의 라이팅 값을 이용한 스택 오버 플로우 방지 방법.And a fourth step of resetting the system when it is determined that the data stored in the area of the watchdog timer is not the predetermined specific data in the third step. Way.
KR1019970021887A 1997-05-30 1997-05-30 How to Prevent Stack Overflow Using the Watchdog Timer's Lighting Values KR19980085727A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1019970021887A KR19980085727A (en) 1997-05-30 1997-05-30 How to Prevent Stack Overflow Using the Watchdog Timer's Lighting Values

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1019970021887A KR19980085727A (en) 1997-05-30 1997-05-30 How to Prevent Stack Overflow Using the Watchdog Timer's Lighting Values

Publications (1)

Publication Number Publication Date
KR19980085727A true KR19980085727A (en) 1998-12-05

Family

ID=65988399

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1019970021887A KR19980085727A (en) 1997-05-30 1997-05-30 How to Prevent Stack Overflow Using the Watchdog Timer's Lighting Values

Country Status (1)

Country Link
KR (1) KR19980085727A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20080036733A (en) * 2006-10-24 2008-04-29 한국오므론전장주식회사 Mcu of embedded system and stack management method for preventing error

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20080036733A (en) * 2006-10-24 2008-04-29 한국오므론전장주식회사 Mcu of embedded system and stack management method for preventing error

Similar Documents

Publication Publication Date Title
US6434591B1 (en) Thread control system and method in a computer system
US5978939A (en) Timeout monitoring system
CN100359481C (en) Abnormal monitoring equipment and method for multi-task system
KR970701864A (en) MICROCONTROLLER WITH BROWN-OUT DETECTION
US6182238B1 (en) Fault tolerant task dispatching
CA2292991C (en) Watch dog timer system
JP2008518313A (en) Data processing system with variable clock rate
JPH06324914A (en) Runaway detecting method for computer
KR19980085727A (en) How to Prevent Stack Overflow Using the Watchdog Timer's Lighting Values
KR19980067951U (en) Stack Structure to Prevent Stack Overflow Using Watchdog Timer
WO2005022387A2 (en) Circuit arrangement and method for supporting and monitoring a microcontroller
JPH0245838A (en) Program execution condition monitoring method
JP2870250B2 (en) Microprocessor runaway monitor
JPH04266141A (en) Stack overflow detection system
JPH02293939A (en) Stack overflow detection time processing system
JP4647276B2 (en) Semiconductor circuit device
JP3480903B2 (en) Control method of all instruction trace in emulator
KR100975228B1 (en) microcomputer with watchdog timer
JP2002251299A (en) Program tracing device
CN117130817A (en) Linux system condition monitoring method, electronic equipment and medium
JPH11161548A (en) Computer with runaway detection function
KR100424458B1 (en) Task management method for real time multitasking operation system
JP2000181755A (en) Method and device for abnormality detection, multitask system, and recording medium
JPH0316647B2 (en)
JP2002091826A (en) Information processor

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E601 Decision to refuse application