Program starting method and device, computer equipment, readable storage medium and program product

By loading the factory program image when the processor restarts and receiving update instructions to update the user application image, the stability problem of the processor when the user application is abnormal is solved, the stable start of the processor and the remote repair of the user application are realized, and the stability of the program running naked is improved.

CN120335823APending Publication Date: 2025-07-18BEIJING TASSON SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510315579.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In the prior art, when the processor runs abnormally after the user application image is loaded successfully, the processor cannot run normally, and the program has poor stability for running nakedly.

Method used

When the target device restarts, the factory program image is loaded and the factory program is run. The factory program receives update instructions for the management device, updates the user application image, obtains the updated target user application image and loads and runs.

Benefits of technology

Ensure that the processor can still start stably when the user application is abnormal, and repair the user application through remote updates to improve the stability of the user application running naked in the processor, and avoid factory repair or hardware re-burning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335823A_ABST
    Figure CN120335823A_ABST
Patent Text Reader

Abstract

The invention relates to a program starting method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: when a user application program in target equipment runs abnormally, restarting the target equipment; loading a factory program mirror image at the initial position of the target equipment, running a factory program corresponding to the factory program mirror image, and receiving an updating instruction sent by the management equipment through the factory program; the updating instruction carries updating data corresponding to the user application program mirror image; and updating the user application program mirror image according to the update data to obtain an updated target user application program mirror image, and loading and running a target user application program corresponding to the target user application program mirror image. By adopting the method, the naked running stability of the user application program in the processor can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of processors, and in particular, to a program startup method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Art

[0002] With the development of processors, the processor default provides a function support for software program loading to achieve the bare-metal running of software programs in the processor.

[0003] In the traditional technology, the FLASH (flash memory) of the target device includes a user application program image and a factory program (Golden) image. Among them, after the factory program image is burned after the user application program image, both are burned into the FALSH. When the processor is powered on and starts up, first, the processor loads the user application program image from the FLASH according to the BooTROM (boot read-only memory) into the processor to obtain the user application program. When the loading of the user application program image fails, the target device loads the factory program image into the processor and runs the factory program to ensure that at least one program image is successfully loaded to achieve the bare-metal running of the software program in the processor.

[0004] However, in the current traditional technology, only the stability of the program image loading stage can be guaranteed. If the loaded application program image has an abnormality during the running stage, the processor cannot run normally, resulting in poor stability of the bare-metal running of the program in the processor. Summary of the Invention

[0005] Based on this, it is necessary to provide a program startup method, apparatus, computer device, computer-readable storage medium, and computer program product for the above technical problems.

[0006] In a first aspect, the present application provides a program startup method, including:

[0007] When the user application program in the target device runs abnormally, restart the target device;

[0008] Load the factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive an update instruction sent by the management device through the factory program; the update instruction carries update data corresponding to the user application program image;

[0009] Update the user application program image according to the update data to obtain an updated target user application program image, and load and run the target user application program corresponding to the target user application program image.

[0010] In one embodiment, the target device includes a boot read-only memory, a flash memory, and a processor; loading the factory program image at the starting position of the target device and running the factory program corresponding to the factory program image includes:

[0011] In response to a restart of the target device, read the starting position of the flash memory according to the boot read-only memory to obtain a factory program image;

[0012] Load the factory program image into the processor to obtain the factory program corresponding to the factory program image, and run the factory program according to the processor.

[0013] In one embodiment, receiving the update instruction sent by the management device through the factory program includes:

[0014] Determine the state of the factory program within a preset duration as the waiting state, and receive the update instruction sent by the management device when the factory program is in the waiting state.

[0015] In one embodiment, updating the user application program image according to the update data to obtain an updated target user application program image includes:

[0016] Overwrite the user application program image according to the update data to obtain an updated target user application program image.

[0017] In one embodiment, loading and running the target user application program corresponding to the target user application program image includes:

[0018] Verify the target user application program image according to a preset verification policy to obtain a verification result;

[0019] If the verification result is successful, load the target user application program image from the flash memory to the processor according to the factory program;

[0020] Based on the processor and the factory program, start and run the target user application program corresponding to the target user application program image.

