CN112198820B - Interrupt service implementation method, device, equipment and storage medium - Google Patents

Interrupt service implementation method, device, equipment and storage medium Download PDF

Info

Publication number
CN112198820B
CN112198820B CN202011035250.0A CN202011035250A CN112198820B CN 112198820 B CN112198820 B CN 112198820B CN 202011035250 A CN202011035250 A CN 202011035250A CN 112198820 B CN112198820 B CN 112198820B
Authority
CN
China
Prior art keywords
interrupt
program
flag bit
target
application program
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
CN202011035250.0A
Other languages
Chinese (zh)
Other versions
CN112198820A (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.)
FAW Group Corp
Original Assignee
FAW Group Corp
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 FAW Group Corp filed Critical FAW Group Corp
Priority to CN202011035250.0A priority Critical patent/CN112198820B/en
Publication of CN112198820A publication Critical patent/CN112198820A/en
Application granted granted Critical
Publication of CN112198820B publication Critical patent/CN112198820B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0423Input/output
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/25Pc structure of the system
    • G05B2219/25257Microcontroller

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Stored Programmes (AREA)
  • Microcomputers (AREA)

Abstract

The embodiment of the invention discloses a method, a device, equipment and a storage medium for realizing interrupt service. The method comprises the following steps: when an external interrupt request is detected, inquiring an interrupt entry function address in a preset interrupt vector table; calling an interrupt entry function according to the interrupt entry function address, reading a state flag bit through the interrupt entry function and acquiring a target interrupt processing function address according to the state flag bit; and calling a target interrupt processing function according to the target interrupt processing function address, calling a target interrupt service program through the target interrupt processing function, and entering interrupt service. The embodiment of the invention realizes two different interrupt services in the low-end singlechip, has simple realization mode, is suitable for various singlechips which do not support a plurality of interrupt vector tables, and has better portability.

Description

Interrupt service implementation method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a method, a device, equipment and a storage medium for realizing interrupt service.
Background
With the development of electrical and electronic technology, embedded systems based on single-chip Microcomputers (MCUs) are widely used. In consideration of cost, a low-end single chip microcomputer with high practicability is often selected according to requirements in actual product research and development so as to realize a control strategy with a certain simple function. However, the low-end single chip microcomputer reduces the cost and simultaneously means that the hardware resources provided by the low-end single chip microcomputer are less. In the life cycle of the controller of the low-end single-chip microcomputer product, the application program of the controller has the requirements of upgrading and updating, and program guide software is needed to upgrade the application software. Both the program guide software and the application software need to have own interrupt response processing function, but most low-end single-chip microcomputers (such as NXP MC9S08DZ60) do not support setting a plurality of interrupt vector tables.
For a low-end single chip microcomputer with hardware not supporting setting of a plurality of interrupt vector tables, the existing product controller updating schemes mainly comprise two schemes, wherein one scheme is that controller software and hardware are integrally removed from a system and then reinstalled, and the other scheme is that an updating program completely does not use an interrupt service program. The former has huge cost for updating programs, and the original controller hardware needs to be dismantled and then the hardware with new programs is replaced; the latter makes the software of the boot update program have no interrupt service program at all, and only adopts the polling mode to transmit the program data, thereby greatly reducing the reliability and the execution efficiency of the boot program, and simultaneously being difficult to meet the requirement of the boot program on the time parameter of data transmission.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for realizing interrupt service, which realize two different interrupt services in a low-end singlechip, have simple realization mode, are suitable for various singlechips which do not support a plurality of interrupt vector tables and have better portability.
In a first aspect, an embodiment of the present invention provides a method for implementing an interrupt service, including:
when an external interrupt request is detected, inquiring an interrupt entry function address in a preset interrupt vector table;
calling an interrupt entry function according to the interrupt entry function address, reading a state flag bit through the interrupt entry function and acquiring a target interrupt processing function address according to the state flag bit;
and calling a target interrupt processing function according to the target interrupt processing function address, calling a target interrupt service program through the target interrupt processing function, and entering interrupt service.
In a second aspect, an embodiment of the present invention further provides an apparatus for implementing an interrupt service, including:
the system comprises an interrupt entry query module, a function address generation module and an interrupt entry processing module, wherein the interrupt entry query module is used for querying an interrupt entry function address in a preset interrupt vector table when an external interrupt request is detected;
an interrupt processing function address obtaining module, configured to call an interrupt entry function according to the interrupt entry function address, read a status flag bit through the interrupt entry function, and obtain a target interrupt processing function address according to the status flag bit;
and the interrupt service program calling module is used for calling a target interrupt processing function according to the target interrupt processing function address, calling a target interrupt service program through the target interrupt processing function and entering interrupt service.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the interrupt service implementation method according to the embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is configured to, when executed by a processor, implement an interrupt service implementation method according to an embodiment of the present invention.
According to the technical scheme of the embodiment of the invention, the program guide software and the application software have independent interrupt processing functions in a mode of address positioning of the interrupt service program, the interrupt vector is relocated through a pre-established mapping relation, so that the corresponding interrupt processing functions are called, two different interrupt services are realized in the low-end single chip microcomputer, the realization mode is simple, the method is suitable for various single chip microcomputers which do not support a plurality of interrupt vector tables, and the method has good portability.
Drawings
Fig. 1 is a flowchart of a method for implementing an interrupt service according to an embodiment of the present invention.
Fig. 2 is a flowchart of a method for implementing an interrupt service according to a second embodiment of the present invention.
Fig. 3 is a flowchart of an interrupt service implementation method according to a third embodiment of the present invention.
Fig. 4 is a schematic structural diagram of an interrupt service implementation apparatus according to a fourth embodiment of the present invention.
Fig. 5 is a schematic structural diagram of a computer device according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention.
It should be further noted that, for the convenience of description, only some but not all of the relevant aspects of the present invention are shown in the drawings. Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example one
Fig. 1 is a flowchart of a method for implementing an interrupt service according to an embodiment of the present invention. The embodiment of the invention can be suitable for realizing two different interrupt services in a single chip microcomputer which does not support a plurality of interrupt vector tables, and the method can be executed by the interrupt service realizing device provided by the embodiment of the invention, and the device can be realized by adopting a software and/or hardware mode and can be generally integrated in computer equipment. Such as a single chip controller. As shown in fig. 1, the method of the embodiment of the present invention specifically includes:
step 101, when detecting an external interrupt request, querying an interrupt entry function address in a preset interrupt vector table.
The external interrupt request may be a request sent by an external interrupt source to request the single-chip microcomputer controller to interrupt a currently executed program, and then the program is forwarded to execute an interrupt service program, and after the interrupt service program is completed, request information for continuing to execute the current program is returned, including an interrupt type number. The external interrupt request in the boot program may be sent by a Controller Area Network (CAN) bus or a local area interconnect network (LAN) bus as an interrupt source, and the application program may respond to different interrupt sources according to a specific application scenario.
The preset interrupt vector table stores interrupt vectors, and the interrupt vectors are the offset and segment base values of the interrupt service program entry address. The preset interrupt vector table can be stored in an independent and fixed interrupt vector table storage area divided from the single chip microcomputer storage area. The interrupt vector corresponding to the interrupt source and the interrupt type can be obtained in a preset interrupt vector table, so that the corresponding interrupt entry function address can be inquired. The interrupt entry function address may be a memory address of the interrupt entry function.
And 102, calling an interrupt entry function according to the interrupt entry function address, reading a state flag bit through the interrupt entry function, and acquiring a target interrupt processing function address according to the state flag bit.
The interrupt entry function can be stored in an independent and fixed interrupt entry function storage area divided from the single chip microcomputer storage area. The interrupt entry function may provide an interface for the interrupt service routine. The status flag bit may be read after the interrupt entry function is called.
The status flag bit can be stored in an independent and fixed flag bit storage area divided from the storage area of the single chip microcomputer, and optionally, the flag bit storage area can be a charged erasable programmable read only memory (EEPROM) carried by the single chip microcomputer. The state flag bit can mark a program currently executed by the single chip microcomputer controller, and when the single chip microcomputer controller is currently executing a bootstrap program, the state flag bit can be in a bootstrap program state; the status flag bit may be the application state when the single chip controller is currently executing an application. The status flag bit may be a hexadecimal number, a certain number of the hexadecimal number, or any other implementable identification form, and is illustratively a bootstrap status when the status flag bit is equal to 0 xFF; when the status flag bit is not equal to 0xFF, the status flag bit is the application status.
The target interrupt processing function address can be a storage address of an interrupt processing function corresponding to the status flag bit, and can be a bootstrap interrupt processing function address or an application interrupt processing function address. Optionally, if the status flag bit is a bootstrap status, acquiring a bootstrap interrupt processing function address; and if the status flag bit is the application program status, acquiring an application program interrupt processing function address.
103, calling a target interrupt processing function according to the target interrupt processing function address, calling a target interrupt service program through the target interrupt processing function, and entering an interrupt service.
The target interrupt processing function can be a bootstrap interrupt processing function or an application interrupt processing function, the bootstrap interrupt processing function can be stored in an independent and fixed program bootstrap interrupt service processing area divided from the single-chip microcomputer storage area, and the application interrupt processing function can be stored in an independent and fixed application interrupt service processing area divided from the single-chip microcomputer storage area.
Optionally, a bootstrap interrupt processing function is called according to the address of the bootstrap interrupt processing function, and a bootstrap interrupt service program is called through the bootstrap interrupt processing function; or calling an application program interrupt processing function according to the application program interrupt processing function address, and calling an application program interrupt service program through the application program interrupt processing function.
The invoking of the bootstrap interrupt service routine may be to interrupt the currently executed bootstrap routine and then to execute the bootstrap interrupt service routine. Optionally, when the bootstrap interrupt service routine is completed, returning to continue executing the bootstrap routine. The bootstrap program can be stored in an independent and fixed bootstrap program area divided from the storage area of the single chip microcomputer.
The application interrupt service routine is called, which may be to interrupt the currently executed application and then to execute the application interrupt service routine. Optionally, when the application interrupt service routine is completed, returning to continue executing the application program. The application program can be stored in an independent and fixed application program area divided from the single chip microcomputer storage area.
The embodiment of the invention provides an interrupt service implementation method, which is characterized in that a program guide software and an application software have independent interrupt processing functions through a mode of carrying out address positioning on an interrupt service program, and interrupt vector relocation is carried out through a mapping relation established in advance, so that the corresponding interrupt processing functions are called, two different interrupt services are implemented in a low-end single chip microcomputer, the implementation mode is simple, the method is suitable for various single chip microcomputers which do not support a plurality of interrupt vector tables, and the method has better portability.
Example two
Fig. 2 is a flowchart of a method for implementing an interrupt service according to a second embodiment of the present invention. In this embodiment of the present invention, before querying an address of an interrupt entry function in a preset interrupt vector table when an external interrupt request is detected, the method may further include: when power-on is detected, executing a boot program starting function, reading a jump flag bit, and judging whether the jump flag bit is positioned at a jump bit position; if the jump flag bit is not positioned at the jump bit position, marking the state flag bit as a bootstrap state; and if the jump mark position is at the jump position, marking the state mark position as the application program state and executing the application program starting function.
As shown in fig. 2, the method of the embodiment of the present invention specifically includes:
step 201, when power-on is detected, executing a boot program starting function and reading a jump flag bit, and judging whether the jump flag bit is set at a jump bit position: if the jump flag bit is not placed in the jump bit, executing step 202; if the jump mark position is at the jump bit position, step 203 is executed.
The detected power-on can be the situation that the single chip microcomputer controller is started to be powered on each time. Executing the boot program initiation function may indicate that the single-chip controller initiates the boot program first after each power-up. The jump flag bit is read immediately after the boot program is started.
The skip zone bit can be stored in an independent and fixed zone bit storage area divided from the storage area of the single chip microcomputer, and optionally, the zone bit storage area can be a charged erasable programmable read-only memory (EEPROM) carried by the single chip microcomputer. The jump flag bit can indicate whether the single chip microcomputer controller jumps to execute the application program. The skip flag bit can be a single digit or any other realizable identification form, and for example, when the skip flag bit is at position 1, the skip flag bit can be represented as a skip bit; when the skip flag bit is at position 0, it can indicate that the skip flag bit is not placed at the skip bit.
Step 202, mark the status flag bit as the boot program status.
If the jump flag bit is not set at the jump bit position, the current single chip microcomputer controller does not need to jump to execute the application program and can continue to execute the bootstrap program, and the state flag bit is marked as the state of the bootstrap program. The absence of the jump flag bit in the jump bit may indicate that the application needs to be updated in the current situation.
Step 203, mark the status flag bit as the application program status and execute the application program start function.
If the jump flag position is at the jump bit position, which indicates that the current single-chip microcomputer controller needs to jump to execute the application program, the state flag bit is marked as the application program state and the application program starting function is executed. And if the jump mark position at the jump position can indicate that the application program needs to be updated under the current condition is not detected, executing an application program starting function to start the application program.
Step 204, when detecting the external interrupt request, inquiring the interrupt entry function address in the preset interrupt vector table.
Wherein step 204 follows step 202 or step 203.
Step 205, calling an interrupt entry function according to the interrupt entry function address, reading a status flag bit through the interrupt entry function, and acquiring a target interrupt processing function address according to the status flag bit.
Optionally, the reading a status flag bit through the interrupt entry function and obtaining an address of a target interrupt processing function according to the status flag bit includes: reading a state flag bit through the interrupt entry function, wherein the state flag bit is a bootstrap state or an application state; if the status flag bit is in a bootstrap program status, acquiring a bootstrap program interrupt processing function address; and if the status flag bit is the application program status, acquiring an application program interrupt processing function address.
And step 206, calling a target interrupt processing function according to the target interrupt processing function address, calling a target interrupt service program through the target interrupt processing function, and entering interrupt service.
Optionally, the invoking a target interrupt handling function according to the target interrupt handling function address, and invoking a target interrupt service program through the target interrupt handling function, include: calling a bootstrap interrupt processing function according to the bootstrap interrupt processing function address, and calling a bootstrap interrupt service program through the bootstrap interrupt processing function; or calling an application program interrupt processing function according to the application program interrupt processing function address, and calling an application program interrupt service program through the application program interrupt processing function.
The specific implementation of the above steps may refer to the implementation of the corresponding steps provided in the first embodiment, which is not described herein again.
The embodiment of the invention provides an interrupt service implementation method, which is characterized in that a program guide software and an application software have independent interrupt processing functions through a mode of carrying out address positioning on an interrupt service program, and interrupt vector relocation is carried out through a mapping relation established in advance, so that the corresponding interrupt processing functions are called, two different interrupt services are implemented in a low-end single chip microcomputer, the implementation mode is simple, the method is suitable for various single chip microcomputers which do not support a plurality of interrupt vector tables, and the method has better portability.
Optionally, after the target interrupt handling function is called according to the target interrupt handling function address, a target interrupt service program is called through the target interrupt handling function, and an interrupt service is entered, the method includes: when the completion of the bootstrap program interrupt service program is detected, executing the bootstrap program and obtaining a first executable file; and modifying the state flag bit into an application program state, executing an application program starting function, and re-reading the state flag bit.
The first executable file obtained after the bootstrap is completed may be a binary file in an Intel HEX format, and corresponds to a preset interrupt vector table and an interrupt entry function.
The bootstrap completion may indicate that the application update is complete and execution of the application start function may start the application. After the status flag bit is read again, the current status flag bit can be read as the status of the application program, and then the application program interrupt service program can be entered, so that two different interrupt services are realized.
In the embodiment, the state flag bit is set and updated to realize the relocation of the interrupt vector, so that two different interrupt services are realized in the low-end single chip microcomputer, and the update of the application program with the interrupt services is realized.
Optionally, after the invoking a target interrupt handling function according to the target interrupt handling function address, invoking a target interrupt service program through the target interrupt handling function, and entering an interrupt service, the method further includes: when the completion of the application program interrupt service program is detected, detecting whether the application program needs to be updated; if the application program does not need to be updated, executing the application program and obtaining a second executable file; and if the application program needs to be updated, separating the jump mark position from the jump position and executing a bootstrap program starting function, and re-reading the jump mark position.
Wherein if the application does not need to be updated, the application can be executed without executing the bootstrap program. The second executable file obtained after the application is completed may be a binary file in an Intel HEX format, and corresponds to a preset interrupt vector table and an interrupt entry function.
If the application program needs to be updated, the bootstrap flag needs to be executed to update the application program, the jump flag bit needs to be reset and is set away from the jump bit, after the bootstrap program is started by executing the bootstrap program starting function, when the jump flag bit is read again, the application program is executed without jumping according to the jump flag bit, the bootstrap program is continuously executed, a first executable file is obtained after the bootstrap program is finished, and the application program is updated; modifying the state flag bit into an application program state, executing an application program starting function, re-reading the state flag bit, and further entering an application program interrupt service program; and when the completion of the application program interrupt service program is detected, executing the application program and obtaining a second executable file because the updating of the application program is completed at the moment.
The above embodiment detects the updating requirement of the application program in real time, updates the skip flag bit, realizes the automatic updating of the application program and automatically executes the application program after the updating; by setting and updating the status flag bit, the interrupt vector relocation is realized, so that two different interrupt services are realized in the low-end single chip microcomputer, and the application program with the interrupt services is updated.
Optionally, the method further includes: and when the application program is detected to be completed, synthesizing the first executable file and/or the second executable file to obtain a final production file.
Wherein, the completion of the application program is the completion of the compiling of the single chip microcomputer controller. The interrupt vector table and the interrupt entry function corresponding to the first executable file and the second executable file are completely the same, and can be integrated into a final production file according to the storage area, and the final production file can be executed by Electronic Control Unit (ECU) hardware.
In the above embodiment, the executable files obtained by executing the boot program and the application program are integrated through the identical interrupt vector table and the interrupt entry function, so as to obtain the final production file executable by the hardware, thereby completing the update of the application program with the interrupt service.
EXAMPLE III
Fig. 3 is a flowchart illustrating a method for implementing an interrupt service according to a third embodiment of the present invention, where the third embodiment of the present invention is a specific implementation manner of each alternative in one or more of the above embodiments. As shown in fig. 3, when power-on is detected, the method of the embodiment of the present invention specifically includes:
step 310, the boot program start function is executed. After step 310 is completed, step 320 is performed.
Step 320, reading the jump flag bit, and judging whether the jump flag bit is positioned at the jump bit position: if the jump flag bit is not set to the jump bit, executing step 330; if the jump mark position is at a jump bit position, then step 332 is performed.
Step 330, mark the status flag bit as the boot program status. After the step 330 is completed, when the external interrupt request is detected, the process goes to the step 340.
Step 332, mark the status flag bit as the application status and execute the application start function. After the execution of step 332 is completed, when an external interrupt request is detected, it jumps to step 342.
Step 340, when detecting the external interrupt request, calling the bootstrap program interrupt service program according to the status flag bit, and entering the bootstrap program interrupt service. After the bootstrap interrupt service routine is completed in step 340, go to step 350.
When an external interrupt request is detected, calling a bootstrap program interrupt service program according to the state flag bit, wherein the step of entering the bootstrap program interrupt service comprises the following steps: when an external interrupt request is detected, inquiring an interrupt entry function address in a preset interrupt vector table; reading a state flag bit through the interrupt entry function to obtain that the state flag bit is in a bootstrap state, and then obtaining a bootstrap interrupt processing function address; and calling a bootstrap interrupt processing function according to the bootstrap interrupt processing function address, and calling a bootstrap interrupt service program through the bootstrap interrupt processing function.
Step 342, when the external interrupt request is detected, calling an application program interrupt service program according to the status flag bit, and entering the application program interrupt service. After the application interrupt service routine is completed in step 342, the process proceeds to step 352.
When an external interrupt request is detected, calling an application program interrupt service program according to the state flag bit, wherein the entering of the application program interrupt service comprises the following steps: when an external interrupt request is detected, inquiring an interrupt entry function address in a preset interrupt vector table; reading a state flag bit through the interrupt entry function to obtain that the state flag bit is an application program state, and then obtaining an application program interrupt processing function address; and calling an application program interrupt processing function according to the application program interrupt processing function address, and calling an application program interrupt service program through the application program interrupt processing function.
And 350, executing the bootstrap program and obtaining a first executable file when the completion of the bootstrap program interrupt service program is detected. After the step 350 is completed, the application program is updated by executing the bootstrap program, and the process goes to the step 332.
Step 352, when detecting that the application interrupt service routine is completed, detecting whether the application program needs to be updated: if the application does not need to be updated, then go to step 361; if the application needs to be updated, then a jump is made to step 362.
And 361, executing the application program and obtaining a second executable file. At this time, the mcu completes the compilation of the application program and goes to step 370.
Step 362, the jump mark position is shifted away from the jump bit position. After the step 362 is completed, the process goes to step 310. At this time, after the execution of step 310 is completed, step 320, step 330, step 340, step 350, step 332, step 342, step 352, and step 361 are sequentially executed until step 370.
And step 370, when the completion of the application program is detected, synthesizing the first executable file and/or the second executable file to obtain a final production file.
The specific implementation of the above steps may refer to the implementation of the corresponding steps provided in the first and second embodiments, which are not described herein again.
The embodiment of the invention provides an interrupt service implementation method, which is characterized in that a program guide software and an application software have independent interrupt processing functions through a mode of carrying out address positioning on an interrupt service program, and interrupt vector relocation is carried out through a mapping relation established in advance, so that the corresponding interrupt processing functions are called, two different interrupt services are implemented in a low-end single chip microcomputer, the implementation mode is simple, the method is suitable for various single chip microcomputers which do not support a plurality of interrupt vector tables, and the method has better portability.
Example four
Fig. 4 is a schematic structural diagram of an interrupt service implementation apparatus according to a fourth embodiment of the present invention, as shown in fig. 4, the apparatus includes: an interrupt entry query module 401, an interrupt handling function address acquisition module 402 and an interrupt service routine calling module 403.
The interrupt entry querying module 401 is configured to query an interrupt entry function address in a preset interrupt vector table when an external interrupt request is detected.
An interrupt processing function address obtaining module 402, configured to call an interrupt entry function according to the interrupt entry function address, read a status flag bit through the interrupt entry function, and obtain a target interrupt processing function address according to the status flag bit.
An interrupt service program calling module 403, configured to call a target interrupt processing function according to the target interrupt processing function address, and call a target interrupt service program through the target interrupt processing function to enter an interrupt service.
The embodiment of the invention provides an interrupt service implementation device, which enables program guide software and application software to have independent interrupt processing functions through a mode of carrying out address positioning on an interrupt service program, carries out interrupt vector relocation through a mapping relation established in advance, calls the corresponding interrupt processing functions, and implements two different interrupt services in a low-end single chip microcomputer.
In an optional implementation manner of the embodiment of the present invention, before being used in the interrupt entry query module 401, the apparatus further includes: the jump flag bit judging module is used for executing a bootstrap program starting function and reading a jump flag bit when power-on is detected, and judging whether the jump flag bit is positioned at a jump bit position or not; a bootstrap state marking module, configured to mark a state flag bit as a bootstrap state if the jump flag bit is not set to the jump bit; and the application program state marking module is used for marking the state mark bit as the application program state and executing the application program starting function if the jump mark is positioned at the jump bit.
In an optional implementation manner of the embodiment of the present invention, the interrupt processing function address obtaining module 402 includes: the state reading submodule is used for reading a state flag bit through the interrupt entry function, and the state flag bit is a bootstrap state or an application state; the first obtaining submodule is used for obtaining the address of the interrupt processing function of the bootstrap program if the status flag bit is in the status of the bootstrap program; and the second obtaining submodule is used for obtaining the address of the interrupt processing function of the application program if the status flag bit is in the state of the application program.
In an optional implementation manner of the embodiment of the present invention, the interrupt service routine invoking module 403 includes: the first calling submodule is used for calling a bootstrap interrupt processing function according to the address of the bootstrap interrupt processing function and calling a bootstrap interrupt service program through the bootstrap interrupt processing function; and the second calling submodule is used for calling an application program interrupt processing function according to the application program interrupt processing function address and calling an application program interrupt service program through the application program interrupt processing function.
In an optional implementation manner of the embodiment of the present invention, after the module 403 for calling the interrupt service routine, the apparatus includes: the bootstrap program execution module is used for executing the bootstrap program and obtaining a first executable file when the completion of the bootstrap program interrupt service program is detected; and the state flag bit modification module is used for modifying the state flag bit into an application program state, executing an application program starting function and re-reading the state flag bit.
In an optional implementation manner of the embodiment of the present invention, after the module 403 is used for calling the interrupt service routine, the apparatus further includes: when the completion of the application program interrupt service program is detected, detecting whether the application program needs to be updated; the application program execution module is used for executing the application program and obtaining a second executable file if the application program does not need to be updated; and the jump flag bit modification module is used for separating the jump flag position from the jump bit position and executing a bootstrap program starting function if the application program needs to be updated, and re-reading the jump flag bit.
In an optional implementation of the embodiment of the present invention, the apparatus further comprises: and the file synthesis module is used for synthesizing the first executable file and/or the second executable file to obtain a final production file when the completion of the application program is detected.
The device can execute the interrupt service implementation method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the interrupt service implementation method.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a computer device according to a fifth embodiment of the present invention. FIG. 5 illustrates a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention. The computer device 12 shown in FIG. 5 is only an example and should not bring any limitations to the functionality or scope of use of embodiments of the present invention.
As shown in FIG. 5, computer device 12 is in the form of a general purpose computing device. The components of computer device 12 may include, but are not limited to: one or more processors 16, a memory 28, and a bus 18 that connects the various system components (including the memory 28 and the processors 16).
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. Computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, and commonly referred to as a "hard drive"). Although not shown in FIG. 5, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with computer device 12, and/or with any devices (e.g., network card, modem, etc.) that enable computer device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, computer device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with the other modules of computer device 12 via bus 18. It should be appreciated that although not shown in FIG. 4, other hardware and/or software modules may be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processor 16 executes various functional applications and data processing by running the program stored in the memory 28, so as to implement the interrupt service implementation method provided by the embodiment of the present invention: when an external interrupt request is detected, inquiring an interrupt entry function address in a preset interrupt vector table; calling an interrupt entry function according to the interrupt entry function address, reading a state flag bit through the interrupt entry function and acquiring a target interrupt processing function address according to the state flag bit; and calling a target interrupt processing function according to the target interrupt processing function address, calling a target interrupt service program through the target interrupt processing function, and entering interrupt service.
EXAMPLE six
A sixth embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the method for implementing an interrupt service provided in the sixth embodiment of the present invention is implemented: when an external interrupt request is detected, inquiring an interrupt entry function address in a preset interrupt vector table; calling an interrupt entry function according to the interrupt entry function address, reading a state flag bit through the interrupt entry function and acquiring a target interrupt processing function address according to the state flag bit; and calling a target interrupt processing function according to the target interrupt processing function address, calling a target interrupt service program through the target interrupt processing function, and entering interrupt service.
Any combination of one or more computer-readable media may be employed. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or computer device. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (9)

1. An interrupt service implementation method, comprising:
when an external interrupt request is detected, inquiring an interrupt entry function address in a preset interrupt vector table;
calling an interrupt entry function according to the interrupt entry function address, reading a state flag bit through the interrupt entry function and acquiring a target interrupt processing function address according to the state flag bit;
calling a target interrupt processing function according to the target interrupt processing function address, calling a target interrupt service program through the target interrupt processing function, and entering interrupt service;
before querying an interrupt entry function address in a preset interrupt vector table when the external interrupt request is detected, the method further includes:
when power-on is detected, executing a boot program starting function, reading a jump flag bit, and judging whether the jump flag bit is positioned at a jump bit position;
if the jump flag bit is not positioned at the jump bit position, marking the state flag bit as a bootstrap state;
and if the jump mark position is at the jump position, marking the state mark position as the application program state and executing the application program starting function.
2. The method of claim 1, wherein reading a status flag bit by the interrupt entry function and obtaining a target interrupt handling function address according to the status flag bit comprises:
reading a state flag bit through the interrupt entry function, wherein the state flag bit is a bootstrap state or an application state;
if the status flag bit is in a bootstrap program status, acquiring a bootstrap program interrupt processing function address;
and if the status flag bit is the application program status, acquiring an application program interrupt processing function address.
3. The method of claim 2, wherein said invoking a target interrupt handling function according to said target interrupt handling function address, invoking a target interrupt service routine via said target interrupt handling function, comprises:
calling a bootstrap interrupt processing function according to the bootstrap interrupt processing function address, and calling a bootstrap interrupt service program through the bootstrap interrupt processing function;
or calling an application program interrupt processing function according to the application program interrupt processing function address, and calling an application program interrupt service program through the application program interrupt processing function.
4. The method of claim 3, wherein after said invoking a target interrupt handling function according to said target interrupt handling function address, invoking a target interrupt service routine via said target interrupt handling function, and entering interrupt service, comprising:
when the completion of the bootstrap program interrupt service program is detected, executing the bootstrap program and obtaining a first executable file;
and modifying the state flag bit into an application program state, executing an application program starting function, and re-reading the state flag bit.
5. The method of claim 4, wherein after said invoking a target interrupt handling function according to said target interrupt handling function address, invoking a target interrupt service routine via said target interrupt handling function, and entering interrupt service, further comprising:
when the completion of the application program interrupt service program is detected, detecting whether the application program needs to be updated;
if the application program does not need to be updated, executing the application program and obtaining a second executable file;
and if the application program needs to be updated, separating the jump mark position from the jump position and executing a bootstrap program starting function, and re-reading the jump mark position.
6. The method of claim 5, further comprising:
and when the application program is detected to be completed, synthesizing the first executable file and/or the second executable file to obtain a final production file.
7. An interrupt service implementing apparatus, comprising:
the system comprises an interrupt entry query module, a function address generation module and an interrupt entry processing module, wherein the interrupt entry query module is used for querying an interrupt entry function address in a preset interrupt vector table when an external interrupt request is detected;
an interrupt processing function address obtaining module, configured to call an interrupt entry function according to the interrupt entry function address, read a status flag bit through the interrupt entry function, and obtain a target interrupt processing function address according to the status flag bit;
the interrupt service program calling module is used for calling a target interrupt processing function according to the target interrupt processing function address, calling a target interrupt service program through the target interrupt processing function and entering interrupt service;
before the interrupt entry query module, the apparatus further includes:
the jump flag bit judging module is used for executing a bootstrap program starting function and reading a jump flag bit when power-on is detected, and judging whether the jump flag bit is positioned at a jump bit position or not;
a bootstrap state marking module, configured to mark a state flag bit as a bootstrap state if the jump flag bit is not set to the jump bit;
and the application program state marking module is used for marking the state mark bit as the application program state and executing the application program starting function if the jump mark is positioned at the jump bit.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the interrupt service implementation method as claimed in any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the interrupt service implementation method of any one of claims 1 to 6.
CN202011035250.0A 2020-09-27 2020-09-27 Interrupt service implementation method, device, equipment and storage medium Active CN112198820B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011035250.0A CN112198820B (en) 2020-09-27 2020-09-27 Interrupt service implementation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011035250.0A CN112198820B (en) 2020-09-27 2020-09-27 Interrupt service implementation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112198820A CN112198820A (en) 2021-01-08
CN112198820B true CN112198820B (en) 2021-11-12

Family

ID=74007418

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011035250.0A Active CN112198820B (en) 2020-09-27 2020-09-27 Interrupt service implementation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112198820B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113568349B (en) * 2021-07-27 2023-05-02 深圳市轱辘车联数据技术有限公司 Data processing method, device, terminal equipment and readable storage medium
CN113986480A (en) * 2021-09-30 2022-01-28 深圳曦华科技有限公司 Method for calling interrupt service function and related device
CN114416317B (en) * 2022-01-20 2022-12-02 科东(广州)软件科技有限公司 Inter-core interrupt execution method, inter-core interrupt processing device, inter-core interrupt equipment and storage medium
CN117056062B (en) * 2023-10-13 2024-04-02 武汉天喻信息产业股份有限公司 Method and device for forcedly exiting interrupt service routine
CN118092983A (en) * 2024-04-26 2024-05-28 飞音车联网(苏州)有限公司 Software upgrading method for preventing power-on failure, singlechip and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4400773A (en) * 1980-12-31 1983-08-23 International Business Machines Corp. Independent handling of I/O interrupt requests and associated status information transfers
US5283869A (en) * 1989-07-25 1994-02-01 Allen-Bradley Company, Inc. Interrupt structure for network interface circuit
CN101488100A (en) * 2008-01-15 2009-07-22 上海海尔集成电路有限公司 Interruption system implementing method and device
CN104898637A (en) * 2015-03-27 2015-09-09 北京经纬恒润科技有限公司 Vehicle controller self-refreshing method and system
CN105183541A (en) * 2015-08-10 2015-12-23 上海斐讯数据通信技术有限公司 Response interrupting method and system
CN106959859A (en) * 2017-03-30 2017-07-18 北京奇虎科技有限公司 The call method and device of system call function
CN110244958A (en) * 2018-03-09 2019-09-17 法雷奥汽车内部控制(深圳)有限公司 The method and apparatus of nominal data for more new vehicle

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8677027B2 (en) * 2011-06-01 2014-03-18 International Business Machines Corporation Fibre channel input/output data routing system and method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4400773A (en) * 1980-12-31 1983-08-23 International Business Machines Corp. Independent handling of I/O interrupt requests and associated status information transfers
US5283869A (en) * 1989-07-25 1994-02-01 Allen-Bradley Company, Inc. Interrupt structure for network interface circuit
CN101488100A (en) * 2008-01-15 2009-07-22 上海海尔集成电路有限公司 Interruption system implementing method and device
CN104898637A (en) * 2015-03-27 2015-09-09 北京经纬恒润科技有限公司 Vehicle controller self-refreshing method and system
CN105183541A (en) * 2015-08-10 2015-12-23 上海斐讯数据通信技术有限公司 Response interrupting method and system
CN106959859A (en) * 2017-03-30 2017-07-18 北京奇虎科技有限公司 The call method and device of system call function
CN110244958A (en) * 2018-03-09 2019-09-17 法雷奥汽车内部控制(深圳)有限公司 The method and apparatus of nominal data for more new vehicle

Also Published As

Publication number Publication date
CN112198820A (en) 2021-01-08

Similar Documents

Publication Publication Date Title
CN112198820B (en) Interrupt service implementation method, device, equipment and storage medium
WO2020001112A1 (en) Application method for platform supporting multiple types of devices, and mobile terminal
CN110688096B (en) Method and device for constructing application program containing plug-in, medium and electronic equipment
CN103853532A (en) Method and device for calling function
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN112860798A (en) Data processing method and device, electronic equipment and storage medium
CN110221840B (en) Function implementation method and device of application program, equipment and storage medium
CN113835644A (en) Complete machine migration method, device, equipment and storage medium
US9977673B1 (en) Systems and methods for providing a platform-specific porting layer for multi-level software stacks
CN112615758A (en) Application identification method, device, equipment and storage medium
CN114721719A (en) Method and system for containerized deployment of heterogeneous applications in cluster
CN114296808B (en) Pin configuration method and device, electronic equipment and storage medium
US8086834B2 (en) System and method for populating a dedicated system service repository for an information handling system
CN114138363A (en) Program data calling method, device, equipment and storage medium
CN114816491A (en) System upgrading method and device for multi-system mobile terminal and terminal
CN111385661B (en) Method, device, terminal and storage medium for voice control of full screen playing
CN107911816B (en) Starting method for multi-mode IoT device, multi-mode IoT device and storage medium
TWI411921B (en) Electronic systems, computer-readable storage medium and methods for interconnecting peripheral devices and electronic systems
CN114860321A (en) External device control method, device, equipment and medium based on raspberry pi
CN113672465A (en) Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name
CN114237684A (en) Component management system, method, device, electronic device and storage medium
CN112416422A (en) Development version file submitting method, device, equipment and storage medium
CN114443582B (en) File system mounting method, device, equipment and medium on operating system
CN112015452B (en) Firmware upgrading method and device for gate system and gate system
CN112333264B (en) Management method and device of debugging terminal, electronic equipment and storage medium

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