CN117648698A - Program setting method and device, storage medium and electronic device - Google Patents

Program setting method and device, storage medium and electronic device Download PDF

Info

Publication number
CN117648698A
CN117648698A CN202311643350.5A CN202311643350A CN117648698A CN 117648698 A CN117648698 A CN 117648698A CN 202311643350 A CN202311643350 A CN 202311643350A CN 117648698 A CN117648698 A CN 117648698A
Authority
CN
China
Prior art keywords
program
programs
address
target
executable
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
CN202311643350.5A
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.)
Shanghai Ruipu Energy Co Ltd
Rept Battero Energy Co Ltd
Original Assignee
Shanghai Ruipu Energy Co Ltd
Rept Battero Energy 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 Shanghai Ruipu Energy Co Ltd, Rept Battero Energy Co Ltd filed Critical Shanghai Ruipu Energy Co Ltd
Priority to CN202311643350.5A priority Critical patent/CN117648698A/en
Publication of CN117648698A publication Critical patent/CN117648698A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/575Secure boot
    • 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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • 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/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • 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
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a program setting method and device, a storage medium and an electronic device, wherein the method comprises the following steps: setting a start program at a first address as an executable program and setting other programs at other addresses as non-executable programs, wherein the client comprises a plurality of programs including: starting the programs and other programs, wherein the programs are divided into different addresses according to preset rules, and the different addresses comprise: a first address and other addresses; under the condition that the starting program passes the verification, calling a second address of a target program in other programs, wherein the target program is any program in the other programs; determining whether the second address is consistent with a third address corresponding to the target program indicated by the preset rule; in the case of coincidence, the target program is set as an executable program.

Description