[0021] In one embodiment, before restarting the target device when the user application program image in the target device runs abnormally, the method further includes:

[0022] Obtain the factory program image and the user application program image;

[0023] Determine the starting position of the flash memory in the target device as the first burning position of the factory program image, and burn the factory program image to the first burning position;

[0024] Determine a preset address in the flash memory as the second burning position of the user application image, and burn the user application image to the second burning position; the preset address is any burning position after the first burning position.

[0025] In a second aspect, the present application also provides a program startup device, including:

[0026] A restart module, configured to restart the target device when the user application in the target device runs abnormally;

[0027] A loading module, configured to load a factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive an update instruction sent by a management device through the factory program; the update instruction carries update data corresponding to the user application image;

[0028] An update module, configured to update the user application image according to the update data to obtain an updated target user application image, and load and run the target user application corresponding to the target user application image.

[0029] In one embodiment, the target device includes a boot read-only memory, a flash memory, and a processor; the loading module is specifically configured to, in response to a restart of the target device, read the starting position of the flash memory according to the boot read-only memory to obtain a factory program image;

[0030] Load the factory program image to the processor to obtain the factory program corresponding to the factory program image, and run the factory program according to the processor.

[0031] In one embodiment, the loading module is specifically configured to determine the state of the factory program within a preset duration as a waiting state, and receive an update instruction sent by a management device when the factory program is in the waiting state.

[0032] In one embodiment, the update module is specifically configured to overwrite the user application image according to the update data to obtain an updated target user application image.

[0033] In one embodiment, the update module is specifically configured to verify the target user application image according to a preset verification policy to obtain a verification result;

[0034] If the verification result is successful verification, load the target user application image from the flash memory to the processor according to the factory program;

[0035] Based on the processor and the factory program, start and run the target user application corresponding to the target user application image.

[0036] In one embodiment, the device further includes:

[0037] An acquisition module, configured to acquire a factory program image and a user application image;

[0038] A first programming module, configured to determine the starting position of the flash memory in the target device as the first programming position of the factory program image, and program the factory program image to the first programming position;

[0039] A second programming module, configured to determine a preset address in the flash memory as the second programming position of the user application image, and program the user application image to the second programming position; the preset address is any programming position after the first programming position.

[0040] In a third aspect, the present application further provides a program startup system, where the system includes:

[0041] A target device, configured to restart the target device when the user application image in the target device runs abnormally; load a factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, receive an update instruction sent by a management device through the factory program; the update instruction carries update data corresponding to the user application image; update the user application image according to the update data to obtain an updated target user application image, and load and run the target user application corresponding to the target user application image;

[0042] The management device is configured to send the update instruction to the target device.

[0043] In a fourth aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0044] When the user application in the target device runs abnormally, restart the target device;

[0045] Load a factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, receive an update instruction sent by a management device through the factory program; the update instruction carries update data corresponding to the user application image;

[0046] Update the user application image according to the update data to obtain an updated target user application image, and load and run the target user application corresponding to the target user application image.

[0047] In a fifth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0048] When the user application in the target device runs abnormally, restart the target device;

[0049] Load the factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive an update instruction sent by the management device through the factory program; the update instruction carries update data corresponding to the user application image;

[0050] Update the user application image according to the update data to obtain an updated target user application image, and load and run the target user application corresponding to the target user application image.

[0051] In a sixth aspect, the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0052] When the user application in the target device runs abnormally, restart the target device;

[0053] Load the factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive an update instruction sent by the management device through the factory program; the update instruction carries update data corresponding to the user application image;

[0054] Update the user application image according to the update data to obtain an updated target user application image, and load and run the target user application corresponding to the target user application image.

[0055] The above program startup method, device, computer device, computer-readable storage medium, and computer program product. By adopting this method, the factory program image at the starting position will not modify its image data during the user's use. Therefore, the factory program image can stably start the processor in the form of the factory program. Furthermore, starting the target device through the factory program can ensure that the program in the target device can start stably in bare-metal running. At this time, by loading the user application program image through the factory program, even if the user application program runs abnormally, after the target device restarts, the factory program image is still loaded first and the factory program is started, thus ensuring the normal operation of the processor. At this time, by receiving an update instruction through the factory program and updating and repairing the user application program image according to the update instruction, the user application program can also run stably, thereby improving the stability of the user application program running in bare-metal on the processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] To more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.

