CN117055964A - Embedded system - Google Patents

Embedded system Download PDF

Info

Publication number
CN117055964A
CN117055964A CN202310868875.2A CN202310868875A CN117055964A CN 117055964 A CN117055964 A CN 117055964A CN 202310868875 A CN202310868875 A CN 202310868875A CN 117055964 A CN117055964 A CN 117055964A
Authority
CN
China
Prior art keywords
program
working
working program
file
area
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
CN202310868875.2A
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.)
Leihua Electronic Technology Research Institute Aviation Industry Corp of China
Original Assignee
Leihua Electronic Technology Research Institute Aviation Industry Corp of China
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 Leihua Electronic Technology Research Institute Aviation Industry Corp of China filed Critical Leihua Electronic Technology Research Institute Aviation Industry Corp of China
Priority to CN202310868875.2A priority Critical patent/CN117055964A/en
Publication of CN117055964A publication Critical patent/CN117055964A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • G06F9/441Multiboot arrangements, i.e. selecting an operating system to be loaded
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The application provides an embedded system, which belongs to the technical field of industrial control, and specifically comprises FLASH and RAM, wherein the FLASH is divided into a first storage area and a plurality of second storage areas, and the RAM is divided into a bootstrap program use area, a working program file cache area and a working program loading area; the first storage area stores a bootstrap program; each second storage area stores an independent working program file, and the working program is configured to run in a working program loading area; after the embedded system is electrified, the bootstrap program reads all the working program files in the second storage area, acquires the required correct and complete working program files, places the working program files acquired by the bootstrap program in the working program file cache area, decodes the working program files in the working program file cache area, stores the decoded programs in the working program loading area, and jumps to the working program entrance. By the processing scheme, the system reliability is improved.

Description

