CN114879988A - Online upgrade method and device, computer equipment and storage medium - Google Patents

Online upgrade method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114879988A
CN114879988A CN202210417440.1A CN202210417440A CN114879988A CN 114879988 A CN114879988 A CN 114879988A CN 202210417440 A CN202210417440 A CN 202210417440A CN 114879988 A CN114879988 A CN 114879988A
Authority
CN
China
Prior art keywords
upgrading
interrupt
program
software
function
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.)
Pending
Application number
CN202210417440.1A
Other languages
Chinese (zh)
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.)
Ningbo Space Engine Technology Co ltd
Original Assignee
Ningbo Space Engine Technology 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 Ningbo Space Engine Technology Co ltd filed Critical Ningbo Space Engine Technology Co ltd
Priority to CN202210417440.1A priority Critical patent/CN114879988A/en
Publication of CN114879988A publication Critical patent/CN114879988A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/082Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0896Bandwidth or capacity management, i.e. automatically increasing or decreasing capacities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application belongs to the field of software upgrading, is applied to a CAN bus, and relates to an online upgrading method, an online upgrading device, computer equipment and a storage medium, wherein the method comprises the following steps: setting CAN bus network transmission rate and time slice distribution; acquiring a software upgrading program through a CAN bus according to the CAN bus network transmission rate and time slice distribution; taking out the reset interrupt vector address from the first interrupt vector table, executing the first interrupt reset function, jumping to the main function of the software upgrading program, and upgrading the software; and after the upgrading program is executed, jumping to the second interrupt vector table to take out the interrupt function entry address, then executing the second interrupt service function, and returning to the main function of the user application program after the second interrupt service function is executed. By separating the online upgrading program from the application program, the program can be directly upgraded online through the controller local area network bus, and the program upgrading and maintenance are facilitated.

Description