[0057] Figure 1 It is an application environment diagram of the program startup method in an embodiment;

[0058] Figure 2 It is a schematic flowchart of the program startup method in an embodiment;

[0059] Figure 3 It is a storage structure diagram of the factory program image and the user application program image in an embodiment of the present application;

[0060] Figure 4 It is a storage structure diagram of the factory program image and the user application program image in the traditional technology in an embodiment;

[0061] Figure 5 It is a schematic flowchart of loading the factory program image and running the factory program in an embodiment;

[0062] Figure 6 It is a schematic flowchart of verifying the target user application program in an embodiment;

[0063] Figure 7 It is a schematic flowchart of burning the factory program image and the user application program image in an embodiment;

[0064] Figure 8Schematic flowchart of an example of a program startup method in an embodiment;

[0065] Figure 9 Block diagram of the structure of a program startup device in an embodiment;

[0066] Figure 10 Internal structure diagram of a computer device in an embodiment. Detailed implementation manners

[0067] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0068] The program startup method provided by the embodiments of the present application can be applied to an application environment as Figure 1 shown. Among them, the target device 102 communicates with the management device 104 through a network. When the user application program in the target device 102 runs abnormally, the target device 102 is restarted; a factory program image is loaded at the starting position of the target device 102 and the factory program corresponding to the factory program image is run, and the target device 102 receives an update instruction sent by the management device 104 through the factory program; the update instruction carries update data corresponding to the user application program image; the target device 102 updates the user application program image according to the update data to obtain an updated target user application program image, and loads and runs the target user application program corresponding to the target user application program image. Among them, the target device 102 may be an embedded device, for example, a smart home device, an industrial control device or other electronic devices, etc. The management device 104 may be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers or remote servers. The remote server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0069] In an exemplary embodiment, as Figure 2 shown, a program startup method is provided. Taking the method applied to the Figure 1 target device in it as an example, the method includes the following steps 202 to 206. Among them:

[0070] Step 202, when the user application program in the target device runs abnormally, restart the target device.

[0071] In the embodiments of the present application, in the target device, the user application runs "naked", that is, the user application runs directly on the hardware without an abstraction layer of an operating system or middleware. Specifically, when the user application starts, it is loaded by the factory program and directly controls the hardware resources, executes the tasks in the user application, processes interrupts, manages memory, etc., and directly interacts with the hardware of the target device to achieve efficient and real-time control.

[0072] After the target device starts up, the BootROM of the target device runs first to perform basic initialization on the target device. Then, the BootROM reads and loads the factory program image from the starting position of the flash memory (FLASH) of the target device, and then runs the factory program (Golden program) through the processor, and loads and runs the user application image through the factory program. Among them, the user application (user APP, user Application) is the application program actually running on the target device and is responsible for implementing the core functions of the target device. The factory program (Golden program) is a basic backup of the user application and can be the initial version of the user application pre-installed when the device leaves the factory.

[0073] After the target device completes the loading of the user application according to the factory program, when the user application runs in the target device, since there may be logical defects in the application code during the update, upgrade or burning of the user application, resulting in incorrect execution logic of the user application (for example, the user application falls into an infinite loop and other logical errors), then a running exception of the user application occurs. At this time, the user can restart the target device, and then the target device responds to the user's restart operation and restarts.

[0074] Step 204, load the factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive the update instruction sent by the management device through the factory program.

[0075] Among them, the update instruction carries the update data corresponding to the user application image.

[0076] In the embodiments of the present application, as Figure 3 shown, Figure 3 is the storage structure diagram of the factory program image and the user application image in the present application. Among them, the factory program (Golden program) image is stored in the front part of the flash memory (FLASH), that is, at the position of Start 0, and the user application image is stored at any storage position after the factory program image. Compared with the storage structure of the factory program image and the user application image in the traditional technology, as Figure 4As shown, in the traditional technology, the user application image is stored in the front part of the flash memory, and the factory program image is stored after the user application image. That is, in the traditional technology, after the processor is powered on, the user application image is loaded first.

[0077] Therefore, after the target device restarts, the target device loads the program image at the starting position according to the preset boot loader, and the loaded program image is the factory program image. The factory program image is a binary data block stored in the flash memory (FLASH) of the target device, in a static storage state, and is the physical representation of the factory program. When the factory program image is loaded, the factory program image is transformed into an executable program, that is, the factory program. Then, after the target device completes the loading of the factory program image, it runs the factory program corresponding to the factory program image.

[0078] During the running of the factory program, it indicates that the processor of the target device is in the running state and can interact with the management device. Since the user application in the target device runs abnormally, the user can send an update instruction to the target device through the management device to repair the abnormal state of the user application. Then, the target device receives the update data sent by the management device through the running state of the factory program. Optionally, in the normal version iteration of the user application, the update data carried by the update instruction can also be the update data for upgrading the user application.

[0079] Step 206: Update the user application image according to the update data to obtain the updated target user application image, and load and run the target user application corresponding to the target user application image.

[0080] In the embodiment of the present application, after receiving the update instruction through the factory program, the target device updates the user application image according to the update instruction, completes the repair of the abnormally running user application, and obtains the target user application image. Then, the target device loads the repaired target user application image, and further runs the target user application corresponding to the target user application image.

[0081] In the above program startup method, the factory program image at the starting position will not modify its image data during the user's use. Therefore, the factory program image can stably start the processor in the form of the factory program. Furthermore, starting the target device through the factory program can ensure that the program in the target device can start stably in bare-metal running. At this time, by loading the user application program image through the factory program, even if the user application program runs abnormally, after the target device restarts, the factory program image is still loaded first and the factory program is started, thereby ensuring the normal operation of the processor. At this time, by receiving the update instruction through the factory program and updating and repairing the user application program image according to the update instruction, the user application program can also run stably, thereby improving the stability of the user application program running in bare-metal on the processor.

[0082] In addition, in the case where the installation location or usage scenario of the target device is special, the management device can remotely update the user application program in the target device through the network to ensure the stability of the user application program running in bare-metal and avoid returning the target device to the factory for repair or re-burning the user application program image in the target device in a hardware connection manner.

[0083] In an exemplary embodiment, as Figure 5 shown, the target device includes a boot read-only memory, a flash memory, and a processor; step 204 includes steps 502 to 504. Among them:

[0084] Step 502, in response to the restart of the target device, read the starting position of the flash memory according to the boot read-only memory to obtain the factory program image.

[0085] In the embodiment of the present application, the boot read-only memory is the BootROM (Boot Read-Only Memory) of the target device and is a key part for the processor to start. When the target device restarts, the BootROM of the target device is responsible for initializing the hardware, including setting the clock, initializing the memory, etc. Then, the target device loads the program image according to the boot loader in the boot read-only memory. Specifically, due to the hardware platform development convention, after the target device starts, the boot loader in the boot read-only memory reads from the starting position of the flash memory (FLASH), and since the burning position of the factory program image is the starting position of the flash memory, the target device preferentially reads the factory program image through the boot read-only memory after starting.

[0086] Step 504, load the factory program image into the processor to obtain the factory program corresponding to the factory program image, and run the factory program according to the processor.

[0087] In the embodiment of the present application, the target device loads the factory program image into the memory of the processor, and this memory can be a random access memory (RAM). The factory program image is binary data stored in a non-volatile memory (such as a flash memory FLASH), and it is static by itself. To execute the factory program image, it needs to be loaded into a volatile memory (such as RAM) and executed by the processor. Therefore, when the factory program image is loaded into the processor, the factory program image is converted into a factory program that can be run by the processor, enabling the processor to execute the instructions included in the factory program one by one. The RAM provides an environment for fast reading and writing, which is suitable for the execution of instructions and the processing of data. At the same time, the processor allocates memory space, registers, and other resources for the factory program and establishes a running environment for the factory program. Furthermore, the target device runs the factory program according to the processor.

[0088] In this embodiment, when the target device restarts, the built-in boot read-only memory is used to initialize the hardware and preferentially read the factory program image from the starting position of the flash memory, and then the image is loaded into the memory of the processor and converted into an executable factory program, achieving efficient hardware initialization and program startup, ensuring that the target device can quickly enter a stable working state. Moreover, the attribute of the factory program image is read-only, so the factory program image can be started stably. Furthermore, it is ensured that the target device can run stably through the factory program image after restarting. When the user application program in the target device runs abnormally, the user application program image can be remotely processed, thereby improving the stability of the program running bare-metal in the target device.

[0089] In an exemplary embodiment, step 204 further includes step 2041. Wherein:

[0090] Step 2041, determine the state of the factory program within a preset duration as the waiting state. When the factory program is in the waiting state, receive the update instruction sent by the management device.

[0091] In the embodiment of the present application, when the factory program image in the target device is loaded into the processor and the factory program is run, the factory program in the target device is first in the waiting state. The waiting state of the factory program can last for a preset duration, and this preset duration can be set in advance. For example, the preset duration can be 3 seconds or 5 seconds, etc. When the factory program is in the waiting state, the factory program can communicate with the management device through the network port or serial port of the target device. The factory program continuously listens to the communication of the network port and serial port, waiting for the management device to send an update instruction. Furthermore, the target device can receive the update instruction sent by the management device. Among them, the management device can be a developer's computer or other management devices, and the update instruction is sent through dedicated management software.

[0092] When the user application in the target device runs abnormally, developers can update and fix the user application according to the abnormal situation of the user application running. The abnormal situation may include, but is not limited to, program crashes, performance issues, function failures, security vulnerabilities, etc. Developers write repair code according to the abnormal situation, generate a new user application image, and send the new user application image to the target device in the form of an update instruction through the management device.

[0093] In this embodiment, by setting the waiting state for a preset duration after the factory program is started, the reception of the update instruction remotely sent by the management device is realized, and then the restorative remote update of the user application is realized, improving the stability of the user application running naked in the target device. At the same time, the update function is set in the factory program, which can also reduce the resource occupancy and code maintenance cost of the user application.

[0094] In an exemplary embodiment, step 206 includes step 2061. Among them:

[0095] Step 2061, overwrite the user application image according to the update data to obtain the updated target user application image.

[0096] In the embodiment of the present application, the update data carried by the update instruction can be a complete user application image. At this time, the target device receives the complete target user application image, and overwrites the position of the original user application image on the flash memory with the complete target user application image in the update data to obtain the updated target user application image. At the same time, the target device also writes the program entry address and program image length of the target user application in the update data into the flash memory together.

[0097] In an alternative embodiment, the update data can also be an update package or patch file for upgrading the user application. The update data contains the code segments, data segments, or configuration files that need to be modified in the original user application, and is used to partially modify the user application. The target device receives the update package and only partially modifies the original user application image according to the update package.

[0098] In this embodiment, the user application image is updated with the update data received in the form of a network through the network port, realizing the restorative remote update of the user application and improving the stability of the user application running naked in the target device.

[0099] In an exemplary embodiment, as Figure 6 shown, step 206 includes steps 602 to 606. Among them:

[0100] Step 602: Verify the target user application image according to a preset verification policy to obtain a verification result.

[0101] In the embodiments of the present application, the preset verification policy is a verification method and rule for ensuring the integrity and authenticity of the target user application image. After the target device updates the user application image according to the update data and obtains the target user application image, it verifies the target user application image according to the preset verification policy to obtain a verification result. The preset verification policy may be a CRC (Cyclic Redundancy Check) verification policy to detect data errors in the updated target user application image caused by errors during data transmission, so as to obtain a verification result. Alternatively, the preset verification policy may also be a checksum verification, calculating the checksum value of the target user application image and comparing it with the pre-stored preset checksum value to further obtain a verification result.

[0102] If the verification passes, that is, the target user application image is complete and not tampered with, the verification result is "verification successful"; if the verification fails, indicating that the target user application image may have been tampered with or an error occurred during transmission, the verification result is "verification failed". At this time, the management device can resend the update instruction, and the target device re-executes the update instruction to repair and update the target user application image.

[0103] Step 604: If the verification result is verification successful, load the target user application image from the flash memory to the processor according to the factory program.

[0104] In the embodiments of the present application, when the verification result shows that the target user application image is not tampered with and intact, the factory program will continue the loading process of the target user application image. The factory program reads the target user application image from the flash memory according to parameters such as the program entry address and program image length of the target user application and loads it into the running memory of the processor.

[0105] Step 606: Based on the processor and the factory program, start and run the target user application corresponding to the target user application image.

[0106] In the embodiments of the present application, once the target user application image is successfully loaded into the memory, the target device starts the target user application based on the factory program, and sets the entry point of the target user application, initializes the stack, passes startup parameters, etc. through the processor. Furthermore, the processor starts to execute the code of the target user application and completes its functions according to the design of the program. Optionally, the factory program can continue to monitor the running state of the target user application so as to handle it when an exception occurs. For example, when the target user application has a running exception, an exception prompt is displayed or the target device is restarted, etc.

[0107] In this embodiment, the target user application image is verified by a preset verification policy before being loaded and run, thus ensuring the security and stability of the target device running the target user application naked. Through the preset verification policy, it is possible to effectively prevent the loading of the target user application image from being tampered with or loading a damaged image. Only the target user application image that passes the verification will be loaded into the processor and started to run, which can improve the stability of the target user application running naked in the target device.

[0108] In an exemplary embodiment, as Figure 7 shown, before step 202, the method further includes steps 702 to 706. Among them:

[0109] Step 702, obtain the factory program image and the user application image.

[0110] In the embodiments of the present application, the factory program image is the program image pre-installed when the target device leaves the factory. It usually contains the code and data required to start and initialize the target device. It can be the factory version of the user application image, and the attribute of the factory program image is read-only. That is, during the use of the target device, what is updated by the update instruction is the user application image, so that the factory program image can be stably loaded and the factory program can run stably.

[0111] Step 704, determine the starting position of the flash memory in the target device as the first burning position of the factory program image, and burn the factory program image to the first burning position.

[0112] In the embodiments of the present application, the starting position of the flash memory (FLASH) is usually the 0 address, and the target device will read data from the starting position when starting. Therefore, the target device takes the starting position of the flash memory as the first burning position of the factory program image and burns the factory program image to this first burning position as the first execution point for the target device to start, so that the target device can stably load the factory program image after each start.

[0113] Step 706: Determine a preset address in the flash memory as the second burning position of the user application image, and burn the user application image to the second burning position.

[0114] Wherein, the preset address is any burning position after the first burning position.

[0115] In the embodiment of the present application, the preset address is any position after the first burning position in the flash memory, and it is usually determined according to the sizes of the factory program image and the user application image. For example, if the factory program image occupies 1MB of flash memory space, the preset address can be any address after 1MB, such as 0x100000 (1MB). Optionally, if the user application image is too large, the user application image can be burned in another flash memory.

[0116] In a specific embodiment, during the burning stage, the target device obtains the factory program image file and the user application image file from the development environment or the file server. To ensure the integrity and correctness of the image files, the target device can use a verification tool to verify the factory program image file and the user application image. If the verification is successful, the target device specifies the factory program image file and the first burning position in the burning tool to ensure that the factory program image is successfully burned to the starting position of the flash memory. Then, specify the user application image file and the second burning position in the burning tool.

[0117] In this embodiment, by burning the factory program image to the starting position of the flash memory, the processor of the target device can run the factory program image after powering on and starting up, and its data will not be modified during the user's use, ensuring that the factory program can start stably and reliably. Through the stable operation of the factory program image, the abnormal situation of the user application program can be restored and remotely upgraded, thereby improving the stability of the user application program running naked in the processor.

[0118] In an exemplary embodiment, the present application further provides a program startup system, which includes:

[0119] A target device, configured to restart the target device when the user application image in the target device runs abnormally; load the factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive an update instruction sent by the management device through the factory program; the update instruction carries update data corresponding to the user application image; update the user application image according to the update data to obtain an updated target user application image, and load and run the target user application corresponding to the target user application image.

[0120] A management device, configured to send an update instruction to the target device.

[0121] In an exemplary embodiment, as Figure 8 shown, an example of a program startup method is provided, including:

[0122] Step 801, start the BootROM;

[0123] Step 802, read the starting position of the flash memory according to the BootROM, load the factory program image and start the factory program;

[0124] Step 803, the factory program enters the waiting state and lasts for 3 seconds;

[0125] Step 804, monitor whether an update instruction is received. If an update instruction is received, execute Step 805; if an update instruction is not received, execute Step 806;

[0126] Step 805, update the user application program image according to the factory program and the update instruction;

[0127] Step 806, read the entry address and image length of the user application program;

[0128] Step 807, read the user application program image from the FLASH according to the entry address and image length and load the user application program image into the memory;

[0129] Step 808, jump to run the user application program.

[0130] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same moment, but can be executed at different moments. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0131] Based on the same inventive concept, the embodiments of the present application also provide a program startup device for implementing the above-mentioned program startup method. The implementation solutions provided by this device to solve problems are similar to the implementation solutions described in the above method. Therefore, the specific limitations in one or more embodiments of the program startup device provided below can refer to the limitations on the program startup method in the above text, and will not be repeated here.

[0132] In an exemplary embodiment, asFigure 9 As shown, a program startup device 900 is provided, including: a restart module 901, a loading module 902, and an update module 903, where:

[0133] The restart module 901 is used to restart the target device when the user application in the target device runs abnormally;

[0134] The loading module 902 is used to load the factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive the update instruction sent by the management device through the factory program; the update instruction carries the update data corresponding to the user application image;

[0135] The update module 903 is used to update the user application image according to the update data to obtain the updated target user application image, and load and run the target user application corresponding to the target user application image.

[0136] In one embodiment, the target device includes a boot read-only memory, a flash memory, and a processor; the loading module 902 is specifically configured to, in response to the restart of the target device, read the starting position of the flash memory according to the boot read-only memory to obtain the factory program image;

[0137] Load the factory program image into the processor to obtain the factory program corresponding to the factory program image, and run the factory program according to the processor.

[0138] In one embodiment, the loading module 902 is specifically configured to determine the state of the factory program within a preset duration as the waiting state, and receive the update instruction sent by the management device when the factory program is in the waiting state.

[0139] In one embodiment, the update module 903 is specifically configured to overwrite the user application image according to the update data to obtain the updated target user application image.

[0140] In one embodiment, the update module 903 is specifically configured to verify the target user application image according to a preset verification policy to obtain a verification result;

[0141] If the verification result is successful, load the target user application image from the flash memory to the processor according to the factory program;

[0142] Based on the processor and the factory program, start and run the target user application corresponding to the target user application image.

[0143] In one embodiment, the device 900 further includes:

[0144] An acquisition module, used to acquire the factory program image and the user application image;

[0145] The first programming module is configured to determine the starting position of the flash memory in the target device as the first programming position of the factory program image, and program the factory program image to the first programming position;

[0146] The second programming module is configured to determine a preset address in the flash memory as the second programming position of the user application program image, and program the user application program image to the second programming position; the preset address is any programming position after the first programming position.

[0147] Each module in the above program startup device can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.

[0148] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 10 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the factory program image and the user application program image. The input / output interface of the computer device is used for the processor to exchange information with external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a program startup method.

[0149] Those skilled in the art can understand that Figure 10 the structure shown in

[0150] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the following steps are implemented:

[0151] When the user application in the target device runs abnormally, restart the target device;

[0152] Load the factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive the update instruction sent by the management device through the factory program; the update instruction carries the update data corresponding to the user application image;

[0153] Update the user application image according to the update data to obtain the updated target user application image, and load and run the target user application corresponding to the target user application image.

[0154] In one embodiment, the target device includes a boot read-only memory, a flash memory, and a processor; when the processor executes a computer program, the following steps are further implemented:

[0155] In response to the restart of the target device, read the starting position of the flash memory according to the boot read-only memory to obtain the factory program image;