Program setting method and device, storage medium and electronic device
Technical Field
The present invention relates to the field of communications, and in particular, to a program setting method and apparatus, a storage medium, and an electronic apparatus.
Background
In the electronic technical field of embedded automobiles, for a software updating scheme, a boot loader (boot) is firstly brushed into a microcontroller unit (Microcontrol ler Unit, abbreviated as MCU) through a burner, and then an application program (APP) or an update APP is performed through a unified diagnostic service protocol (Unified Diagnost ic Services protocol, abbreviated as UDS).
Based on the software updating scheme, the validity of the command of each line of the file needs to be checked when the APP is written. After the writing, the whole APP is usually not verified or is partially verified due to the long time for verifying the whole APP, so that the address of a single bit or a continuous area of the APP is modified and not found, and a certain potential safety hazard exists. Meanwhile, the problem that the program cannot normally run or abnormally run and the system safety is affected can be caused.
Therefore, there is a need to solve the above-mentioned drawbacks in the related art, which easily results in that a single or continuous region of the whole APP is modified without being found during the process of partially verifying the whole APP.
Disclosure of Invention
The embodiment of the application provides a program setting method and device, a storage medium and an electronic device, which are used for easily causing the problem that a single or continuous area of a whole APP is modified but not found in the process of performing partial verification on the whole APP in at least the prior art.
According to an aspect of the embodiments of the present application, there is provided a program setting method, including: setting a start program at a first address as an executable program and setting other programs at other addresses as non-executable programs, wherein the client comprises a plurality of programs including: the starting program and the other programs are divided into different addresses according to preset rules, and the different addresses comprise: the first address and the other addresses; under the condition that the starting program passes the verification, calling a second address of a target program in the other programs, wherein the target program is any program in the other programs; determining whether the second address is consistent with a third address corresponding to the target program indicated by the preset rule; in case of coincidence, the target program is set as an executable program.
In an exemplary embodiment, before setting the start-up program at the first address as an executable program and setting the other programs at the other addresses as non-executable programs, the method further comprises: acquiring program functions of all programs in the plurality of programs; determining each address length required by each program in the plurality of programs according to the program function; dividing the programs into different addresses according to the address length.
In an exemplary embodiment, invoking the second address of the target program in the other program includes: executing the target program; triggering a fault interrupt response if the target program is determined to be a non-executable program, wherein the fault interrupt response is used for indicating the second address of the target program; and calling the second address from the fault interrupt response.
In an exemplary embodiment, invoking the second address of the target program in the other program includes: determining the priority of the other programs; determining the verification sequence of any program according to the priorities corresponding to the other programs respectively; determining the target program according to the verification sequence; the calling the second address of the target program in the other programs comprises the following steps: checking the target program; and calling the second address of the target program under the condition that verification is passed.
In an exemplary embodiment, after determining whether the second address is consistent with the third address corresponding to the target program indicated by the preset rule, the method further includes: feeding back a fault reason of the target program under the condition that the second address is inconsistent with the third address; determining whether the fault reasons belong to target fault reasons corresponding to the fault permitted to be repaired; and repairing the fault corresponding to the fault cause existing in the target program under the condition that the fault cause belongs to the target fault cause.
In an exemplary embodiment, after the target program is set as the executable program, the method further includes: determining a first program in the other programs, wherein the first program is a program which is changed from a non-executable program to an executable program in the first of the other programs; determining whether the client has a starting right to the first program; and when the client side has the starting authority of the first program, starting the first program according to the starting authority.
In an exemplary embodiment, after determining whether the client has the boot right for the first program, the method further includes: determining a second program in the other programs when the client does not have the starting authority to the first program, wherein the second program is changed from a non-executable program to an executable program in the other programs; determining whether the client has a starting right to the second program; and when the client side has the starting authority of the second program, starting the second program according to the starting authority.
According to another aspect of the embodiments of the present application, there is also provided a program setting apparatus, including: a first setting module, configured to set a startup program at a first address as an executable program, and set other programs at other addresses as non-executable programs, where the client includes a plurality of programs including: the starting program and the other programs are divided into different addresses according to preset rules, and the different addresses comprise: the first address and the other addresses; the calling module is used for calling a second address of a target program in the other programs under the condition that the starting program passes the verification, wherein the target program is any program in the other programs; the determining module is used for determining whether the second address is consistent with a third address corresponding to the target program indicated by the preset rule; and the second setting module is used for setting the target program as an executable program under the condition of consistency.
According to still another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the above-described program setting method when run.
According to still another aspect of the embodiments of the present application, there is further provided an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the program setting method by the computer program.
By this application, since the client includes a plurality of programs, the plurality of programs includes: starting programs and other programs, wherein the programs are divided into different addresses according to preset rules, the starting program at a first address in the different addresses is set as an executable program, and the other programs at other addresses in the different addresses are set as non-executable programs; and under the condition that the starting program passes the verification, calling a second address of the target program in other programs, further confirming whether a third address corresponding to the target program indicated by the preset rule is consistent with the second address, and under the condition that the second address is consistent with the third address, setting the target program as an executable program. That is, by executing the division of the plurality of programs into different addresses according to the preset rule, the entire APP can be divided into the plurality of programs, and then the verification step (equivalent to the confirmation of whether the third address and the second address coincide or not in the present application) of the target program is executed. Since the whole APP is already divided into a plurality of programs, only the target program in other programs is checked in each checking process. Therefore, the operation of other programs is not affected when the target program is checked. The problem that in the related art, in the process of carrying out partial verification on the whole APP, single or continuous areas of the whole APP are easily modified and not found is solved, and then the technical effect that the APP can normally operate by carrying out time-sharing block verification on the APP can be achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
fig. 1 is a hardware configuration block diagram of a computer apparatus of a program setting method of an embodiment of the present application;
FIG. 2 is a flow chart of a program setting method according to an embodiment of the present application;
FIG. 3 is a flow chart of a method of APP secure launch according to an embodiment of the present application;
fig. 4 is a block diagram of the configuration of the program setting apparatus according to the embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms and "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The method embodiments provided in the embodiments of the present application may be performed in a computer device or similar computing device. Taking a computer device as an example, fig. 1 is a block diagram of the hardware configuration of the computer device of the program setting method of the embodiment of the present application. As shown in fig. 1, the computer apparatus may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor (Microprocessor Unit, abbreviated MPU) or a programmable logic device (Programmable logic device, abbreviated PLD)) and a memory 104 for storing data, and in an exemplary embodiment, the computer apparatus may further include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those of ordinary skill in the art that the configuration shown in FIG. 1 is merely illustrative and is not intended to limit the configuration of the computer device described above. For example, a computer device may also include more or fewer components than shown in FIG. 1, or have a different configuration than the equivalent functions shown in FIG. 1 or more than the functions shown in FIG. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a program setting method in the embodiment of the present application, and the processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, which corresponds to implementing the method described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory located remotely from processor 102, which may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission means 106 is arranged to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communications provider of the computer device. In one example, the transmission device 106 includes a network adapter (Network Interface Control ler, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
In this embodiment, a program setting method is provided, which is applied to the above-mentioned computer device, and fig. 2 is a flowchart of the program setting method according to an embodiment of the present application, where the flowchart includes the following steps:
step S202, setting the start-up program at the first address as an executable program and setting other programs at other addresses as non-executable programs, wherein the client includes a plurality of programs including: the starting program and the other programs are divided into different addresses according to preset rules, and the different addresses comprise: the first address and the other addresses;
step S204, when the starting program passes the verification, calling a second address of a target program in the other programs, where the target program is any program in the other programs;
step S206, determining whether the second address is consistent with a third address corresponding to the target program indicated by the preset rule;
step S208, setting the target program as an executable program in the case of coincidence.
The second address of the target program is the actual address of the target program in the client, the third address of the target program is the address of the target program divided according to a preset rule, and the target program is checked by comparing whether the second address of the target program is consistent with the third address.
Through the steps, the client includes a plurality of programs, and the plurality of programs includes: starting programs and other programs, wherein the programs are divided into different addresses according to preset rules, the starting program at a first address in the different addresses is set as an executable program, and the other programs at other addresses in the different addresses are set as non-executable programs; and under the condition that the starting program passes the verification, calling a second address of the target program in other programs, further confirming whether a third address corresponding to the target program indicated by the preset rule is consistent with the second address, and under the condition that the second address is consistent with the third address, setting the target program as an executable program. That is, by performing dividing the plurality of programs into different addresses according to a preset rule, the entire APP can be divided into the plurality of programs, and further the verification step of the target program can be performed. Since the whole APP is already divided into a plurality of programs, only the target program in other programs is checked in each checking process. Therefore, the operation of other programs is not affected when the target program is checked. The problem that in the related art, in the process of carrying out partial verification on the whole APP, single or continuous areas of the whole APP are easily modified and not found can be solved, and then the technical effect that the APP can normally operate due to time-sharing and block-division verification on the APP can be achieved.
Optionally, before setting the start-up program at the first address as an executable program and setting the other programs at the other addresses as non-executable programs, the method further includes: acquiring program functions of all programs in the plurality of programs; determining each address length required by each program in the plurality of programs according to the program function; dividing the programs into different addresses according to the address length.
Before setting the start-up program as an executable program and the other programs as non-executable programs, it is also necessary to divide addresses of the start-up program and the other programs so that each of the programs can execute the subsequent operations in blocks. Specific: the address length required by each program is determined according to the program function of each program in the programs, and after the address length required by each program is determined, the programs can be divided into different addresses according to the address length required by each program.
For example: in an embedded microcontroller, there are 3 programs. It is necessary to determine the address lengths respectively required by the 3 programs. The address length required by program 1 is the first address length, the address length required by program 2 is the second address length, and the address length required by program 3 is the third address length. On this basis, program 1 may be divided into addresses containing a first address length, program 2 into addresses containing a second address length, and program 3 into addresses containing a third address length according to the address lengths of the 3 programs.
That is, the above-described technical solution completes the operation of designating different programs to be placed at different addresses and dividing a continuous large program into individual small programs.
It will be appreciated that not all programs are set to be non-executable programs, and that a start-up program (i.e., a start up module, which is a module that may be used to manage and perform a program start-up process, i.e., a process in which an operating system or application transitions from a shutdown state to an executable state) need not be set to be executable programs. For example, in an embedded microcontroller, after a plurality of programs are divided into different addresses, a boot program is set as an executable program, and programs other than the boot program are divided into non-executable programs. Such operation may enable the embedded microcontroller to transition from a shutdown state to an executable state, thereby facilitating subsequent verification of each program.
Alternatively, the step S204 may be implemented in a variety of manners, and the following is one implementation method of the step S204:
executing the target program; triggering a fault interrupt response if the target program is determined to be a non-executable program, wherein the fault interrupt response is used for indicating the second address of the target program; and calling the second address from the fault interrupt response.
It will be appreciated that the fault interrupt response may be a bus fault (busfault) response that may detect the address source of the second address of the target program in the other program.
In the embodiment of the present application, since other programs than the startup program have been set as non-executable programs. Therefore, when executing other programs and calling the second address of the target program in other programs, it can be determined whether the second address meets the set program segment (i.e. the third address) by triggering the busfault t to detect the address source of the second address of the target program.
Before executing step S204, the following technical solutions are further required to be executed: determining the priority of the other programs; determining the verification sequence of any program according to the priorities corresponding to the other programs respectively; determining the target program according to the verification sequence; the calling the second address of the target program in the other programs comprises the following steps: checking the target program; and calling the second address of the target program under the condition that verification is passed.
According to the technical scheme, the priority of other programs can be determined, the checking sequence is determined according to the priority, whether the checking of the target program in the other programs is passed or not is further determined, and the second address of the target program is called under the condition that the checking is passed.
Illustrating: assuming that there are 5 other programs in an embedded microcontroller, the five programs may be prioritized as program 3> program 1> program 5> program 2> program 4. The order of the checks may be determined according to priority as: 1) Checking a program 3; 2) Checking a program 1; 3) A verification program 5; 4) Checking a program 2; 5) And checking the program 4. Further, if the program 3 passes the verification, the second address of the program 3 may be called, and whether the second address of the program 3 is consistent with the third address is determined, so as to determine whether to change the program 3 into an executable program; after determining to change program 3 to an executable program, it may be determined whether program 1 passes the check, and in the case that program 1 passes the check, the second address of program 1 may be invoked, and further it may be determined whether the second address of program 1 coincides with the third address, to determine whether to change program 1 to an executable program, and so on, until all programs in the embedded microcontroller are completed to determine whether the program can be executed.
After determining the priority of any program, the checking sequence of any program can be determined according to the priority, namely, the program with high priority is checked in priority.
Optionally, after determining whether the second address is consistent with the third address corresponding to the target program indicated by the preset rule, the method further includes: feeding back a fault reason of the target program under the condition that the second address is inconsistent with the third address; determining whether the fault reasons belong to target fault reasons corresponding to the fault permitted to be repaired; and repairing the fault corresponding to the fault cause existing in the target program under the condition that the fault cause belongs to the target fault cause.
In the embodiment of the present application, when the second address is inconsistent with the third address, that is, the program fails, the failure cause of the failed program needs to be fed back, and whether the failed program is a repairable failure is determined by the fed back failure cause. In case the cause of the fault through the feedback is determined to be a fault that can be repaired, the fault is repaired.
There are many ways to determine the failure cause of the program failure, including but not limited to: 1) Determining the fault reason of the fault of the program by reading the log file of the target program; 2) And calling the source code of the target program and screening the source code to determine whether the program fails due to code errors or not.
Among the faults that allow repair include, but are not limited to: 1) Data input errors; 2) Code errors, etc.
In the case that the log file of the target program is read to determine the fault cause of the fault of the program, and the read log file indicates that the fault cause is a data input error, the error data can be called, and the modification operation can be performed on the error data.
Optionally, after the target program is set as the executable program, the method further includes: determining a first program in the other programs, wherein the first program is changed from a non-executable program to an executable program; determining whether the client has a starting right to the first program; and when the client side has the starting authority of the first program, starting the first program according to the starting authority.
As can be seen from the above-described scheme, after the target program is set as the executable program, the operation of the start-up program can also be performed. Specific: the first program of the other programs, which is changed from the non-executable program to the executable program, can be determined, and the first program is started according to the information fed back by the client when the client is determined to have the starting authority for starting the first program.
Optionally, after determining whether the client has the starting authority for the first program, the method further includes: determining a second program in the other programs when the client does not have the starting authority to the first program, wherein the second program is changed from a non-executable program to an executable program in the other programs; determining whether the client has a starting right to the second program; and when the client side has the starting authority of the second program, starting the second program according to the starting authority.
It will be appreciated that the timing of determining the second of the other programs should be: after determining that the client does not have the starting authority of the first program, the second program in the other programs can be changed from the non-executable program to the executable program. That is, assuming that the first program is changed from the non-executable program to the executable program at the first time, it is determined that the client does not have the starting right of the first program at the second time later than the first time, it is necessary to determine that the second program of the other program is changed from the non-executable program to the executable program at the third time later than the second time, and there is no program which is changed from the non-executable program to the executable program between the first time and the third time.
That is, it is determined whether the first program is set as the executable program and then whether the second program is set as the executable program is determined.
Illustrating: in an embedded microcontroller, there are 10 programs to be set as executable programs. In this case, it is determined whether or not the first program (i.e., the first program of the embodiment of the present application) can be set as an executable program, and when it is determined that the second address of the first program coincides with the third address corresponding to the program indicated by the preset rule, the program is set as an executable program. Then, under the condition that the starting authority of the first program is not provided, whether the second program (namely the second program in the embodiment of the application) can be set as an executable program or not is determined, further, under the condition that the second program is set as the executable program, whether the client terminal is provided with the starting authority of the second program or not is determined, under the condition that the client terminal is provided with the corresponding starting authority of the second program, the second program is started, and so on.
That is, in the embodiment of the present application, it is not necessary to start all programs after all programs pass the verification and change to the executable program, but only one program may be started after one program passes the verification and change to the executable program. Through the technical scheme, when all programs are verified, after verification failure exists in part of programs, the operation of the whole system function can be not influenced, so that the next program is started, and the problem that the whole program cannot be operated due to errors of a single program is avoided.
In order to better understand the procedure of the program setting method, the implementation flow of the program setting method is described in the following with reference to the alternative embodiments, but is not limited to the technical solution of the embodiments of the present application.
For easy understanding, the embodiment of the application will be described by taking secure startup of an APP as an example, where the APP includes a plurality of programs, and the startup program is a start up module, and includes other programs besides the startup module, such as an image processing program, and the like. Fig. 3 is a flowchart of a method for APP secure launch according to an embodiment of the present application, as shown in fig. 3:
In an exemplary embodiment of the present application, the following preparation work may be performed first, in particular:
1) Different programs of the plurality of programs are placed at different addresses to divide the APP continuous large program into separate small programs.
2) A microprocessor unit (Microprocessor Unit, abbreviated MPU) is enabled and by default other programs than the startup module are set as non-executable programs, while the area address (corresponding to the third address) of each individual applet is stored for subsequent verification. The above operations are completed, and the following operations can be executed:
step S301, checking the validity of the startup module (i.e. the startup procedure of the above embodiment of the present application).
Specifically, the validity of the above-described startup module may be checked by a bootloader (boot loader).
In the case that the verification result of the validity verification of the startup module is that the startup module is valid, other programs other than the startup module may be executed to trigger busfaul t. In the case that the verification result of the validity verification of the startup module is that the startup module is invalid, a fault needs to be reported.
That is, in the case where the verification startup module is valid, step S302 is performed, and in the case where the verification startup module is invalid, step S306 is performed.
Step S302, triggering busfault.
When other programs except the startup module start to execute, the busfaul t (illegal address response refers to bus errors occurring when instructions are executed or data are accessed) is triggered;
since the MPU defaults to the executable program, when the other programs except the startup module start to execute, the busfaul t is triggered at this time, that is, the address (corresponding to the second address in the embodiment of the present application) of the program (hereinafter referred to as the third program) set to be executable in the address area of the busfault is called.
Step S303, checking whether the address is an effective address and checking busfault type.
That is, it is checked whether the address of the third program is a valid address or not and the busfault type is checked.
Specific: types of Busfault include, but are not limited to: 1) Indicating a device failure; 2) Indicating bus overload; 3) Indicating bus access rights issues, etc.
In the case where the type of busfault is other than the indicated bus access authority problem, step S306 is performed.
When the address of the third program is determined to be the effective address (hereinafter, the third program whose address is the effective address is simply referred to as the effective program), step S304 is executed, and when the address of the third program is determined to be the ineffective address, step S306 is executed.
It can be appreciated that, in the implementation scheme for verifying the address, the verification method includes, but is not limited to: parity check mode, checksum check mode, etc.
After the verification of the third program is completed, the verification result of the third program may be placed at the end of the program section of the valid program in the form of a verification value. The location where the check value is placed is not limited, and may be placed at the first section of the program section, or may be placed in the middle of the program section, etc.
Step S304, the procedure of checking the address determined in step S303 as the effective address.
I.e. data verification is performed on the addresses of the valid programs. Specific: checking whether the address of the effective program accords with the preset program section (corresponding to the preset rule in the embodiment of the application). Under the condition that the address of the effective program accords with a preset program section, performing data verification on the address of the effective program; and reporting a fault under the condition that the address of the effective program does not accord with the preset program section.
That is, in the case that the address of the effective program matches the program section set in advance, step S305 is executed; in the case that the address of the valid program does not conform to the program section set in advance, step S306 is performed.
In step S305, the program is set as an executable program.
That is, in the case where the address of the effective program matches the program section set in advance, the effective program that matches the program section set in advance is set as the executable program by the MPU.
Step S306, reporting the fault.
Through the technical scheme, when other programs except the enabling start up module are called, the interrupt caused by the busfaul t is triggered, and the addresses of the other programs corresponding to the address area triggering the busfaul t can be judged in the interrupt, so that whether the addresses of the other programs belong to the set program area is judged. According to the embodiment of the application, different programs can be placed on different addresses according to different functions of the APP program, busfault is triggered in sequence according to the sequence of calling the programs, the address source of the failed program is judged in error interrupt (namely fault interrupt response of the embodiment of the application), and the corresponding APP program which accords with the fault type and the effective address is checked.
According to the APP safe starting method, the whole APP is subjected to blocking processing to generate a plurality of programs, and blocking verification of the whole APP is achieved. Meanwhile, due to the timeliness and singleness of program execution, the time-sharing verification can be carried out on a plurality of programs in the APP. And then carry out the loading calling of APP after verifying the validity of APP, report the trouble of APP that the check-up was failed simultaneously to be convenient for carry out the early warning to the system, improve check-up efficiency. And then solves the problem that the verification of the APP program takes too long time to influence the power-on time.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method of the embodiments of the present application.
The present embodiment also provides a program setting device, which is used to implement the foregoing embodiments and preferred embodiments, and will not be described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the devices described in the following embodiments are preferably implemented in software, implementations in hardware, or a combination of software and hardware, are also possible and contemplated.
Fig. 4 is a block diagram of a program setting apparatus according to an embodiment of the present application, the apparatus including:
a first setting module 42, configured to set a startup program at a first address as an executable program and set other programs at other addresses as non-executable programs, where the client includes a plurality of programs including: the starting program and the other programs are divided into different addresses according to preset rules, and the different addresses comprise: the first address and the other addresses;
a calling module 44, configured to call, if the starting program passes the verification, a second address of a target program in the other programs, where the target program is any program in the other programs;
a determining module 46, configured to determine whether the second address is consistent with a third address corresponding to the target program indicated by the preset rule;
and a second setting module 48, configured to set the target program as an executable program in the case of coincidence.
By this application, since the client includes a plurality of programs, the plurality of programs includes: starting programs and other programs, wherein the programs are divided into different addresses according to preset rules, the starting program at a first address in the different addresses is set as an executable program, and the other programs at other addresses in the different addresses are set as non-executable programs; and under the condition that the starting program passes the verification, calling a second address of the target program in other programs, further confirming whether a third address corresponding to the target program indicated by the preset rule is consistent with the second address, and under the condition that the second address is consistent with the third address, setting the target program as an executable program. That is, by performing dividing the plurality of programs into different addresses according to a preset rule, the entire APP can be divided into the plurality of programs, and further the verification step of the target program can be performed. Since the whole APP is already divided into a plurality of programs, only the target program in other programs is checked in each checking process. Therefore, the operation of other programs is not affected when the target program is checked. The problem that in the related art, in the process of carrying out partial verification on the whole APP, single or continuous areas of the whole APP are easily modified and not found is solved, and then the technical effect that the APP can normally operate by carrying out time-sharing block verification on the APP can be achieved.
In an exemplary embodiment, the apparatus further comprises: the acquisition module is used for acquiring program functions of all programs in the plurality of programs; determining each address length required by each program in the plurality of programs according to the program function; dividing the programs into different addresses according to the address length.
In an exemplary embodiment, the calling module 44 is further configured to execute the target program; triggering a fault interrupt response if the target program is determined to be a non-executable program, wherein the fault interrupt response is used for indicating the second address of the target program; and calling the second address from the fault interrupt response.
In an exemplary embodiment, the calling module 44 is further configured to determine a priority of the other program; determining the verification sequence of any program according to the priorities corresponding to the other programs respectively; determining the target program according to the verification sequence; the calling the second address of the target program in the other programs comprises the following steps: checking the target program; and calling the second address of the target program under the condition that verification is passed.
In an exemplary embodiment, the apparatus further comprises: the first determining module is used for feeding back the fault reason of the target program under the condition that the second address is inconsistent with the third address; determining whether the fault reasons belong to target fault reasons corresponding to the fault permitted to be repaired; and repairing the fault corresponding to the fault cause existing in the target program under the condition that the fault cause belongs to the target fault cause.
In an exemplary embodiment, the apparatus further comprises: a second determining module, configured to determine a first program in the other programs, where the first program is a program that is changed from a non-executable program to an executable program by a first one of the other programs; determining whether the client has a starting right to the first program; and when the client side has the starting authority of the first program, starting the first program according to the starting authority.
In an exemplary embodiment, the apparatus further comprises: a third determining module, configured to determine, when the client does not have the starting right for the first program, a second program in the other programs, where the second program is a second program that is changed from a non-executable program to an executable program in the other programs; determining whether the client has a starting right to the second program; and when the client side has the starting authority of the second program, starting the second program according to the starting authority.
Alternatively, in the present embodiment, the above-described storage medium may be configured to store a computer program for performing the steps of:
s1, setting a starting program at a first address as an executable program and setting other programs at other addresses as non-executable programs, wherein a client comprises a plurality of programs, and the programs comprise: the starting program and the other programs are divided into different addresses according to preset rules, and the different addresses comprise: the first address and the other addresses;
s2, calling a second address of a target program in the other programs when the starting program passes verification, wherein the target program is any program in the other programs;
s3, determining whether the second address is consistent with a third address corresponding to the target program indicated by the preset rule;
and S4, setting the target program as an executable program under the condition of consistency.
In one exemplary embodiment, the computer readable storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
Embodiments of the present application also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, setting a starting program at a first address as an executable program and setting other programs at other addresses as non-executable programs, wherein a client comprises a plurality of programs, and the programs comprise: the starting program and the other programs are divided into different addresses according to preset rules, and the different addresses comprise: the first address and the other addresses;
s2, calling a second address of a target program in the other programs when the starting program passes verification, wherein the target program is any program in the other programs;
S3, determining whether the second address is consistent with a third address corresponding to the target program indicated by the preset rule;
and S4, setting the target program as an executable program under the condition of consistency.
In an exemplary embodiment, the electronic apparatus may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the same, but rather, various modifications and variations may be made by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application should be included in the protection scope of the present application.

Claims (10)

1. A program setting method, characterized by comprising:
setting a start program at a first address as an executable program and setting other programs at other addresses as non-executable programs, wherein the client comprises a plurality of programs including: the starting program and the other programs are divided into different addresses according to preset rules, and the different addresses comprise: the first address and the other addresses;
under the condition that the starting program passes the verification, calling a second address of a target program in the other programs, wherein the target program is any program in the other programs; determining whether the second address is consistent with a third address corresponding to the target program indicated by the preset rule;
in case of coincidence, the target program is set as an executable program.
2. The method of claim 1, wherein before setting the boot program at the first address as an executable program and setting the other programs at the other addresses as non-executable programs, the method further comprises:
acquiring program functions of all programs in the plurality of programs;
determining each address length required by each program in the plurality of programs according to the program function;
dividing the programs into different addresses according to the address length.
3. The method of claim 1, wherein invoking the second address of the target program of the other programs comprises:
executing the target program;
triggering a fault interrupt response if the target program is determined to be a non-executable program, wherein the fault interrupt response is used for indicating the second address of the target program;
and calling the second address from the fault interrupt response.
4. The method of claim 1, wherein prior to invoking the second address of the target program in the other program, the method further comprises:
determining the priority of the other programs;
Determining the verification sequence of any program according to the priorities corresponding to the other programs respectively;
determining the target program according to the verification sequence;
the calling the second address of the target program in the other programs comprises the following steps: checking the target program;
and calling the second address of the target program under the condition that verification is passed.
5. The method of claim 1, wherein after determining whether the second address corresponds to a third address corresponding to the target program indicated by the preset rule, the method further comprises:
feeding back a fault reason of the target program under the condition that the second address is inconsistent with the third address;
determining whether the fault reasons belong to target fault reasons corresponding to the fault permitted to be repaired;
and repairing the fault corresponding to the fault cause existing in the target program under the condition that the fault cause belongs to the target fault cause.
6. The method of claim 1, wherein after setting the target program as an executable program, the method further comprises:
determining a first program in the other programs, wherein the first program is a program which is changed from a non-executable program to an executable program in the first of the other programs;
Determining whether the client has a starting right to the first program;
and when the client side has the starting authority of the first program, starting the first program according to the starting authority.
7. The method of claim 6, wherein after determining whether the client has boot permission for the first program, the method further comprises:
determining a second program in the other programs when the client does not have the starting authority to the first program, wherein the second program is a program which is changed from a non-executable program to an executable program in the other programs;
determining whether the client has a starting right to the second program;
and when the client side has the starting authority of the second program, starting the second program according to the starting authority.
8. A program setting apparatus, characterized by comprising:
a first setting module, configured to set a startup program at a first address as an executable program, and set other programs at other addresses as non-executable programs, where the client includes a plurality of programs including: the starting program and the other programs are divided into different addresses according to preset rules, and the different addresses comprise: the first address and the other addresses;
The calling module is used for calling a second address of a target program in the other programs under the condition that the starting program passes the verification, wherein the target program is any program in the other programs;
the determining module is used for determining whether the second address is consistent with a third address corresponding to the target program indicated by the preset rule;
and the second setting module is used for setting the target program as an executable program under the condition of consistency.
9. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program when run performs the method of any of the preceding claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 7 by means of the computer program.
CN202311643350.5A 2023-12-01 2023-12-01 Program setting method and device, storage medium and electronic device Pending CN117648698A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311643350.5A CN117648698A (en) 2023-12-01 2023-12-01 Program setting method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311643350.5A CN117648698A (en) 2023-12-01 2023-12-01 Program setting method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN117648698A true CN117648698A (en) 2024-03-05

