[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN117785248A - Registration method and device of key variables in program upgrading, storage medium and chip - Google Patents

Registration method and device of key variables in program upgrading, storage medium and chip Download PDF

Info

Publication number
CN117785248A
CN117785248A CN202410218378.2A CN202410218378A CN117785248A CN 117785248 A CN117785248 A CN 117785248A CN 202410218378 A CN202410218378 A CN 202410218378A CN 117785248 A CN117785248 A CN 117785248A
Authority
CN
China
Prior art keywords
variable
key
information
registered
variable information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410218378.2A
Other languages
Chinese (zh)
Other versions
CN117785248B (en
Inventor
钟常军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Lichi Semiconductor Co ltd
Original Assignee
Shanghai Lichi Semiconductor 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 Lichi Semiconductor Co ltd filed Critical Shanghai Lichi Semiconductor Co ltd
Priority to CN202410218378.2A priority Critical patent/CN117785248B/en
Publication of CN117785248A publication Critical patent/CN117785248A/en
Application granted granted Critical
Publication of CN117785248B publication Critical patent/CN117785248B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The application discloses a registration method and device of key variables in program upgrading, a storage medium and a chip, and belongs to the technical field of chips. The method comprises the following steps: caching the acquired data stream of the program file to be upgraded in a first memory area, and transferring the cached data stream from the first memory area to a nonvolatile storage medium; after the transfer, running a chip external boot loader or a chip internal curing boot program to start the program; obtaining variable information of key variables to be registered in a program; acquiring variable information of the registered key variable from the second memory area; matching the variable information of the key variable with the registered variable information of the key variable; when the registered variable information of the key variable has target variable information matched with the variable information of the key variable, determining the registration result as the current registration result of the key variable. The method and the device can ensure that the variable information in the registered key variables is unchanged before and after program upgrading.

Description

Registration method and device of key variables in program upgrading, storage medium and chip
Technical Field
The present disclosure relates to the field of chip technologies, and in particular, to a method and an apparatus for registering key variables in program upgrade, a storage medium, and a chip.
Background
The key variable refers to a variable for storing the current state of a certain peripheral/peripheral during the whole program running process. For example: the key variables are used to describe the air conditioning on-off state (on, off), air conditioning mode state (cooling, heating), light state of the vehicle (on, off), etc.
In the related art, registering a key variable refers to declaring the key variable in a program, allocating an address to the key variable by a compiler, and storing corresponding data. However, regardless of the data of the key variable before the program upgrade, the value of the key variable becomes a default value after the program upgrade. For example: the vehicle lamp is in an on state before program upgrading and is in an off state after program upgrading.
The data of key variables are changed after the program is upgraded, so that unfriendly experience can be brought to users, and even the normal operation of the program and the chip can be influenced.
Disclosure of Invention
The application provides a registration method, a registration device, a storage medium and a registration chip for key variables in program upgrading, which are used for solving the problem that data of the key variables change after program upgrading in the related technology. The technical scheme is as follows:
according to a first aspect of the present application, there is provided a method for registering key variables in a program upgrade, the method comprising:
caching the acquired data stream of the program file to be upgraded in a first memory area, and transferring the cached data stream from the first memory area to a nonvolatile storage medium, wherein the first memory area and a second memory area are not overlapped, and the second memory area stores variable information of key variables;
after the program file is completely transferred to the nonvolatile storage medium, running an external boot loader or an internal curing boot loader of the chip to start the program, wherein a third memory area occupied when the external boot loader of the chip is run is not overlapped with the second memory area;
acquiring variable information of a key variable to be registered in the program, wherein the variable information at least comprises a peripheral identifier, a variable identifier and a memory size occupied by the key variable, and the peripheral identifier is used for identifying a peripheral controlled by the key variable;
acquiring variable information of the registered key variable from the second memory area;
matching the variable information of the key variable to be registered with the variable information of the registered key variable;
when the variable information of the registered key variable has target variable information matched with the variable information of the key variable to be registered, determining a registration result corresponding to the target variable information as a current registration result of the key variable to be registered.
In one possible implementation manner, the second memory area stores a structure body of registered key variables, the structure body includes an index area and a variable area, the index area includes a variable address, the variable area includes at least variable information and variable data, and each variable address in the index area corresponds to a set of variable information and variable data in the variable area.
In one possible implementation, the method further includes:
when target variable information matched with the variable information does not exist, allocating a variable information storage space in the variable area, and storing the variable information in the variable information storage space;
allocating a variable index storage space in the index region, and storing the address of the variable information storage space in the variable index storage space;
and determining the data value of the variable index storage space as a variable address, and determining the variable address as a current registration result of the key variable.
In one possible implementation, the method further includes:
when variable data is required to be written into registered key variables, variable addresses of the key variables are acquired;
obtaining the address of a variable information storage space from a variable index storage space corresponding to the variable address;
and storing the variable data in the variable information storage space.
In one possible implementation, when the variable information further includes check data, the method further includes:
calculating verification information of the variable data;
writing the verification information into the variable information in the variable information storage space, wherein the verification information is used for verifying whether the variable data is tampered or not.
In one possible implementation, the method further includes:
when variable data is required to be read from registered key variables, acquiring variable addresses of the key variables;
obtaining the address of a variable information storage space from a variable index storage space corresponding to the variable address;
and reading the variable data from the variable information storage space.
In one possible implementation, the method further includes:
and after power-on reset, clearing all the key variables registered in the second memory area.
According to a second aspect of the present application, there is provided a registration apparatus for key variables in a program upgrade, the apparatus comprising:
the file acquisition module is used for caching the acquired data stream of the program file to be upgraded in a first memory area, and transferring the cached data stream from the first memory area to a nonvolatile storage medium, wherein the first memory area and a second memory area are not overlapped with each other, and variable information of key variables is stored in the second memory area;
the program starting module is used for running an external boot loader or an internal curing boot loader of the chip to start the program after the program file is completely transferred to the nonvolatile storage medium, wherein a third memory area occupied when the external boot loader of the chip is run is not overlapped with the second memory area;
the information acquisition module is used for acquiring variable information of a key variable to be registered in the program, wherein the variable information at least comprises a peripheral identifier, a variable identifier and the memory size occupied by the key variable, and the peripheral identifier is used for identifying a peripheral controlled by the key variable;
the variable acquisition module is used for acquiring variable information of the registered key variable from the second memory area;
the information matching module is used for matching the variable information of the key variable to be registered with the variable information of the registered key variable;
and the variable registration module is used for determining a registration result corresponding to the target variable information as a current registration result of the key variable to be registered when the target variable information matched with the variable information of the key variable to be registered exists in the variable information of the registered key variable.
According to a third aspect of the present application, there is provided a computer readable storage medium having stored therein at least one instruction that is loaded and executed by a processor to implement a method of registering a key variable in a program upgrade as described above.
According to a fourth aspect of the present application, a chip is provided, the chip comprising registration means for key variables in a program upgrade.
The beneficial effects of the technical scheme that this application provided include at least:
and storing the variable information of the key variable in the second memory area, and then comparing the key variable with the registered key variable in the second memory area when the key variable is required to be registered after the program is upgraded, if the key variable matched with the key variable exists in the registered key variable, indicating that the key variable is registered before the program is upgraded without re-registration, thereby ensuring that the variable information in the registered key variable is unchanged before and after the program is upgraded, not influencing the user experience due to the change of the variable information, and ensuring the normal operation of the program and the chip.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an address layout of a key variable in the related art;
FIG. 2 is a schematic structural diagram of one key variable in the present application;
FIG. 3 is a flow chart of a method for registering key variables in a program upgrade provided by one embodiment of the present application;
FIG. 4 is a flow chart of a method for registering key variables in a program upgrade provided by one embodiment of the present application;
FIG. 5 is a block diagram of a registration device for key variables in program upgrades provided in one embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
In the related art, registering a key variable refers to declaring the key variable in a program, allocating an address to the key variable by a compiler, and storing corresponding data. If the program needs to be upgraded and the number of key variables in the new version program is changed (increased or decreased), the address dislocation of the key variables of the new version program and the key variables of the old version program can be caused, and the data of the key variables before and after the program is upgraded cannot be ensured to be unchanged.
For example, 5 key variables are registered in the old version program, and the compiled addresses of the compiled program are respectively a var1 address, a var2 address, a var3 address, a var4 address and a var5 address, as shown in (1) in fig. 1; assuming that a key variable is newly added after the program is upgraded, addresses of the 6 key variables after the compiling by the compiler are respectively var1 address, var2 address, var6 address, var3 address, var4 address and var5 address, as shown in (2) in fig. 1, the data of the key variable is necessarily changed, so that unfriendly experience is brought to a user, and even normal operation of the program and a chip is affected.
In order to solve the problems, a structure body is designed for the key variables, and the key variables are registered by the structure body, so that the variable information in the registered key variables is ensured to be unchanged before and after program upgrading. The structure of the key variables is described below.
As shown in fig. 2, the structure of the key variable includes an index area 200 and a variable area 300, a plurality of variable index storage spaces 210 are provided in the index area 200, each variable index storage space 210 is used for storing one variable address, a plurality of variable information storage spaces 310 are provided in the variable area 300, each variable information storage space 310 is used for storing one set of variable information 311 and variable data 312, and each variable address in the index area 200 corresponds to one set of variable information 311 and variable data 312 in the variable area 300. The variable information 311 at least includes a peripheral identifier, a variable identifier, and a memory size occupied by the key variable, where the peripheral identifier is used to identify a peripheral controlled by the key variable.
Shown in fig. 2 are 5 key variables var 1-var 5 registered, var1 addresses-var 5 addresses are stored in each of the variable index storage spaces 210 in the index area 200, and header information (variable information 311) and data (variable data 312) are stored in each of the variable information storage spaces 310 in the variable area 300. The character string in the header information represents a peripheral identifier, the identifier represents a variable identifier in the peripheral, the size represents the size of a memory occupied by a key variable, and the verification information represents verification information of variable data, wherein the verification information is optional information used for verifying whether the variable data is tampered or not.
It should be noted that, fig. 2 illustrates only the above 5 key variables, and in practical applications, more or fewer key variables may be registered.
In the application, the memory in the chip is divided into at least three memory areas, the memory area for storing the data stream of the program file to be upgraded is called a first memory area, the memory area for storing the variable information of the key variable is called a second memory area, and the memory area occupied by the external boot loader of the chip when running is called a third memory area. The first memory area and the second memory area are not overlapped with each other, and the third memory area and the second memory area are not overlapped with each other.
FIG. 3 is a flow chart of a method for registering key variables in a program upgrade, which may be applied to a chip, according to an embodiment of the present application. The registration method of key variables in program upgrading can comprise the following steps:
step 301, caching the obtained data stream of the program file to be upgraded in a first memory area, and transferring the cached data stream from the first memory area to a nonvolatile storage medium, wherein the first memory area and a second memory area are not overlapped, and variable information of key variables is stored in the second memory area.
The chip may obtain a data stream of the program file to be upgraded from a network, an SD (Secure Digital Memory Card, secure digital card) card, a serial port, a usb disk, etc., and cache the data stream in a first memory area allocated in advance. The chip then transfers the data stream of the program file from the first storage area to the non-volatile storage medium and replaces the original program file. The nonvolatile storage medium may be a ROM (Read-Only Memory), an EPROM (Erasable Programmable Read Only Memory, erasable programmable Read-Only Memory), an EEPROM (Electrically Erasable Programmable Read Only Memory, charged erasable programmable Read-Only Memory), a Flash Memory, or the like.
The program file has two transfer modes, the first transfer mode is to buffer all the data streams of the program file in the first memory area, and then transfer the data streams buffered in the first memory area to the nonvolatile storage medium. The second transfer mode is to intercept the data segment with preset size in the data stream of the program file, buffer the data segment in the first memory area, transfer the data segment buffered in the first memory area to the nonvolatile storage medium, continue to intercept the data segment with preset size from the data stream, replace the data segment buffered in the first memory area, transfer the data segment buffered in the first memory area to the nonvolatile storage medium, and so on until the data stream of the whole program file is completely transferred to the nonvolatile storage medium and then stop.
In step 302, after the program file is completely transferred to the nonvolatile storage medium, the external boot loader or the internal curing boot loader of the chip is run to start the program, where the third memory area and the second memory area occupied when the external boot loader of the chip is run do not overlap each other.
After the boot, a Bootloader (Bootloader) outside the chip can be run to start the program, and the Bootloader outside the chip can actively perform system reset/restart or actively jump to the program running. The third memory area occupied by the external boot loader of the chip is not overlapped with the second memory area, so that the key variables stored in the second memory area are prevented from being covered. Alternatively, after the transfer, a cured boot program (romicode) inside the chip may be run to start the program.
Step 303, after the program file is completely transferred to the nonvolatile storage medium, obtaining the variable information of the key variable to be registered in the program, where the variable information at least includes a peripheral identifier, a variable identifier, and a memory size occupied by the key variable, and the peripheral identifier is used to identify a peripheral controlled by the key variable.
In the present application, the key variables registered before the program upgrade may be reserved in the second memory space, however, the chip does not determine which key variables have been registered before the program upgrade, so all key variables to be registered in the program may be used as key variables to be registered. And variable information of the key variables is acquired.
Step 304, variable information of the registered key variable is obtained from the second memory area.
Step 305, matching the variable information of the key variable to be registered with the variable information of the registered key variable.
The chip may acquire variable information of the registered key variable based on the variable address in the index area, match the variable information of the key variable to be registered with the variable information of the registered key variable, and execute step 306 if there is target variable information matched with the variable information of the key variable to be registered in the variable information of the registered key variable; if the registered key variable information does not have the target variable information matched with the key variable information to be registered, the key variable information to be registered needs to be registered, and the registration flow is described in the following embodiment.
And 306, determining a registration result corresponding to the target variable information as a current registration result of the key variable to be registered when the target variable information matched with the variable information of the key variable to be registered exists in the variable information of the registered key variable.
For convenience of distinction, in this embodiment, the matched key variable is referred to as a target key variable, and variable information of the target key variable is referred to as target variable information.
When the registration result corresponding to the target variable information is the variable address of the target key variable, the chip determines the variable address as the current registration result of the key variable to be registered.
In summary, according to the method for registering a key variable in program upgrade provided in the embodiment of the present application, variable information of the key variable is stored in the second memory area, then when the key variable needs to be registered after program upgrade, the key variable is compared with the registered key variable in the second memory area, if there is a key variable matched with the key variable in the registered key variable, it is described that the key variable is registered before program upgrade, and re-registration is not required, so that it can be ensured that the variable information in the registered key variable is unchanged before and after program upgrade, and user experience is not affected due to the change of the variable information, and normal operation of the program and the chip can also be ensured.
As shown in fig. 4, a flowchart of a method for registering a key variable in a program upgrade according to an embodiment of the present application is shown, where the method for registering a key variable in a program upgrade may be applied to a chip. The registration method of key variables in program upgrading can comprise the following steps:
step 401, caching the obtained data stream of the program file to be upgraded in a first memory area, and transferring the cached data stream from the first memory area to a nonvolatile storage medium, wherein the first memory area and a second memory area are not overlapped, and variable information of key variables is stored in the second memory area.
Step 402, after the program file is completely transferred to the nonvolatile storage medium, running the external boot loader or the internal curing boot loader to start the program, where the third memory area occupied by the external boot loader is not overlapped with the second memory area.
Step 403, obtaining variable information of a key variable to be registered in the program, where the variable information at least includes a peripheral identifier, a variable identifier, and a memory size occupied by the key variable, and the peripheral identifier is used to identify a peripheral controlled by the key variable.
Step 404, obtaining the variable information of the registered key variable from the second memory area.
The flow of steps 401-404 is the same as that of steps 301-304, and will not be described here again.
Step 405, matching the variable information of the key variable to be registered with the variable information of the registered key variable.
The chip may acquire variable information of the registered key variable based on the variable address in the index area, match the variable information of the key variable to be registered with the variable information of the registered key variable, and execute step 406 if there is target variable information matched with the variable information of the key variable to be registered in the variable information of the registered key variable; if there is no target variable information matching the variable information of the key variable to be registered in the variable information of the registered key variable, the variable information of the key variable to be registered needs to be registered, that is, step 407 is performed.
In step 406, when there is target variable information matching with the variable information of the key variable to be registered in the variable information of the key variable to be registered, determining the registration result corresponding to the target variable information as the current registration result of the key variable to be registered.
For convenience of distinction, in this embodiment, the matched key variable is referred to as a target key variable, and variable information of the target key variable is referred to as target variable information.
When the registration result corresponding to the target variable information is the variable address of the target key variable, the chip determines the variable address as the current registration result of the key variable to be registered.
Step 407, when there is no target variable information matched with the variable information, allocating a variable information storage space in the variable region, and storing the variable information in the variable information storage space; allocating a variable index storage space in the index area, and storing the address of the variable information storage space in the variable index storage space; and determining the data value of the variable index storage space as a variable address, and determining the variable address as a registration result of the key variable.
When there is no target variable information matching the variable information, the chip needs to register the key variable in the second memory area.
As shown in fig. 2, the chip allocates a variable information storage space 310 in the variable area 300, and if the chip only includes variable information and does not include variable data during registration, the variable information is stored in the variable information storage space 310, and the variable data reserved in the variable information storage space 310 is set to be null or a default value; if variable information and variable data are included at the time of registration, the variable information and variable data are stored in the variable information storage space 310. Then, the chip allocates one of the index storage spaces 210 in the index area 200, and stores the address of the variable information storage space 310 in the index storage space 210. Finally, the chip determines the data value of the variable index storage space 210 as the variable address, that is, the registration result of the key variable.
Typically, the chip allocates a variable information storage space 310 at the end of the last variable information registered, and adds the variable information of a key variable in the variable information storage space 310.
In summary, according to the method for registering a key variable in program upgrade provided in the embodiment of the present application, variable information of the key variable is stored in the second memory area, then when the key variable needs to be registered after program upgrade, the key variable is compared with the registered key variable in the second memory area, if there is a key variable matched with the key variable in the registered key variable, it is described that the key variable is registered before program upgrade, and re-registration is not required, so that it can be ensured that the variable information in the registered key variable is unchanged before and after program upgrade, and user experience is not affected due to the change of the variable information, and normal operation of the program and the chip can also be ensured.
After the key variable is registered, the chip needs to write or read the variable data of the key variable, and the read-write flow of the variable data is described below.
(1) Writing variable data
Specifically, when variable data is required to be written into registered key variables, variable addresses of the key variables are obtained; obtaining the address of a variable information storage space from a variable index storage space corresponding to the variable address; variable data is stored in a variable information storage space.
In short, the variable address is searched for the storage address of the variable data, and then the variable data is written into the variable information storage space corresponding to the storage address.
When the variable information further includes check data, check information of the variable data may also be calculated, and the check information is written into the variable information in the variable information storage space, the check information being used to check whether the variable data is tampered with.
(2) Reading variable data
Specifically, when variable data is required to be read from registered key variables, variable addresses of the key variables are obtained; obtaining the address of a variable information storage space from a variable index storage space corresponding to the variable address; variable data is read from the variable information storage space.
In short, the variable address is searched for the storage address of the variable data, and then the variable data is read from the variable information storage space corresponding to the storage address.
When the variable information further comprises check data, check information of the variable data can be calculated, the check information is compared with the check information in the variable information, if the two check information are the same, the variable data is determined to be not tampered, and the variable data is read; if the two pieces of verification information are different, it is determined that the variable data has been tampered, the variable data can be modified to a default value, the verification information of the default value is calculated, and new verification information is written into the variable information in the variable information storage space.
And after power-on reset, clearing all the key variables registered in the second memory area. Subsequently, the chip needs to register the key variables in the program again, and the registration process is described in detail above, which is not repeated here.
FIG. 5 is a block diagram showing a key variable registration device in program upgrade, which can be applied to a chip according to an embodiment of the present application. The registration device of key variables in the program upgrading can comprise:
the file obtaining module 510 is configured to cache the obtained data stream of the program file to be upgraded in a first memory area, and transfer the cached data stream from the first memory area to a nonvolatile storage medium, where the first memory area and the second memory area are not overlapped, and where variable information of a key variable is stored in the second memory area;
the program starting module 520 is configured to run an external boot loader or an internal curing boot loader of the chip to start the program after the program file is completely transferred to the nonvolatile storage medium, where a third memory area occupied when the external boot loader of the chip is run and the second memory area are not overlapped with each other;
the information obtaining module 530 is configured to obtain variable information of a key variable to be registered in the program, where the variable information includes at least a peripheral identifier, a variable identifier, and a memory size occupied by the key variable, and the peripheral identifier is used to identify a peripheral controlled by the key variable;
a variable obtaining module 540, configured to obtain variable information of the registered key variable from the second memory area;
an information matching module 550, configured to match variable information of the key variable to be registered with variable information of the registered key variable;
the variable registration module 560 is configured to determine, when there is target variable information matching with variable information of the key variable to be registered in the variable information of the key variable that is registered, a registration result corresponding to the target variable information as a current registration result of the key variable to be registered.
In an alternative embodiment, the second memory area stores a structure body of the registered key variable, the structure body includes an index area and a variable area, the index area includes a variable address, the variable area includes at least variable information and variable data, and each variable address in the index area corresponds to a set of variable information and variable data in the variable area.
In an alternative embodiment, variable registration module 560 is further configured to:
when target variable information matched with the variable information does not exist, distributing a variable information storage space in a variable area, and storing the variable information in the variable information storage space;
allocating a variable index storage space in the index area, and storing the address of the variable information storage space in the variable index storage space;
and determining the data value of the variable index storage space as a variable address, and determining the variable address as a registration result of the key variable.
In an alternative embodiment, variable registration module 560 is further configured to:
when variable data is required to be written into registered key variables, variable addresses of the key variables are obtained;
obtaining the address of a variable information storage space from a variable index storage space corresponding to the variable address;
variable data is stored in a variable information storage space.
In an alternative embodiment, when the variable information further includes verification data, the variable registration module 560 is further configured to:
calculating verification information of variable data;
and writing verification information into the variable information in the variable information storage space, wherein the verification information is used for verifying whether the variable data is tampered or not.
In an alternative embodiment, variable registration module 560 is further configured to:
when variable data is required to be read from registered key variables, acquiring variable addresses of the key variables;
obtaining the address of a variable information storage space from a variable index storage space corresponding to the variable address;
variable data is read from the variable information storage space.
In an alternative embodiment, variable registration module 560 is further configured to:
and after power-on reset, clearing all the key variables registered in the second memory area.
In summary, according to the key variable registration device in program upgrading provided by the embodiment of the application, the variable information of the key variable is stored in the second memory area, then when the key variable is required to be registered after the program is upgraded, the key variable is compared with the registered key variable in the second memory area, if the key variable matched with the key variable exists in the registered key variable, the key variable is registered before the program is upgraded, and re-registration is not required, so that the variable information in the registered key variable is unchanged before and after the program is upgraded, the user experience is not affected due to the change of the variable information, and the normal operation of the program and the chip can be ensured.
One embodiment of the present application provides a computer-readable storage medium having stored therein at least one instruction that is loaded and executed by a processor to implement a method of registering a key variable in a program upgrade as described above.
An embodiment of the present application provides a chip, where the chip includes a registration device for key variables in any program upgrade described above.
It should be noted that: the registration device for key variables in program upgrade provided in the above embodiment is only exemplified by the division of the above functional modules when the key variables in program upgrade are registered, and in practical application, the above functional allocation may be completed by different functional modules according to needs, that is, the internal structure of the registration device for key variables in program upgrade is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the device for registering the key variable in the program upgrade provided in the above embodiment belongs to the same concept as the embodiment of the method for registering the key variable in the program upgrade, and the detailed implementation process of the device is referred to as the method embodiment, which is not described herein.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The foregoing description is not intended to limit the embodiments of the present application, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the embodiments of the present application are intended to be included within the scope of the embodiments of the present application.

Claims (10)

1. A method for registering key variables in a program upgrade, the method comprising:
caching the acquired data stream of the program file to be upgraded in a first memory area, and transferring the cached data stream from the first memory area to a nonvolatile storage medium, wherein the first memory area and a second memory area are not overlapped, and the second memory area stores variable information of key variables;
after the program file is completely transferred to the nonvolatile storage medium, running an external boot loader or an internal curing boot loader of the chip to start the program, wherein a third memory area occupied when the external boot loader of the chip is run is not overlapped with the second memory area;
acquiring variable information of a key variable to be registered in the program, wherein the variable information at least comprises a peripheral identifier, a variable identifier and a memory size occupied by the key variable, and the peripheral identifier is used for identifying a peripheral controlled by the key variable;
acquiring variable information of the registered key variable from the second memory area;
matching the variable information of the key variable to be registered with the variable information of the registered key variable;
when the variable information of the registered key variable has target variable information matched with the variable information of the key variable to be registered, determining a registration result corresponding to the target variable information as a current registration result of the key variable to be registered.
2. The method according to claim 1, wherein the second memory area stores a structure of registered key variables, the structure includes an index area and a variable area, the index area includes a variable address, the variable area includes at least variable information and variable data, and each variable address in the index area corresponds to a set of variable information and variable data in the variable area.
3. The method of registering key variables in a program upgrade according to claim 2, wherein the method further comprises:
when target variable information matched with the variable information does not exist, allocating a variable information storage space in the variable area, and storing the variable information in the variable information storage space;
allocating a variable index storage space in the index region, and storing the address of the variable information storage space in the variable index storage space;
and determining the data value of the variable index storage space as a variable address, and determining the variable address as a current registration result of the key variable.
4. A method of registering a key variable in a program upgrade according to claim 3, the method further comprising:
when variable data is required to be written into registered key variables, variable addresses of the key variables are acquired;
obtaining the address of a variable information storage space from a variable index storage space corresponding to the variable address;
and storing the variable data in the variable information storage space.
5. The method of claim 4, wherein when the variable information further includes check data, the method further comprises:
calculating verification information of the variable data;
writing the verification information into the variable information in the variable information storage space, wherein the verification information is used for verifying whether the variable data is tampered or not.
6. A method of registering a key variable in a program upgrade according to claim 3, the method further comprising:
when variable data is required to be read from registered key variables, acquiring variable addresses of the key variables;
obtaining the address of a variable information storage space from a variable index storage space corresponding to the variable address;
and reading the variable data from the variable information storage space.
7. The method of registering key variables in a program upgrade according to any one of claims 1 to 6, further comprising:
and after power-on reset, clearing all the key variables registered in the second memory area.
8. A device for registering key variables in a program upgrade, the device comprising:
the file acquisition module is used for caching the acquired data stream of the program file to be upgraded in a first memory area, and transferring the cached data stream from the first memory area to a nonvolatile storage medium, wherein the first memory area and a second memory area are not overlapped with each other, and variable information of key variables is stored in the second memory area;
the program starting module is used for running an external boot loader or an internal curing boot loader of the chip to start the program after the program file is completely transferred to the nonvolatile storage medium, wherein a third memory area occupied when the external boot loader of the chip is run is not overlapped with the second memory area;
the information acquisition module is used for acquiring variable information of a key variable to be registered in the program, wherein the variable information at least comprises a peripheral identifier, a variable identifier and the memory size occupied by the key variable, and the peripheral identifier is used for identifying a peripheral controlled by the key variable;
the variable acquisition module is used for acquiring variable information of the registered key variable from the second memory area;
the information matching module is used for matching the variable information of the key variable to be registered with the variable information of the registered key variable;
and the variable registration module is used for determining a registration result corresponding to the target variable information as a current registration result of the key variable to be registered when the target variable information matched with the variable information of the key variable to be registered exists in the variable information of the registered key variable.
9. A computer readable storage medium having stored therein at least one instruction that is loaded and executed by a processor to implement a method of registering a key variable in a program upgrade according to any one of claims 1 to 7.
10. A chip, the chip comprising: the registration device for key variables in program upgrades of claim 8.
CN202410218378.2A 2024-02-28 2024-02-28 Registration method and device of key variables in program upgrading, storage medium and chip Active CN117785248B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410218378.2A CN117785248B (en) 2024-02-28 2024-02-28 Registration method and device of key variables in program upgrading, storage medium and chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410218378.2A CN117785248B (en) 2024-02-28 2024-02-28 Registration method and device of key variables in program upgrading, storage medium and chip

Publications (2)

Publication Number Publication Date
CN117785248A true CN117785248A (en) 2024-03-29
CN117785248B CN117785248B (en) 2024-05-24

Family

ID=90385770

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410218378.2A Active CN117785248B (en) 2024-02-28 2024-02-28 Registration method and device of key variables in program upgrading, storage medium and chip

Country Status (1)

Country Link
CN (1) CN117785248B (en)

Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6108598A (en) * 1996-04-23 2000-08-22 Mitsubishi Denki Kabusihiki Kaisha Onboard control system for controlling devices installed on motor vehicle and method or rewriting control program and variables therefor
US20070168951A1 (en) * 2003-12-08 2007-07-19 Giesecke & Devrient Gmbh Java smart card chip having memory area reserved for global variables
CN101315628A (en) * 2007-06-01 2008-12-03 华为技术有限公司 Internal memory database system and method and device for implementing internal memory data base
CN101441576A (en) * 2009-01-08 2009-05-27 杭州华三通信技术有限公司 Software restarting method and equipment of embedded type equipment
CN108108174A (en) * 2016-11-24 2018-06-01 青岛海信宽带多媒体技术有限公司 Optical module and its method of firmware upgrade
CN108845822A (en) * 2018-05-28 2018-11-20 烽火通信科技股份有限公司 Realize the EMS memory management process and system of the upgrading of software non-interrupting service
CN110659083A (en) * 2019-09-19 2020-01-07 苏州浪潮智能科技有限公司 Method and system for recovering memory data after program fault restart
CN111381879A (en) * 2018-12-31 2020-07-07 华为技术有限公司 Data processing method and device
CN112527365A (en) * 2020-11-03 2021-03-19 珠海格力电器股份有限公司 Application program updating method, nonvolatile memory, storage medium and household appliance
WO2021120327A1 (en) * 2019-12-19 2021-06-24 歌尔股份有限公司 Firmware updating method and apparatus, and headset and computer readable storage medium
CN113490112A (en) * 2021-07-02 2021-10-08 歌尔科技有限公司 Wireless earphone, data processing method of wireless earphone and storage medium
WO2021232699A1 (en) * 2020-05-20 2021-11-25 歌尔股份有限公司 Data reading method, apparatus and device, and readable storage medium
WO2022134717A1 (en) * 2020-12-24 2022-06-30 完美世界(北京)软件科技发展有限公司 Data-driven system function loading method, device, and storage medium
CN114860286A (en) * 2022-05-25 2022-08-05 苏州浪潮智能科技有限公司 CPLD (Complex programmable logic device) noninductive upgrading method, system, storage medium and equipment
US20230136606A1 (en) * 2021-11-03 2023-05-04 International Business Machines Corporation Sharing global variables between addressing mode programs
CN116795408A (en) * 2023-06-30 2023-09-22 三一汽车制造有限公司 ECU software upgrading method and system and vehicle
CN117453318A (en) * 2023-12-25 2024-01-26 上海励驰半导体有限公司 IOMMU-based DSP firmware using method, system chip and vehicle machine

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6108598A (en) * 1996-04-23 2000-08-22 Mitsubishi Denki Kabusihiki Kaisha Onboard control system for controlling devices installed on motor vehicle and method or rewriting control program and variables therefor
US20070168951A1 (en) * 2003-12-08 2007-07-19 Giesecke & Devrient Gmbh Java smart card chip having memory area reserved for global variables
CN101315628A (en) * 2007-06-01 2008-12-03 华为技术有限公司 Internal memory database system and method and device for implementing internal memory data base
CN101441576A (en) * 2009-01-08 2009-05-27 杭州华三通信技术有限公司 Software restarting method and equipment of embedded type equipment
CN108108174A (en) * 2016-11-24 2018-06-01 青岛海信宽带多媒体技术有限公司 Optical module and its method of firmware upgrade
CN108845822A (en) * 2018-05-28 2018-11-20 烽火通信科技股份有限公司 Realize the EMS memory management process and system of the upgrading of software non-interrupting service
CN111381879A (en) * 2018-12-31 2020-07-07 华为技术有限公司 Data processing method and device
CN110659083A (en) * 2019-09-19 2020-01-07 苏州浪潮智能科技有限公司 Method and system for recovering memory data after program fault restart
WO2021120327A1 (en) * 2019-12-19 2021-06-24 歌尔股份有限公司 Firmware updating method and apparatus, and headset and computer readable storage medium
WO2021232699A1 (en) * 2020-05-20 2021-11-25 歌尔股份有限公司 Data reading method, apparatus and device, and readable storage medium
CN112527365A (en) * 2020-11-03 2021-03-19 珠海格力电器股份有限公司 Application program updating method, nonvolatile memory, storage medium and household appliance
WO2022134717A1 (en) * 2020-12-24 2022-06-30 完美世界(北京)软件科技发展有限公司 Data-driven system function loading method, device, and storage medium
CN113490112A (en) * 2021-07-02 2021-10-08 歌尔科技有限公司 Wireless earphone, data processing method of wireless earphone and storage medium
US20230136606A1 (en) * 2021-11-03 2023-05-04 International Business Machines Corporation Sharing global variables between addressing mode programs
CN114860286A (en) * 2022-05-25 2022-08-05 苏州浪潮智能科技有限公司 CPLD (Complex programmable logic device) noninductive upgrading method, system, storage medium and equipment
CN116795408A (en) * 2023-06-30 2023-09-22 三一汽车制造有限公司 ECU software upgrading method and system and vehicle
CN117453318A (en) * 2023-12-25 2024-01-26 上海励驰半导体有限公司 IOMMU-based DSP firmware using method, system chip and vehicle machine

Also Published As

Publication number Publication date
CN117785248B (en) 2024-05-24

Similar Documents

Publication Publication Date Title
US8595716B2 (en) Failsafe firmware updates
US7363484B2 (en) Apparatus and method for selectively mapping proper boot image to processors of heterogeneous computer systems
US6425079B1 (en) Universal option ROM BIOS including multiple option BIOS images for multichip support and boot sequence for use therewith
CN113064604B (en) Firmware upgrading method and device
CN111796848A (en) Bootloader software updating method and device, embedded controller and storage medium
CN101313287A (en) Initialization of flash storage via an embedded controller
CN101650662A (en) Memory device of embedded system and staring method and upgrading of firmware
US8775758B2 (en) Memory device and method for performing a write-abort-safe firmware update
CN111562934B (en) Software system upgrading method based on hot patch, terminal and storage medium
JPH10124384A (en) Method for controlling non-volatile semiconductor memory
CN112527365A (en) Application program updating method, nonvolatile memory, storage medium and household appliance
CN113238790B (en) Firmware program updating method and system based on SD card and EEPROM
CN117785248B (en) Registration method and device of key variables in program upgrading, storage medium and chip
CN114860291A (en) Method for guiding and flexibly storing and upgrading application program
CN116954674A (en) eMMC firmware upgrading method, firmware upgrading equipment and storage device
CN115328504A (en) Improved design method for ZYNQ series chip boot start
CN113467797B (en) Program updating method, device and system and computer readable storage medium
CN114942779A (en) Patch implementation method and device, embedded system and storage medium
CN110471626B (en) Nor Flash management layer and method applied to Java Card
CN112650513A (en) Program upgrading method and device, computer equipment and storage medium
CN114567628B (en) OTA upgrading method and device
KR100640389B1 (en) Method for executing application in an apparatus having nand flash memory and the apparatus
CN116700833B (en) Method and device for downloading after application, system on chip, terminal and storage medium
US7490232B2 (en) Disk device using disk to rewrite firmware and firmware determination method
CN114168085B (en) Variable processing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant