CN112860301A - Method for using bootloader interrupt function by app and single chip microcomputer - Google Patents

Method for using bootloader interrupt function by app and single chip microcomputer Download PDF

Info

Publication number
CN112860301A
CN112860301A CN202110034794.3A CN202110034794A CN112860301A CN 112860301 A CN112860301 A CN 112860301A CN 202110034794 A CN202110034794 A CN 202110034794A CN 112860301 A CN112860301 A CN 112860301A
Authority
CN
China
Prior art keywords
program
bootloader
app
interrupt function
offset
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.)
Granted
Application number
CN202110034794.3A
Other languages
Chinese (zh)
Other versions
CN112860301B (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.)
Mingjian Xiamen Software Development Co ltd
Original Assignee
Mingjian Xiamen Software Development Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mingjian Xiamen Software Development Co ltd filed Critical Mingjian Xiamen Software Development Co ltd
Priority to CN202110034794.3A priority Critical patent/CN112860301B/en
Publication of CN112860301A publication Critical patent/CN112860301A/en
Application granted granted Critical
Publication of CN112860301B publication Critical patent/CN112860301B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/656Updates while running

Abstract

The invention relates to a method for using a bootloader interrupt function by an app and a singlechip, wherein the method comprises the following steps: when the upgrading process enters a bootloader program, setting g _ vector _ offset to be 0 at the initial position of a main function of the bootloader program; when the upgrading process enters the app program, setting g _ vector _ offset as an offset value of the app program at the starting position of a main function of the app program; adding a judgment condition whether g _ vector _ offset >0 is satisfied or not at the initial position of an interrupt function of the Bootloader program, and if so, directly jumping to the interrupt function of the corresponding app program for execution until the interrupt function of the app program is executed and then exiting the interrupt function of the Bootloader program; if not, the subsequent part of the interrupt function of the bootloader program is executed. The invention can enter bootloader program as long as the storage space of the singlechip is enough, thus realizing on-line upgrade.

Description

Method for using bootloader interrupt function by app and single chip microcomputer
Technical Field
The invention relates to the technical field of single-chip microcomputers, in particular to a method for using a bootloader interrupt function by an app and a single-chip microcomputer.
Background
The single chip microcomputer is widely applied to the field of household appliances or control. The single chip microcomputer is frequently required to be subjected to program online upgrading, and bootloader programs and app programs are required to be involved in online upgrading. However, many low-end scm do not support the remapping of the interrupt function table, such as 51, PIC, AVR, etc., and even the new tang NUC100 series of core-m 0 core scm and STM core-m 0 core scm do not support them. The remapping which does not support the interrupt function table cannot enter the bootloader program, and cannot enter the on-line upgrading of the single chip microcomputer.
Disclosure of Invention
In order to solve the above problems, the invention provides a method for using a bootloader interrupt function by an app and a single chip microcomputer.
The specific scheme is as follows:
a method for an app to use a bootloader interruption function, comprising:
when the upgrading process enters a bootloader program, setting g _ vector _ offset to be 0 at the initial position of a main function of the bootloader program; when the upgrading process enters the app program, setting g _ vector _ offset as an offset value of the app program at the starting position of a main function of the app program;
adding a judgment condition whether g _ vector _ offset >0 is satisfied or not at the initial position of an interrupt function of the Bootloader program, and if so, directly jumping to the interrupt function of the corresponding app program for execution until the interrupt function of the app program is executed and then exiting the interrupt function of the Bootloader program; if not, the subsequent part of the interrupt function of the bootloader program is executed.
Furthermore, the interrupt function tables of the app program and the bootloader program are stored in the initial position of the program memory.
Further, a parameter g _ vector _ offset for representing an offset value of the app program is stored at a start position of the data memory.
Further, the parameter g _ vector _ offset takes 4 bytes.
A single chip microcomputer with an app using a bootloader interrupt function comprises a processor, a memory and a computer program which is stored in the memory and can run on the processor, wherein the processor executes the computer program to realize the steps of the method of the embodiment of the invention.
By adopting the technical scheme, as long as the storage space of the singlechip is enough, the bootloader program can be entered, and online upgrade is realized.
Drawings
Fig. 1 is a flowchart illustrating a first embodiment of the present invention.
Detailed Description
To further illustrate the various embodiments, the invention provides the accompanying drawings. The accompanying drawings, which are incorporated in and constitute a part of this disclosure, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the embodiments. Those skilled in the art will appreciate still other possible embodiments and advantages of the present invention with reference to these figures.
The invention will now be further described with reference to the accompanying drawings and detailed description.
The first embodiment is as follows:
an embodiment of the present invention provides a method for using a bootloader interrupt function by an app, as shown in fig. 1, where the method includes the following steps:
s1: and storing the interrupt function tables of the app program and the bootloader program in the initial position of the program memory.
The program memory in this embodiment is a hard disk.
S2: a parameter g vector OFFSET representing the OFFSET value of the APP program is stored at the start position of the data memory, making the OFFSET value of the APP program APP _ OFFSET.
The data storage in this embodiment is a memory. The parameter g vector offset takes 4 bytes.
S3: when the upgrading process enters a bootloader program, setting g _ vector _ offset to be 0 at the initial position of a main function of the bootloader program; when the upgrade process enters the APP program, g _ vector _ OFFSET is set to APP _ OFFSET at the start position of the main function of the APP program.
S4: adding a judgment condition whether g _ vector _ offset >0 is satisfied or not at the initial position of an interrupt function of the Bootloader program, and if so, directly jumping to the interrupt function of the corresponding app program for execution until the interrupt function of the app program is executed and then exiting the interrupt function of the Bootloader program; if not, the subsequent part of the interrupt function of the bootloader program is executed.
And (4) normally writing an interrupt function of the App program.
By the method, as long as the storage space of the single chip microcomputer is enough, bootloader programs can be accessed, and online upgrading is achieved.
Example two:
the present invention further provides a single chip microcomputer with a bootloader interrupt function used by an app, and the single chip microcomputer includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements the steps in the foregoing method embodiments of the first embodiment of the present invention when executing the computer program.
The Memory includes a program Memory (e.g., a hard disk) and a data Memory (e.g., a Memory, which is a Random Access Memory (RAM)). In this embodiment, a computer program is stored in a program memory, and the processor implements various functions of the single chip microcomputer of the app using the bootloader interrupt function by running or executing the computer program stored in the program memory.
While the invention has been particularly shown and described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (5)

1. A method for an app to use a bootloader interrupt function, comprising:
when the upgrading process enters a bootloader program, setting g _ vector _ offset to be 0 at the initial position of a main function of the bootloader program; when the upgrading process enters the app program, setting g _ vector _ offset as an offset value of the app program at the starting position of a main function of the app program;
adding a judgment condition whether g _ vector _ offset >0 is satisfied or not at the initial position of an interrupt function of the Bootloader program, and if so, directly jumping to the interrupt function of the corresponding app program for execution until the interrupt function of the app program is executed and then exiting the interrupt function of the Bootloader program; if not, the subsequent part of the interrupt function of the bootloader program is executed.
2. The method for the app to use the bootloader interrupt function according to claim 1, wherein: the interrupt function tables of the app program and the bootloader program are both stored in the initial position of the program memory.
3. The method for the app to use the bootloader interrupt function according to claim 1, wherein: a parameter g vector offset representing the offset value of the app program is stored at the start position of the data memory.
4. The method for the app to use the bootloader interrupt function according to claim 1, wherein: the parameter g vector offset takes 4 bytes.
5. The utility model provides a singlechip that app used bootloader interrupt function which characterized in that: comprising a processor, a memory and a computer program stored in the memory and running on the processor, the processor implementing the steps of the method according to any of claims 1 to 4 when executing the computer program.
CN202110034794.3A 2021-01-12 2021-01-12 Method for using bootloader interrupt function by app and single chip microcomputer Active CN112860301B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110034794.3A CN112860301B (en) 2021-01-12 2021-01-12 Method for using bootloader interrupt function by app and single chip microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110034794.3A CN112860301B (en) 2021-01-12 2021-01-12 Method for using bootloader interrupt function by app and single chip microcomputer

Publications (2)

Publication Number Publication Date
CN112860301A true CN112860301A (en) 2021-05-28
CN112860301B CN112860301B (en) 2022-08-16

Family

ID=76002726

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110034794.3A Active CN112860301B (en) 2021-01-12 2021-01-12 Method for using bootloader interrupt function by app and single chip microcomputer

Country Status (1)

Country Link
CN (1) CN112860301B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011159263A1 (en) * 2010-06-15 2011-12-22 The Thailand Research Fund Embedded system providing bootloader selected execution of multiple independent modular programs
CN105204899A (en) * 2015-09-17 2015-12-30 浪潮软件集团有限公司 Realization of network-based singlechip firmware upgrading method
CN105912356A (en) * 2016-03-31 2016-08-31 武汉光迅科技股份有限公司 Optical module firmware program online upgrade method supporting version fallback
CN105955764A (en) * 2016-04-22 2016-09-21 佛山市南海区欧谱曼迪科技有限责任公司 Improvement method for STM32 single-chip microcomputer IAP serial program burning
CN106406955A (en) * 2016-09-22 2017-02-15 深圳市金溢科技股份有限公司 A method and a device for upgrades of a bootloader program in an RSU apparatus
CN109871223A (en) * 2019-01-17 2019-06-11 南京品畅科技发展有限公司 A kind of IAP method and system based on stm32 single-chip microcontroller
CN111273937A (en) * 2020-01-18 2020-06-12 四川九洲空管科技有限责任公司 Remote upgrading method based on STM32F746 processor

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011159263A1 (en) * 2010-06-15 2011-12-22 The Thailand Research Fund Embedded system providing bootloader selected execution of multiple independent modular programs
CN105204899A (en) * 2015-09-17 2015-12-30 浪潮软件集团有限公司 Realization of network-based singlechip firmware upgrading method
CN105912356A (en) * 2016-03-31 2016-08-31 武汉光迅科技股份有限公司 Optical module firmware program online upgrade method supporting version fallback
CN105955764A (en) * 2016-04-22 2016-09-21 佛山市南海区欧谱曼迪科技有限责任公司 Improvement method for STM32 single-chip microcomputer IAP serial program burning
CN106406955A (en) * 2016-09-22 2017-02-15 深圳市金溢科技股份有限公司 A method and a device for upgrades of a bootloader program in an RSU apparatus
CN109871223A (en) * 2019-01-17 2019-06-11 南京品畅科技发展有限公司 A kind of IAP method and system based on stm32 single-chip microcontroller
CN111273937A (en) * 2020-01-18 2020-06-12 四川九洲空管科技有限责任公司 Remote upgrading method based on STM32F746 processor

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
大吉机器人: "M0架构IAP", 《HTTPS://BLOG.CSDN.NET/UUNUBT/ARTICLE/DETAILS/99640366》 *

Also Published As

Publication number Publication date
CN112860301B (en) 2022-08-16

Similar Documents

Publication Publication Date Title
US9558016B2 (en) Platform system, method for changing support hardware configuration of universal extensible firmware interface basic input output system and computer program product
US5526523A (en) Interface between operating system and operating system extension
CN1648863A (en) Portable software application method
WO2001055845A2 (en) System and method for flexible software linking
CN102841802B (en) The method for upgrading software of mobile terminal
US10261918B2 (en) Process running method and apparatus
CN110990019A (en) Java class analysis method and device, storage medium and electronic equipment
CN111666330A (en) Data reading and writing method and device
CN108334413A (en) Information transmitting methods between a kind of firmware and operating system based on platform of soaring
CN112860301B (en) Method for using bootloader interrupt function by app and single chip microcomputer
CN114691391A (en) Super-calling method and device for kernel mode program of enhanced packet filter
US6256714B1 (en) Computer system with efficient memory usage for managing multiple application programs
CN103294578A (en) Method for obtaining instruction of triggering function
CN112596918A (en) Method for sharing variable between programs in system and storage device
CN105975322A (en) Device and method for program update and microcontroller
WO2008015685A2 (en) Systems and methods for synchronous code retrieval from an asynchronous source
US5241634A (en) Method of handling system calls to an operating system of a computer by system service routines stored as firmware
CN102023873B (en) Application program execution method and system, storage media controller and storage device
CN1971513A (en) Amending method for content of built-in program code of ROM
CN110515665B (en) Starting method, system and device of processor system
US7191443B2 (en) Digital device, task management method and program therefor
CN111221701A (en) Chip and circuit logic reconfiguration system thereof
CN111949377B (en) JVM parameter optimization method, device, server and storage medium for WEB middleware
CN101107591A (en) Computer system and method for activating basic program therein
CN113268266B (en) Multi-version coexistence management method, system and medium for applet rendering framework

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