[0156] Load the factory program image into the processor to obtain the factory program corresponding to the factory program image, and run the factory program according to the processor.

[0157] In one embodiment, when the processor executes a computer program, the following steps are further implemented:

[0158] Determine the state of the factory program within a preset time period as the waiting state, and receive the update instruction sent by the management device when the factory program is in the waiting state.

[0159] In one embodiment, when the processor executes a computer program, the following steps are further implemented:

[0160] Overwrite the user application image according to the update data to obtain the updated target user application image.

[0161] In one embodiment, when the processor executes a computer program, the following steps are further implemented:

[0162] Verify the target user application image according to a preset verification policy to obtain a verification result;

[0163] If the verification result is successful verification, load the target user application image from the flash memory to the processor according to the factory program;

[0164] Based on the processor and the factory program, start and run the target user application corresponding to the target user application image.

[0165] In one embodiment, when the processor executes a computer program, the following steps are further implemented:

[0166] Obtain the factory program image and the user application program image;

[0167] Determine the starting position of the flash memory in the target device as the first burning position of the factory program image, and burn the factory program image to the first burning position;

[0168] Determine a preset address in the flash memory as the second burning position of the user application program image, and burn the user application program image to the second burning position; the preset address is any burning position after the first burning position.

[0169] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0170] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0171] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0172] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.

[0173] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in the present application.

[0174] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims

1. A program startup method, characterized in that, The method includes: When the user application in the target device runs abnormally, restart the target device; Load the factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive the update instruction sent by the management device through the factory program; the update instruction carries the update data corresponding to the user application image; Update the user application image according to the update data to obtain an updated target user application image, and load and run the target user application corresponding to the target user application image.

2. The method according to claim 1, wherein The target device includes a boot read-only memory, a flash memory, and a processor; the loading the factory program image at the starting position of the target device and running the factory program corresponding to the factory program image includes: In response to the restart of the target device, read the starting position of the flash memory according to the boot read-only memory to obtain the factory program image; Load the factory program image into the processor to obtain the factory program corresponding to the factory program image, and run the factory program according to the processor.

3. The method according to claim 1, wherein The receiving the update instruction sent by the management device through the factory program includes: Determine the state of the factory program within a preset time period as the waiting state, and receive the update instruction sent by the management device when the factory program is in the waiting state.

4. The method according to claim 1, wherein The updating the user application image according to the update data to obtain an updated target user application image includes: Overwrite the user application image according to the update data to obtain an updated target user application image.

5. The method according to claim 1, characterized in that The loading and running the target user application corresponding to the target user application image includes: Verify the target user application image according to a preset verification policy to obtain a verification result; If the verification result is successful verification, load the target user application image from the flash memory to the processor according to the factory program; Based on the processor and the factory program, start and run the target user application corresponding to the target user application image.

6. The method according to claim 1, wherein Before the restarting the target device when the user application image in the target device runs abnormally, the method further includes: Obtain the factory program image and the user application image; Determine the starting position of the flash memory in the target device as the first burning position of the factory program image, and burn the factory program image to the first burning position; Determine a preset address in the flash memory as the second burning position of the user application image, and burn the user application image to the second burning position; the preset address is any burning position after the first burning position.

7. A program startup system, characterized in that, The system includes: A target device, which is used to restart the target device when the user application image in the target device runs abnormally; load a factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive an update instruction sent by a management device through the factory program; the update instruction carries update data corresponding to the user application image; update the user application image according to the update data to obtain an updated target user application image, and load and run the target user application corresponding to the target user application image; The management device is used to send the update instruction to the target device.

8. A program startup device, characterized in that, The device includes: A restart module, which is used to restart the target device when the user application in the target device runs abnormally; A loading module, which is used to load a factory program image at the starting position of the target device and run the factory program corresponding to the factory program image, and receive an update instruction sent by a management device through the factory program; the update instruction carries update data corresponding to the user application image; An update module, which is used to update the user application image according to the update data to obtain an updated target user application image, and load and run the target user application corresponding to the target user application image.

9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 6 are implemented.