Online upgrade method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of software upgrading technologies, and in particular, to an online upgrading method and apparatus, a computer device, and a storage medium.
Background
In industrial application, software upgrading and maintenance are often required to be performed on a product program, and after a product is formed, upgrading cannot be performed in a mode of manually plugging and unplugging a simulator. At present, the online program upgrading mode is mainly realized by adopting a double-cache mechanism in flash. The method is characterized in that an operation function of flash is added in an application program to realize reading and writing of another cache, and the program jumps to the other cache to execute the function after power failure and restart. The method has the following defects: firstly, the occupied cache space is large, and two independent spaces are needed for storing the application program; secondly, the reliability is insufficient, and in the software upgrading process, if the system is powered off accidentally, the software program will fail to be upgraded and cannot run; thirdly, the complexity of the application program is improved, and the online upgrade and maintenance of the software program are inconvenient.
Disclosure of Invention
The embodiment of the application aims to provide an online upgrading method, an online upgrading device, computer equipment and a storage medium, so as to solve the problem that in the existing software upgrading process, if a system is powered off unexpectedly, a software program will fail to be upgraded and cannot run.
In order to solve the above technical problem, the present application provides an online upgrade method, which adopts the following technical scheme, including the following steps:
setting CAN bus network transmission rate and time slice distribution;
acquiring a software upgrading program through a CAN bus according to the CAN bus network transmission rate and time slice distribution;
taking out the reset interrupt vector address from the first interrupt vector table, executing the first interrupt reset function, jumping to the main function of the software upgrading program, and upgrading the software;
and after the upgrading program is executed, jumping to the second interrupt vector table to take out the interrupt function entry address, then executing the second interrupt service function, and returning to the main function of the user application program after the second interrupt service function is executed.
Further, the step of setting the transmission rate and time slice allocation of the CAN bus network specifically includes:
setting the transmission rate of a CAN bus network to be 300-800 Kbps, and setting a clock crystal oscillator of equipment to be upgraded to be an integral multiple of 8 MHz;
the CAN bus time slice distribution is set to be 10 in number of each bit time slice, the synchronous section is 1 bit, the propagation section and the first phase buffer section are 5 bits, and the second phase buffer section is 4 bits.
Further, the step of acquiring the software upgrading program through the CAN bus according to the transmission rate and the time slice distribution of the CAN bus network specifically includes:
acquiring an online upgrade identifier;
entering an online upgrading mode;
receiving ground control system upgrade software through a CAN bus according to the CAN bus network transmission rate and time slice distribution;
writing the upgrading software into a flash;
and clearing the online upgrade identifier.
Further, the step of taking out the reset interrupt vector address from the first interrupt vector table, executing the first interrupt reset function, and then jumping to the main function of the software upgrading program, and performing software upgrading specifically includes:
acquiring a stack top pointer;
jumping to a first interrupt vector table, and acquiring an address of a reset interrupt vector, wherein the address of the reset interrupt vector points to an entry address of a first interrupt service function;
and after the first interrupt reset function is executed, starting a main function of an upgrading program to upgrade software.
Further, after the execution of the upgrade program is completed, jumping to a second interrupt vector table to take out an interrupt function entry address, then executing a second interrupt service function, and returning to the user application program main function after the execution of the second interrupt service function specifically includes:
setting a flash memory area into two parts, wherein one part stores an upgrading program, and the other part stores an application program;
after the execution of the upgrading program is finished, jumping to a second interrupt vector table;
taking out the entry address of the interrupt function, and then executing a second interrupt service function;
and returning to the main function of the user application program after the second interrupt service function is executed.
Further, the step of receiving the ground control system upgrade software through the CAN bus according to the CAN bus network transmission rate and the time slice distribution specifically includes:
receiving packet data sent by a ground control system through a CAN bus, wherein the packet data carries a sender check code;
performing crc algorithm calculation on the packet data, and comparing the crc algorithm calculation with the sender validation code;
if the comparison is consistent, the package data is assembled and connected into upgrade software, otherwise, the package data is discarded.
Further, the online upgrade method further includes:
and setting a node data frame receiving and filtering principle on the CAN bus.
In order to solve the above technical problem, the present application further provides an online upgrade apparatus, which adopts the following technical scheme, including:
the setting module is used for setting the CAN bus network transmission rate and time slice distribution;
the acquisition module is used for acquiring a software upgrading program through the CAN bus according to the CAN bus network transmission rate and time slice distribution;
the upgrading module is used for taking out the reset interrupt vector address from the first interrupt vector table, jumping to a main function of a software upgrading program after executing a first interrupt reset function, and upgrading software;
and the jump module is used for jumping to the second interrupt vector table to take out the interrupt function entry address after the execution of the upgrading program is finished, then executing the second interrupt service function, and returning to the main function of the user application program after the execution of the second interrupt service function is finished.
In order to solve the above technical problem, the present application further provides a computer device, which adopts the following technical solution, and includes a memory and a processor, where the memory stores computer readable instructions, and the processor implements the steps of the online upgrade method when executing the computer readable instructions.
In order to solve the above technical problem, the present application further provides a computer-readable storage medium, which adopts the following technical solutions: the computer readable storage medium has stored thereon computer readable instructions which, when executed by the processor, implement the steps of the online upgrade method described above.
Compared with the prior art, the application mainly has the following beneficial effects: a mechanism for separating an online upgrading program from a user application program is adopted, the online upgrading program only provides an online upgrading function, and the user application program mainly meets the user requirements; a single cache mechanism is adopted in the flash to realize the online upgrade of the software, so that the space is saved; in the upgrading process, even if power is lost accidentally, the program can still be upgraded normally, and the online upgrading and maintenance of the program are facilitated.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a diagram of a preferred system architecture to which the present application may be applied;
FIG. 3 is a flow diagram of one embodiment of an online upgrade method of the present application;
FIG. 4 is a flowchart of one embodiment of step S202 in FIG. 3;
fig. 5 is a flow chart of packet verification performed by the sender and the receiver in the present application;
FIG. 6 is a flowchart of the start-up of an embedded program in the prior art;
FIG. 7 is a flowchart of the program operation of the present application;
FIG. 8 is a schematic block diagram of one embodiment of an online upgrade apparatus of the present application;
FIG. 9 is a schematic block diagram of one embodiment of a computer device of the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium of communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may interact with the server 105 via the network 104 using the first terminal device 101, the second terminal device 102, the third terminal device 103, to receive or send messages, etc. Various communication client applications, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like, may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103.
The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to a smart phone, a tablet computer, an e-book reader, an MP3 player (Moving Picture experts Group Audio Layer III, motion Picture experts compression standard Audio Layer 3), an MP4 player (Moving Picture experts Group Audio Layer IV, motion Picture experts compression standard Audio Layer 4), a laptop computer, a desktop computer, and the like.
The server 105 may be a server that provides various services, such as a background server that provides support for pages displayed on the first terminal apparatus 101, the second terminal apparatus 102, and the third terminal apparatus 103.
It should be noted that, the online upgrade method provided in the embodiments of the present application is generally executed by a server/terminal device, and accordingly, the online upgrade apparatus is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
FIG. 2 is a diagram of a preferred system architecture to which the present application may be applied. As shown in fig. 2, for ease of understanding, the following embodiments are described with a rocket-type servo stand-alone as a carrier for online software upgrade. The ground control system sends the prepared software upgrading file (such as bin file) to the rocket swing servo through the CAN bus, thereby realizing the process of online upgrading. The ground control system is a sender of the software upgrading file, and the rocket swing servo is a receiver of the software upgrading file. The rocket-borne swinging servo single machine takes the stm32 chip as a program carrier.
Example one
With continued reference to FIG. 3, a flow diagram of one embodiment of an online upgrade method of the present application is shown. The online upgrading method comprises the following steps:
step S201, setting CAN bus network transmission rate and time slice distribution.
In this embodiment, the electronic device (for example, the server/terminal device shown in fig. 1) on which the online upgrade method operates may receive the online upgrade request through a wired connection manner or a wireless connection manner. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G/5G connection, a WiFi connection, a bluetooth connection, a wimax x connection, a Zigbee connection, a uwb (ultra wideband) connection, and other wireless connection means now known or developed in the future.
In order to ensure that the load of the CAN bus is low, the bus rate is set to 300Kbps to 800Kbps, the bus rate is set to 500Kbps in the embodiment, the clock crystal oscillator of the device to be upgraded is set to be integral multiple of 8MHz, and the time slice distribution scheme is shown in table 1.
TABLE 1 bus Rate time slice Allocation Table
Figure BDA0003606583370000071
Bit time tBit is 1s/500kbps 2000 ns/bit; the crystal clock period T is 1s/8MHz 125 ns.
The CAN bus communication of the control system adopts an extended frame format of CAN2.0B standard, and the composition definition of the 29-bit identifier is shown in Table 2. An ID that does not comply with this specification is an illegal command, and the terminal node should discard or report an exception.
TABLE 2CAN BUS 29-bit identifier composition Definitions
Figure BDA0003606583370000072
Figure BDA0003606583370000081
And the message on the arrow is transmitted by one or more CAN bus data frames according to the effective data length to be transmitted. Different data frames constituting a message have the same message code, and the data frame numbers increase from 0 in sequence. The format of the message description is shown in table 3.
Table 3 message description format
Figure BDA0003606583370000082
Aiming at the 8-byte data field of each data frame, the byte sending sequence of the CAN bus is that the low byte is sent first and then the high byte is sent, and the 8 bits of each byte are sent first and then the low bit is sent.
The bus protocol follows a little-end mode for the encoding and storing mode of the data field, and low bytes are stored in a low address and high bytes are stored in a high address. The encoding of 8-bit single byte data follows a pattern with the upper bits of the data placed in the upper byte bits and the lower bits of the data placed in the lower byte bits.
And step S202, acquiring a software upgrading program through the CAN bus according to the CAN bus network transmission rate and time slice distribution.
Fig. 4 is a flowchart of an embodiment of step S202 in fig. 3. As shown in fig. 4, in this embodiment, step S202 may further include the steps of:
s2021, initializing an online upgrading program;
s2022, inquiring whether an online upgrading mark exists, if so, executing the step S2023, otherwise, executing the step S2024;
s2023, entering an online upgrading mode;
s2024, skipping to execute the user application program;
s2025, receiving ground control system upgrade software;
s2026, writing the upgrade file into a flash;
s2027, clearing the online upgrading mark.
The step of receiving the ground control system upgrading software through the CAN bus according to the CAN bus network transmission rate and time slice distribution specifically comprises the following steps:
receiving packet data sent by a ground control system through a CAN bus, wherein the packet data carries a sender check code;
performing crc algorithm calculation on the packet data, and comparing the crc algorithm calculation with the sender validation code;
if the comparison is consistent, the package data is assembled and connected into upgrade software, otherwise, the package data is discarded.
The ground control system carries out online upgrade on the rocket swinging servo through a can protocol, and due to the fact that upgrade files are generally large, the upgrade is carried out in a mode of transmitting data in batches. To ensure transmission reliability, each data packet may be, for example, 2 kbytes in size, each packet having a crc code, transmitted in batches, and finally subjected to file verification. Crc the check algorithm sender and receiver are kept consistent, the sender sends the packet data with check code, the receiver calculates the crc algorithm of the received packet data and compares with the check code of the sender, to ensure the correctness of the data.
TABLE 4CAN BUS BLOCK TRANSMISSION COMMAND INFORMATION CHARACTERISTICS
Figure BDA0003606583370000091
Figure BDA0003606583370000101
Table 4 illustrates the handshake during CAN bus transmission. The Can2.0b communication protocol consists of 3 parts: ID. Data length, data content. The table mainly refers to the ID and data length interpretation of the command frame.
Table 5 block transfer command information content
Figure BDA0003606583370000102
Table 5 illustrates the data content of the block transfer command frame. Together with table 4, constitute a complete command frame. Simply put, it tells the recipient that they are ready to begin doing specific work.
TABLE 6 different operation type parameter definitions
Figure BDA0003606583370000103
Figure BDA0003606583370000111
Table 6 shows the setting of the three parameters in table 5. The way in which the parameters are set differs slightly from the different types of operation in table 5.
TABLE 7 characteristics of block transfer command response information
Content providing method and apparatus
Source Executing node (0xYY)
Purpose(s) to Initiating node (0xXX)
ID 01 11101yyyyyy xxxxxx 00 11111111(0x0Fxxxxxx)
Information length 8byte
Remarks for note And the initiating node and the executing node transmit data command responses in a block mode.
Table 7 shows how the receiver responds to the command frame from the sender. Together with table 8, the response frame contents of the command frame are composed.
Table 8 block transfer command response information content
Figure BDA0003606583370000112
Figure BDA0003606583370000121
Table 8 shows how the receiver responds to the command frame from the sender.
TABLE 9 characteristics of transmission data information
Content providing method and apparatus
Source Initiating node (0xXX)
Purpose(s) to Executing node (0xYY)
ID 11 11110xxxxxx yyyyyy 00nnnnnnnn
Information length 8byte
Remarks for note
And the initiating node and the executing node transmit data in a block transmission mode, n represents a frame sequence number, and the position of the frame data head of the writing/reading content in the block is n-8 bytes. When nnnnnnnn is 0xFF, the frame is transmitted completely. Table 9, together with table 10, constitutes the content of the data frame, which is sent to the receiver for updating the file information content.
Table 10 block transfer data information content
Figure BDA0003606583370000122
Table 10 illustrates the Can protocol feature, sending 8 valid bytes of upgrade file information per frame of data.
Fig. 5 is a flowchart of packet verification performed by the sender and the receiver in the present application. As shown in fig. 5, the process of data packet verification by the sender and the receiver, and the interaction of command reception and transmission by the sender and the receiver through the CAN bus, includes the following steps:
s401, a sender sends a data package order to a receiver;
s501, the receiver responds to the binding command;
s402, the sender judges whether a binding command response from the receiver is received, if so, the step S403 is executed, otherwise, the step S401 is executed;
s403, after a certain time interval is 1S, the sender sends the binding data to the receiver, and then step S404 and step S502 are executed simultaneously;
s404, the sender sends a verification command to the receiver;
s502, the receiving party receives the binding data from the sending party;
s405, the sender judges whether the binding data is correct, if so, the step S406 is executed, otherwise, the step S403 is executed;
s503, the receiving party receives the transmitted checking command from the transmitting party and checks the data;
s504, the receiver responds to the check command to the sender;
s406, inquiring next packet of data;
s407, judging whether the data binding is finished, if so, executing a step S408, otherwise, executing a step S403;
s408, the sender sends a file verification command to the receiver;
s505, the receiving party receives a file verification command from the sending party and verifies the file;
s409, the sender judges whether the file verification is correct, if so, the step S410 is executed, otherwise, the step S403 is executed;
s506, the receiver responds to the file verification command to the sender;
s410, the sender sends a flash erasing command to the receiver;
the flash operation comprises flash initialization, flash erasing, flash writing and the like. The flash initialization comprises the steps of unlocking the flash, clearing the flash state (comprising an operation state and an error state), locking the flash and the like. The flash erasing mainly adopts a sector erasing method, and can erase the designated sector. And writing data with specified length into the specified flash address by flash writing.
S507, the receiving party receives a flash erasing command from the sending party and erases the flash;
s411, the sender judges whether the flash erasure is correct, if so, the step S412 is executed, otherwise, the step S410 is executed;
s508, the receiver responds to the flash erasing command by the sender;
s412, the sender sends a flash writing command to the receiver;
s509, the receiving party receives a flash writing command from the sending party and performs flash writing operation;
s413, the sender judges whether the flash is written correctly, if so, the flow is ended, and if not, the step S412 is executed;
s510, the receiver responds to the sender by writing a flash command.
Step S203, the reset interrupt vector address is taken out from the first interrupt vector table, and after the first interrupt reset function is executed, the main function of the software upgrading program is skipped to, and the software is upgraded.
Fig. 6 is a flowchart of the start-up of an embedded program in the prior art. As shown in fig. 6, the stack is an arithmetic limited linear table. The limitation is that only insert and delete operations are allowed at one end of the table. This end is referred to as the top of the stack, while the opposite end is referred to as the bottom of the stack. The stack address refers to the address of the top of the stack. When a stack memory is allocated to the local variable, the system stores the local variable into a certain memory block of the stack; when the partial variables are released after the operation of the subfunction is finished, the system clears the data stored in the stack memory of the partial variables, and restores the original uninitialized state.
The interrupt vector table refers to the offset and segment base of the interrupt service program entry address, and one interrupt vector occupies 4 bytes of space. The interrupt vector table is the lowest 1K byte space in the 8086 system memory, and the function of the interrupt vector table is to store corresponding interrupt vectors according to the sequence of interrupt type numbers from small to large, and store 256 interrupt vectors in total. In the interrupt response process, the CPU calculates the position of the corresponding interrupt vector in the table by the interrupt type number (interrupt vector number) acquired from the interface circuit, and acquires the interrupt vector from the interrupt vector table, and diverts the program flow to the entry address of the interrupt service program.
The interrupt service program, the processor processing "emergency", is understood as a service, and is completed by executing a specific program which is programmed in advance, and the program processing "emergency" is called an interrupt service program. Obtaining an entry address of an interrupt function from an interrupt vector table;
the starting process of the embedded program in the prior art is as follows: after the stack top address is obtained, jumping to an interrupt vector table, obtaining the address of an interrupt service function, and after an interrupt reset function is executed, entering a main program.
In this embodiment, step S203 may further include the steps of:
obtaining an entry address of an interrupt function from a first interrupt vector table;
after acquiring a stack top pointer, jumping to an interrupt vector table to acquire an address of a reset interrupt vector;
and after the first interrupt reset function is executed, starting a main function of an upgrading program to upgrade software.
And step S204, after the execution of the upgrading program is finished, jumping to the second interrupt vector table to take out the interrupt function entry address, then executing the second interrupt service function, and returning to the main function of the user application program after the execution of the second interrupt service function is finished.
Fig. 7 is a flowchart of the program operation of the present application. As shown in fig. 7, the present embodiment separates the online upgrade program and the user application program, where the online upgrade program only provides the online upgrade function, and the user application program mainly fulfills the user requirement. And after the power-on program is powered on, the reset interrupt vector address is taken out from the interrupt vector table, and after the first interrupt reset function is executed, the main function of the upgrading program is jumped to. After the upgrading program is executed, jumping to the second interrupt vector table to take out the interrupt function entry address, then jumping to a new interrupt service function to execute, and returning to the user application program main function after the second interrupt service function is executed.
The flash memory area is set into two parts, one part stores the upgrading program, and the other part stores the application program. The online upgrade takes only a small portion of space (e.g., may be 8-16K) and is separate from the user application. Because the online upgrading program is relatively solidified, the online upgrading method is convenient for upgrading, maintaining and using, and is also relatively suitable for online upgrading of other single-machine products on the rocket. And the on-line upgrading identifier can be used for sending a command to a user application program by the ground control system through the can protocol and recording the state of the identifier. Even if power is accidentally cut off in the upgrading process, the power can be upgraded again after the normal power is restored.
In some optional implementations of this embodiment, a node data frame receiving and filtering principle may be further set on the CAN bus. The CAN bus is a broadcast general channel, various information is transmitted on the bus, and in order to avoid interference of irrelevant information on each execution node, each node single machine must filter CAN bus node information and only respond to the relevant information of the node. In the whole CAN bus network, irrelevant messages are filtered by utilizing whether D10-D15 of data frame IDs are consistent with the node number of the equipment or not through the identifier filtering function of the CAN bus controller. A node refers to a device whose software is to be upgraded.
According to the method and the device, a node data frame receiving and filtering principle CAN be set on the CAN bus, and only the information related to the node is responded, so that the data interaction efficiency is improved, and the online upgrading time is saved.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware associated with computer readable instructions, which can be stored in a computer readable storage medium, and when executed, the processes of the embodiments of the methods described above can be included. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
Example two
With further reference to fig. 8, as an implementation of the method shown in fig. 3, the present application provides an embodiment of an online upgrade apparatus, which corresponds to the embodiment of the method shown in fig. 3, and which can be applied to various electronic devices.
As shown in fig. 8, the online upgrade apparatus 600 according to this embodiment includes: a setting module 601, an obtaining module 602, an upgrading module 603, and an adjusting module 604. Wherein:
the setting module 601 is used for setting the transmission rate and time slice distribution of the CAN bus network;
an obtaining module 602, configured to obtain a software upgrading program through a CAN bus according to a CAN bus network transmission rate and time slice allocation;
the upgrading module 603 is configured to take out a reset interrupt vector address from the first interrupt vector table, execute the first interrupt reset function, and then jump to a main function of the software upgrading program to upgrade software;
the jump module 604 is configured to jump to the second interrupt vector table to take out an interrupt function entry address after the execution of the upgrade program is completed, execute the second interrupt service function, and return to the user application program main function after the execution of the second interrupt service function is completed.
In the embodiment, a mechanism for separating the online upgrading program from the user application program is adopted, the online upgrading program only provides an online upgrading function, and the user application program mainly meets the user requirements; a single cache mechanism is adopted in the flash to realize the online upgrade of the software, so that the space is saved; in the upgrading process, even if power is lost accidentally, the program can still be upgraded normally, and the online upgrading and maintenance of the program are facilitated.
EXAMPLE III
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 9, fig. 9 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 7 comprises a memory 71, a processor 72, a network interface 73, which are communicatively connected to each other via a system bus. It is noted that only a computer device 7 having a component memory 71, a processor 72 and a network interface 73 is shown, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 71 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 71 may be an internal storage unit of the computer device 7, such as a hard disk or a memory of the computer device 7. In other embodiments, the memory 71 may also be an external storage device of the computer device 7, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 7. Of course, the memory 71 may also comprise both an internal storage unit of the computer device 7 and an external storage device thereof. In this embodiment, the memory 71 is generally used for storing an operating system installed in the computer device 7 and various application software, such as computer readable instructions of an online upgrade method. Further, the memory 71 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 72 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 72 is typically used to control the overall operation of the computer device 7. In this embodiment, the processor 72 is configured to execute computer readable instructions stored in the memory 71 or process data, such as computer readable instructions for executing the online upgrade method.
The network interface 73 may comprise a wireless network interface or a wired network interface, and the network interface 73 is generally used for establishing a communication connection between the computer device 7 and other electronic devices.
In the embodiment, a mechanism for separating the online upgrading program from the user application program is adopted, the online upgrading program only provides an online upgrading function, and the user application program mainly meets the user requirements; a single cache mechanism is adopted in the flash to realize the online upgrade of the software, so that the space is saved; in the upgrading process, even if power is lost accidentally, the program can still be upgraded normally, and the online upgrading and maintenance of the program are facilitated.
Example four
The present application further provides another embodiment, which is to provide a computer-readable storage medium storing computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of the online upgrade method as described above.
In the embodiment, a mechanism for separating the online upgrading program from the user application program is adopted, the online upgrading program only provides an online upgrading function, and the user application program mainly meets the user requirements; a single cache mechanism is adopted in the flash to realize the online upgrade of the software, so that the space is saved; in the upgrading process, even if power is lost accidentally, the program can still be upgraded normally, and the online upgrading and maintenance of the program are facilitated.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. An online upgrading method is applied to a CAN bus and is characterized by comprising the following steps:
setting CAN bus network transmission rate and time slice distribution;
acquiring a software upgrading program through a CAN bus according to the CAN bus network transmission rate and time slice distribution;
taking out the reset interrupt vector address from the first interrupt vector table, executing the first interrupt reset function, and then jumping to the main function of the software upgrading program to upgrade the software;
and after the upgrading program is executed, jumping to a second interrupt vector table, taking out the interrupt function entry address, executing a second interrupt service function, and returning to the main function of the user application program after the second interrupt service function is executed.
2. The online upgrade method according to claim 1, wherein the step of setting the transmission rate and time slice allocation of the CAN bus network specifically comprises:
setting the transmission rate of a CAN bus network to be 300-800 Kbps, and setting a clock crystal oscillator of equipment to be upgraded to be an integral multiple of 8 MHz;
the CAN bus time slice distribution is set to be 10 in number of each bit time slice, the synchronous section is 1 bit, the propagation section and the first phase buffer section are 5 bits, and the second phase buffer section is 4 bits.
3. The on-line upgrading method according to claim 1, wherein the step of acquiring the software upgrading program through the CAN bus according to the CAN bus network transmission rate and time slice allocation specifically comprises:
acquiring an online upgrade identifier;
entering an online upgrading mode;
receiving ground control system upgrade software through a CAN bus according to the CAN bus network transmission rate and time slice distribution;
writing the upgrading software into a flash;
and clearing the online upgrade identifier.
4. The online upgrade method according to claim 1, wherein the step of fetching the reset interrupt vector address from the first interrupt vector table, executing the first interrupt reset function, and jumping to a main function of the software upgrade program, and performing the software upgrade specifically includes:
acquiring a stack top pointer;
jumping to a first interrupt vector table, and acquiring an address of a reset interrupt vector, wherein the address of the reset interrupt vector points to an entry address of a first interrupt service function;
and after the first interrupt reset function is executed, starting a main function of an upgrading program to upgrade software.
5. The on-line upgrading method of claim 1, wherein the step of jumping to the second interrupt vector table after the upgrading program is executed, taking out the interrupt function entry address, then executing the second interrupt service function, and returning to the user application program main function after the second interrupt service function is executed specifically comprises:
setting a flash memory area into two parts, wherein one part stores an upgrading program, and the other part stores an application program;
after the execution of the upgrading program is finished, jumping to a second interrupt vector table;
taking out the entry address of the interrupt function, and then executing a second interrupt service function;
and returning to the main function of the user application program after the second interrupt service function is executed.
6. The on-line upgrading method according to claim 3, wherein the step of receiving the ground control system upgrading software through the CAN bus according to the CAN bus network transmission rate and the time slice distribution specifically comprises:
receiving packet data sent by a ground control system through a CAN bus, wherein the packet data carries a sender check code;
performing crc algorithm calculation on the packet data, and comparing the crc algorithm calculation with the sender validation code;
if the comparison is consistent, the package data is assembled and connected into upgrade software, otherwise, the package data is discarded.
7. The online upgrade method according to any one of claims 1 to 6, wherein:
and setting a node data frame receiving and filtering principle on the CAN bus.
8. An online upgrade apparatus, comprising:
the setting module is used for setting the CAN bus network transmission rate and time slice distribution;
the acquisition module is used for acquiring a software upgrading program through the CAN bus according to the CAN bus network transmission rate and time slice distribution;
the upgrading module is used for taking out the reset interrupt vector address from the first interrupt vector table, jumping to a main function of a software upgrading program after executing a first interrupt reset function, and upgrading software;
and the jump module is used for jumping to the second interrupt vector table to take out the interrupt function entry address after the execution of the upgrading program is finished, then executing the second interrupt service function, and returning to the main function of the user application program after the execution of the second interrupt service function is finished.
9. A computer device comprising a memory having computer readable instructions stored therein and a processor which when executed implements the steps of the online upgrade method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer-readable instructions stored thereon which, when executed by a processor, implement the steps of the online upgrade method according to any one of claims 1 to 7.
CN202210417440.1A 2022-04-20 2022-04-20 Online upgrade method and device, computer equipment and storage medium Pending CN114879988A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210417440.1A CN114879988A (en) 2022-04-20 2022-04-20 Online upgrade method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210417440.1A CN114879988A (en) 2022-04-20 2022-04-20 Online upgrade method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114879988A true CN114879988A (en) 2022-08-09