Family

ID=90046067

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311643350.5A Pending CN117648698A (en) 2023-12-01 2023-12-01 Program setting method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN117648698A (en)

Similar Documents

Publication Publication Date Title
CN110083374B (en) Upgrade rollback method, system and terminal equipment
CN110209405B (en) Automatic upgrading method and device for distributed system
CN112906008B (en) Kernel vulnerability restoration method, device, server and system
CN114116305A (en) BIOS firmware recovery method, system, terminal and storage medium based on PFR
CN111522562A (en) Dish washer software burning method, device and equipment
CN114911500A (en) Terminal upgrading method, terminal and system
CN117130672A (en) Server start flow control method, system, terminal and storage medium
CN114793196B (en) Firmware upgrading method, device, equipment and storage medium
CN109002317B (en) PCBA firmware upgrading method and system and PCBA
CN111522571A (en) Equipment upgrading method and device, terminal equipment and storage medium
CN117648698A (en) Program setting method and device, storage medium and electronic device
CN116126379A (en) BIOS firmware upgrading method, device, equipment and storage medium
CN108595292B (en) System optimization method, mobile terminal and computer storage medium
CN113626792B (en) PCIe Switch firmware secure execution method, device, terminal and storage medium
CN106528248B (en) Downloading method and system of mobile terminal based on software integrity
CN113900934B (en) Multi-mirror hybrid refresh test method, system, terminal and storage medium
CN115827522A (en) BIOS setting method, BIOS chip and electronic equipment
CN111131198B (en) Updating method and device for network security policy configuration
CN114553764B (en) Automobile gateway route configuration system
CN115543399A (en) Software processing system, software processing method and device
CN112650538A (en) Starting method and device of network equipment
CN117608618B (en) Server firmware upgrading method and device, storage medium and electronic equipment
CN116340957B (en) Program starting method, device, server and nonvolatile storage medium
US11579995B2 (en) Electronic element, system comprising such an electronic element and method for monitoring and cutting off a processor on occurrence of a failure event
CN117494232B (en) Method, device, system, storage medium and electronic equipment for executing firmware

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