Embedded system
Technical Field
The application relates to the field of industrial control, in particular to an embedded system.
Background
The control chip of the embedded system is packaged in the module, and the online upgrading function becomes the basic function of the product in face of the program upgrading requirement after the product is delivered. Meanwhile, part of external factors such as relatively bad working environment, poor power supply condition, high electromagnetic radiation and the like of the product can cause unknown abnormal working conditions of a FLASH chip storing a working program, and the FLASH chip is shown as that local individual data are changed, so that the program can not be started to run normally. Since it cannot be determined whether the programmed program is the correct program, there is no good solution to the problem of abnormal program change.
Disclosure of Invention
In view of this, the present application provides an embedded system, which realizes the function of repairing program abnormality by designing a program loading and error correcting algorithm with an online upgrade function, and reduces the influence range caused by local data abnormality of FLASH.
The embedded system provided by the application adopts the following technical scheme:
an embedded system comprises FLASH and RAM, wherein the FLASH is divided into a first storage area and a plurality of second storage areas, and the RAM is divided into a bootstrap program use area, a working program file cache area and a working program loading area;
the first storage area stores a bootstrap program;
each second storage area stores an independent working program file, and the working program is configured to run in a working program loading area;
after the embedded system is electrified, the bootstrap program reads all the working program files in the second storage area, acquires the required correct and complete working program files, places the working program files acquired by the bootstrap program in the working program file cache area, decodes the working program files in the working program file cache area, stores the decoded programs in the working program loading area, and jumps to the working program entrance.
Optionally, the working program is stored in a Hex to form a working program Hex file.
Optionally, each second storage area stores an independent and same working program file;
the bootstrap program reads the working program file in the first and second storage areas;
the boot program sequentially reads each piece of data in the working program file according to the flag bit in the working program file, and verifies each piece of data;
and after the segment data is successfully checked, the bootstrap program carries the successfully checked segment data to the RAM buffer area of the program file, when the segment fails in data check, the bootstrap program sequentially reads and checks the same segment data position of the working program file in other second storage areas, if the segment data is successfully read and checked from the same segment data position of the other second storage areas, the current checked segment data is successfully carried to the RAM buffer area of the program file, and the bootstrap program continues to read and check the next segment file position of the working program file in the first second storage area until all segment data are cached to the RAM buffer area of the program file.
Optionally, when the working program files in the second storage area have errors, the bootstrap program updates all working program files in the second storage area with the complete and correct working program files in the working program file buffer area.
Optionally, different working procedure files are stored in different second storage areas;
and when the boot program does not receive the designated working program loading instruction before the waiting state is finished, sequentially reading the working program files in the second storage area until the correct and complete working program files are found.
Optionally, when the bootstrap program receives the specified working program loading instruction, the working program file is directly read from the specified second storage area.
Optionally, after the system is powered on, the bootstrap program performs self-checking on the RAM, the RAM self-checking is not passed, the bootstrap program prints the working state outwards through the serial port, and the abnormality is reported; and switching to a communication instruction receiving state when the self-checking is passed.
In summary, the application has the following beneficial technical effects:
the application reduces the volume of the core program and reduces the probability of abnormal influence; the system has the function of abnormal error correction, and has high error correction success probability, thereby improving the reliability of the system.
The application adopts the Hex file format to store the working program, thereby facilitating the verification.
The application has the online debugging function and does not destroy the original curing program.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a diagram showing a program storage structure of an embedded system according to the present application;
FIG. 2 is a workflow diagram of a bootstrap program of the present application;
FIG. 3 is a schematic diagram illustrating the operation state transition of the embedded system according to the present application;
FIG. 4 is a flow chart of the data verification process of the present application.
Detailed Description
Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Other advantages and effects of the present application will become apparent to those skilled in the art from the following disclosure, which describes the embodiments of the present application with reference to specific examples. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. The application may be practiced or carried out in other embodiments that depart from the specific details, and the details of the present description may be modified or varied from the spirit and scope of the present application. It should be noted that the following embodiments and features in the embodiments may be combined with each other without conflict. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It is noted that various aspects of the embodiments are described below within the scope of the following claims. It should be apparent that the aspects described herein may be embodied in a wide variety of forms and that any specific structure and/or function described herein is merely illustrative. Based on the present disclosure, one skilled in the art will appreciate that one aspect described herein may be implemented independently of any other aspect, and that two or more of these aspects may be combined in various ways. For example, an apparatus may be implemented and/or a method practiced using any number of the aspects set forth herein. In addition, such apparatus may be implemented and/or such methods practiced using other structure and/or functionality in addition to one or more of the aspects set forth herein.
It should also be noted that the illustrations provided in the following embodiments merely illustrate the basic concept of the present application by way of illustration, and only the components related to the present application are shown in the drawings and are not drawn according to the number, shape and size of the components in actual implementation, and the form, number and proportion of the components in actual implementation may be arbitrarily changed, and the layout of the components may be more complicated.
In addition, in the following description, specific details are provided in order to provide a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects may be practiced without these specific details.
The embodiment of the application provides an embedded system.
As shown in FIG. 1, an embedded system comprises a controller, a FLASH and a RAM, wherein the FLASH is divided into a first storage area and a plurality of second storage areas, and the RAM is divided into a bootstrap application area, a working program file cache area and a working program loading area. Flash is a FLASH EEPROM memory, also called Flash memory, flash; RAM is named as Random Access Memory and Chinese-name as RAM
The first storage area stores a bootstrap program; each second storage area stores an independent working program file, and the working program is configured to run in a working program loading area; after the embedded system is electrified, the bootstrap program reads all the working program files in the second storage area, acquires the required correct and complete working program files, places the working program files acquired by the bootstrap program in the working program file cache area, decodes the working program files in the working program file cache area, stores the decoded programs in the working program loading area, and jumps to the working program entrance. The controller reads the guiding program and the working program to execute corresponding instructions.
The working program is stored in a Hex file to form a working program Hex file. The data is stored in ASCII codes, and the corresponding binary data range is limited, so that the data abnormality can be checked; the Hex format is provided with a check bit to facilitate data check; the Hex file is directly generated through a compiler without secondary processing; the Hex single-ended data has limited length, which is beneficial to error diagnosis when the data is abnormal. Wherein HEX, english is called Hexadecximal. ASCII is known as American Standard Code for Information Interchange and chinese is known as american standard code for information interchange.
The application abandons the normal direct programming mode of code data, adopts a program dynamic loading method, has the function of checking before loading the working program, and the working program is not directly programmed in the curable memory.
The application divides the embedded code into two parts, a boot program and a working program.
The function of the bootstrap program is as follows: (1) the system core function is responsible for the online upgrading function of the system; (2)
the method has the Hex format file decoding function; (3) verifying the code file of the working program; (4)
and carrying out data restoration on the abnormal code. The bootstrap function is constrained to minimize code size using volume minimization principles.
The function of the working program is as follows: the system mainly functions as a work task. Constraints of the working program include: (1) the code running environment is located in the appointed RAM area; (2) the codes are stored in a Hex file form; (3) the same version of the program file is stored at multiple locations.
Example 1:
in this embodiment, after the embedded system is powered on, the bootstrap program reads all the working program files in the second storage area, and the method for obtaining the required correct and complete working program files includes:
each second storage area stores independent and same working program files;
the bootstrap program reads the working program file in the first and second storage areas;
the boot program sequentially reads each piece of data in the working program file according to the flag bit in the working program file, and verifies each piece of data;
and after the segment data is successfully checked, the bootstrap program carries the successfully checked segment data to the RAM buffer area of the program file, when the segment fails in data check, the bootstrap program sequentially reads and checks the same segment data position of the working program file in other second storage areas, if the segment data is successfully read and checked from the same segment data position of the other second storage areas, the current checked segment data is successfully carried to the RAM buffer area of the program file, and the bootstrap program continues to read and check the next segment file position of the working program file in the first second storage area until all segment data are cached to the RAM buffer area of the program file.
When the working program files in the second storage area have errors, the bootstrap program updates all the working program files in the second storage area with errors by using the complete and correct working program files in the working program file cache area.
The operation flow of this embodiment is as follows:
as shown in fig. 2 and fig. 3, after the system is powered on, a boot program is first run, and a self-check is performed on the RAM in the boot program, so as to ensure that the RAM area is available.
The RAM self-checking is not passed, the bootstrap program prints the working state outwards through the serial port, and the abnormality is reported; and switching to a communication instruction receiving state when the self-checking is passed.
After the bootstrap program receives an external instruction within a specified time period, the bootstrap program enters an online upgrade state or an online debugging state according to a communication protocol and function setting, and the received data is in a hex format in any state, is stored in a specified RAM loading area, and loads a working program from the area. When the external instruction is not received within the appointed time, preparing the boot program to load the working program hex data stored in the system;
as shown in fig. 4, the Hex file of the working program is read from the designated area of the FLASH according to the Hex file flag bit segment, and if the verification is successful, the Hex file is transferred to the RAM buffer area of the Hex file, when the data verification fails, the Hex file is read from the same segment of data position of other backup storage areas and verified, if the verification fails on the same segment of data of all backup areas, the FLASH data is seriously damaged and cannot be repaired, the working program is loaded and terminated, and the external printing of working state data by the bootstrap program is performed. If the reading and checking of the same section of data position of the Hex backup area is successful, the data is carried to the RAM buffer area of the Hex file, and the bootstrap program continues to read and check from the next section of Hex file position.
After all the Hex data are read and checked, checking whether the check failure exists in the Hex data storage area, and if so, covering the data in the data abnormal area by using the RAM buffer data of the Hex file to ensure that each Hex data is restored to a normal state.
Loading the program of the Hex file RAM buffer area and jumping to run.
Example 2:
in this embodiment, after the embedded system is powered on, the bootstrap program reads all the working program files in the second storage area, and the method for obtaining the required correct and complete working program files is as follows:
different second storage areas store different working procedure files.
And when the boot program does not receive the designated working program loading instruction before the waiting state is finished, sequentially reading the working program files in the second storage area until the correct and complete working program files are found.
When the bootstrap program receives the appointed working program loading instruction, the working program file is directly read from the appointed second storage area.
As shown in fig. 3, when the system is powered on and performs online upgrade operation, a bootstrap program is firstly operated, self-checking is performed on the RAM area, after the self-checking is passed, an external instruction is received, online upgrade operation of a corresponding mode is performed according to the external instruction, and after the online upgrade operation is successful and completed, the latest working program is loaded into the system and operated.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the scope of the present application should be included in the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (7)