Family

ID=82672418

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210417440.1A Pending CN114879988A (en) 2022-04-20 2022-04-20 Online upgrade method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114879988A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118092983A (en) * 2024-04-26 2024-05-28 飞音车联网(苏州)有限公司 Software upgrading method for preventing power-on failure, singlechip and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118092983A (en) * 2024-04-26 2024-05-28 飞音车联网(苏州)有限公司 Software upgrading method for preventing power-on failure, singlechip and storage medium

Similar Documents

Publication Publication Date Title
CN112765271B (en) Block chain transaction index storage method and device, computer equipment and medium
CN108255513B (en) Electronic device, springmvc-based data interface, automatic generation method of description of springmvc-based data interface, and storage medium
CN108449313B (en) Electronic device, Internet service system risk early warning method and storage medium
CN103428188A (en) Method and apparatus for file updating, and associated equipment
CN110278143B (en) E-mail data processing method and device, computer equipment and storage medium
CN111638894A (en) Software upgrading method and device and computer storage medium
CN112416458A (en) Preloading method and device based on ReactNative, computer equipment and storage medium
KR20150066876A (en) Method for controlling an user interface and an electronic device
CN112631884A (en) Pressure measurement method and device based on data synchronization, computer equipment and storage medium
CN114879988A (en) Online upgrade method and device, computer equipment and storage medium
CN103294742A (en) Apparatus and method for determining duplication of content in portable terminal
CN104836777A (en) Identity verification method and system
CN114637611A (en) Information processing method and device based on message queue and computer equipment
CN112818270B (en) Data cross-domain transfer method and device and computer equipment
CN104049998A (en) Upgrade package processing method, device and apparatus in Android system
CN111475468A (en) Log access method, device, equipment and storage medium of newly added system
CN106488392B (en) Data transfer method and device
CN105991729B (en) Installation package downloading method and server
CN114520807A (en) File uploading and downloading method and device, computer equipment and storage medium
CN114048718A (en) Table data processing method and device, computer equipment and storage medium
CN114143309A (en) File transmission method and device, computer equipment and medium
CN114138401A (en) Container configuration method, device, equipment and medium based on artificial intelligence
CN113050936A (en) Front-end data processing method and device based on integrated development environment
CN104077618B (en) A kind of method and apparatus accessing smart card
CN109828954B (en) Data erasing method and device

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