1. The embedded system is characterized by comprising FLASH and RAM, wherein the FLASH is divided into a first storage area and a plurality of second storage areas, and the RAM is divided into a bootstrap program use area, a working program file cache area and a working program loading area;
the first storage area stores a bootstrap program;
each second storage area stores an independent working program file, and the working program is configured to run in a working program loading area;
after the embedded system is electrified, the bootstrap program reads all the working program files in the second storage area, acquires the required correct and complete working program files, places the working program files acquired by the bootstrap program in the working program file cache area, decodes the working program files in the working program file cache area, stores the decoded programs in the working program loading area, and jumps to the working program entrance.
2. The embedded system of claim 1, wherein the worker program is stored in a Hex to form a worker program Hex file.
3. The embedded system of claim 1, wherein each second storage area stores an independent and identical working program file;
the bootstrap program reads the working program file in the first and second storage areas;
the boot program sequentially reads each piece of data in the working program file according to the flag bit in the working program file, and verifies each piece of data;
and after the segment data is successfully checked, the bootstrap program carries the successfully checked segment data to the RAM buffer area of the program file, when the segment fails in data check, the bootstrap program sequentially reads and checks the same segment data position of the working program file in other second storage areas, if the segment data is successfully read and checked from the same segment data position of the other second storage areas, the current checked segment data is successfully carried to the RAM buffer area of the program file, and the bootstrap program continues to read and check the next segment file position of the working program file in the first second storage area until all segment data are cached to the RAM buffer area of the program file.
4. The embedded system of claim 3, wherein the boot program updates all of the worker files in the second storage area that have errors with the complete correct worker file in the worker file cache when the worker files in the second storage area have errors.
5. The embedded system of claim 1, wherein different second storage areas store different work-path files;
and when the boot program does not receive the designated working program loading instruction before the waiting state is finished, sequentially reading the working program files in the second storage area until the correct and complete working program files are found.
6. The embedded system of claim 5, wherein the boot program, upon receiving the specified program load instruction, directly reads the program file from the specified second storage area.
7. The embedded system of claim 1, wherein the system is booted after power-up
The program carries out self-checking on the RAM, the RAM self-checking is not passed, the boot program prints the working state outwards through the serial port,
reporting an abnormality; and switching to a communication instruction receiving state when the self-checking is passed.
CN202310868875.2A 2023-07-13 2023-07-13 Embedded system Pending CN117055964A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310868875.2A CN117055964A (en) 2023-07-13 2023-07-13 Embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310868875.2A CN117055964A (en) 2023-07-13 2023-07-13 Embedded system

Publications (1)

Publication Number Publication Date
CN117055964A true CN117055964A (en) 2023-11-14

Family

ID=88652563

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310868875.2A Pending CN117055964A (en) 2023-07-13 2023-07-13 Embedded system

Country Status (1)

Country Link
CN (1) CN117055964A (en)

Similar Documents

Publication Publication Date Title
CN108446189B (en) Satellite-borne embedded software fault-tolerant starting system and method
US6907602B2 (en) Method for updating firmware of computer device
CN110928499B (en) Flash memory embedded in chip, chip and starting method of chip
CN109189405B (en) Method and system for verifying Flash data consistency of program
CN109358887B (en) On-line upgrading method, device and system for single chip microcomputer program
CN112231136A (en) SoC chip, method for acquiring repair information, storage medium and electronic equipment
CN108182078B (en) Optimized missile-borne device non-dismantling software online upgrading method
CN113110891B (en) Firmware loading method and device for solid state disk, computer equipment and storage medium
CN113590227A (en) Binary programming format loading method and system under embedded system
CN112650518A (en) DSP program on-line upgrading method
CN108170456B (en) Firmware upgrading method and device for electronic equipment
US20160210063A1 (en) Data writing method and system
CN111273928B (en) Bootloader design method for self-upgrading
CN117055964A (en) Embedded system
US10691465B2 (en) Method for synchronization of system management data
CN109002317B (en) PCBA firmware upgrading method and system and PCBA
CN116755735A (en) Online upgrading method and device for embedded software, peritoneal dialysis instrument and storage medium
US20090210613A1 (en) Method for Programming a Controller in a Motor Vehicle
CN112579338B (en) Starting method and system of equipment and storage medium
CN111857785A (en) MCU starting method and device and terminal equipment
CN114741091A (en) Firmware loading method and device, electronic equipment and computer readable storage medium
CN110888605B (en) EEPROM data writing method and device and electronic equipment
CN111158660B (en) Multi-mode on-orbit programming method for on-board software EEPROM (electrically erasable programmable read-Only memory)
KR20150075867A (en) Method and apparatus for executing bootloader
CN109643261B (en) Error correction method in flash memory

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