Program jump method and electronic device

By introducing a jump flag in the bootloader and performing status value judgment and initialization, the issues of flexibility and security in the program jump process are resolved, and safe and efficient program jump is achieved.

CN118885225BActive Publication Date: 2025-11-11WUHAN JINGLI ELECTRONICS TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410900838.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2025-11-11
Estimated Expiration
2044-07-05

AI Technical Summary

Technical Problem

Existing technologies lack flexibility and security in program jump processes. Jumping directly from the bootloader to the application may lead to malicious programs being reloaded, affecting the effectiveness and security of program jumps.

Method used

A jump flag is added to the bootloader. The status value of the jump flag determines whether to jump to the application. Initialization and hardware identity matching are performed before jumping to ensure the legality and security of the program status.

Benefits of technology

It improves the flexibility and security of program redirection, prevents malicious programs from loading, ensures that applications run normally on legitimate devices, and reduces invalid redirection processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885225B_ABST
    Figure CN118885225B_ABST
Patent Text Reader

Abstract

This application discloses a program jump method and an electronic device. The method, applied to an electronic device, includes: after the bootloader starts, obtaining the status value of a jump flag bit, wherein the jump flag bit is used to indicate the program state of the electronic device, and the jump flag bit is obtained from a file corresponding to the bootloader; determining whether a jump to an application is possible based on the status value of the jump flag bit; if a jump to the application is possible, then jumping to the application and initializing the application to obtain an initialization result; the initialization result is used to determine whether the application can run normally. Thus, by adding a jump flag bit to the file corresponding to the bootloader, and based on the status value of the jump flag bit in the electronic device, a safe jump from the bootloader to the application is achieved. This facilitates program debugging and testing in the electronic device and improves the flexibility, effectiveness, and security of program jumps.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a program jump method and an electronic device. Background Technology

[0002] After the program is burned, it usually involves a process of switching from the boot loader to the application software (APP).

[0003] In related technologies, to ensure the efficiency of program jumps, it is generally possible to jump directly from the bootloader to the application. However, the above-mentioned direct jump method not only usually can only implement fixed jump logic and lacks flexibility, but may also fail to provide sufficient security checks, resulting in damaged or malicious apps being repeatedly loaded and executed, thus affecting the effectiveness and security of program jumps. Summary of the Invention

[0004] This application provides a program jump method and an electronic device. By adding a jump flag bit to the file corresponding to the bootloader, a safe jump from the bootloader to the application program is achieved based on the status value of the jump flag bit in the electronic device. This facilitates the debugging and testing of programs in the electronic device and improves the flexibility, effectiveness, and security of program jumps. The technical solution is as follows:

[0005] In a first aspect, embodiments of this application provide a program jump method, which is applied to an electronic device, and the method includes:

[0006] After the bootloader starts, it obtains the status value of the jump flag; the jump flag is used to indicate the program status of the electronic device; the jump flag is obtained from the file corresponding to the bootloader.

[0007] The status value of the jump flag is used to determine whether a jump to the application is possible.

[0008] If the user can be redirected to the aforementioned application, then the user will be redirected to the aforementioned application and the application will be initialized to obtain the initialization result. The initialization result is used to determine whether the aforementioned application can run normally.

[0009] In this embodiment, after the bootloader starts, it obtains the status value of the jump flag and determines whether it can jump to the application based on the status value of the jump flag. In the above scheme, since a jump flag indicating the program status of the electronic device is added, and the status value of the jump flag is used to determine whether it can jump to the application before program jump, the jump to the running application will only occur if it is determined that it can jump to the application. Compared with the related technology of directly jumping from the bootloader to the application, the method of determining whether it can jump to the application based on the status value of the jump flag before jumping to the application can efficiently and flexibly realize the safe jump from the bootloader to the application. This not only improves the flexibility and effectiveness of program jump, but also avoids the problem of problematic applications being repeatedly loaded and executed, thus affecting the security of program jump. In addition, the jump flag indicates the program status of the electronic device, which facilitates the debugging and testing of programs in the electronic device. At the same time, after the electronic device jumps from the bootloader to the application, it will also initialize the application and obtain the initialization result to determine whether the electronic device can run the application normally, thereby further ensuring the security and effectiveness of the application running in the electronic device.

[0010] In one possible implementation, determining whether to jump to the application based on the status value of the aforementioned jump flag includes:

[0011] If the state value of the aforementioned jump flag is a jumpable state value, it is determined that the aforementioned electronic device can jump to the application; the aforementioned jumpable state value is at least one state value of the aforementioned jump flag corresponding to the aforementioned electronic device being in a state where the aforementioned application has been burned in and the aforementioned application has not been initialized or is running normally.

[0012] In one possible implementation, if the state value of the jump flag belongs to the jumpable class state value and the state value of the jump flag is not the first state value, before initializing the application, the method further includes:

[0013] Update the status value of the aforementioned jump flag to the second status value; the second status value is used to indicate the status of application initialization failure in the aforementioned electronic device.

[0014] After initializing the application as described above and obtaining the initialization result, the method further includes:

[0015] If the initialization result is successful, the status value of the jump flag will be updated from the second status value to the first status value.

[0016] If the initialization result is that the initialization fails, the state value of the jump flag will be maintained as the second state value.

[0017] The first state value is used to indicate that the application in the electronic device has been successfully initialized and can run normally.

[0018] In one possible implementation, after determining whether a jump to the application is possible based on the status value of the aforementioned jump flag, the method further includes:

[0019] If the user can be redirected to the aforementioned application, the hardware identity information of the aforementioned electronic device will be matched with the valid hardware identity information corresponding to the aforementioned application to obtain a matching result.

[0020] Based on the above matching results and the above initialization results, determine whether the above electronic device can run the above application normally.

[0021] In this embodiment, the matching results of the application initialization and the electronic device hardware identity information are used to jointly determine whether the electronic device can run the application normally. This not only prevents malicious software or unauthorized applications from running on non-compliant devices, and prevents problems such as application running errors, performance degradation or crashes caused by hardware incompatibility, but also ensures that the application is in the correct state before running and is ready to perform its expected functions, thereby improving the effectiveness and security of application operation in electronic devices.

[0022] In one possible implementation, after determining whether a jump to the application is possible based on the status value of the aforementioned jump flag, the method further includes:

[0023] If you cannot jump to the above application, continue running the above bootloader, or output a program burning error message or hardware detection message.

[0024] In one possible implementation, determining whether to jump to the application based on the status value of the aforementioned jump flag includes:

[0025] If the state value of the aforementioned jump flag does not belong to the jumpable state value, it is determined that the aforementioned electronic device cannot jump to the application; the aforementioned jumpable state value is at least one state value of the aforementioned jump flag corresponding to the aforementioned electronic device being in a state where the aforementioned application has been burned in and the aforementioned application has not been initialized or is running normally.

[0026] If the above steps fail to redirect to the application, the bootloader will continue running, or an error message or hardware detection message will be output, including:

[0027] If the application cannot be redirected, the bootloader will continue running if the status value of the jump flag is not a jumpable status value and the status value of the jump flag is not the initial status value. Alternatively, if the status value of the jump flag is not a jumpable status value and the status value of the jump flag is the initial status value, a program burning error message or a hardware detection message will be output.

[0028] The aforementioned initial state value is used to indicate that the electronic device is in a state where no boot program or application has been burned.

[0029] In one possible implementation, after the bootstrap program starts but before obtaining the status value of the jump flag, the method further includes:

[0030] After the aforementioned electronic device is powered on, it is checked whether the electronic device and the storage device are in a connected state;

[0031] If connected, the program to be burned is read from the aforementioned storage device; the program to be burned includes the bootloader and / or application program to be burned.

[0032] If the electronic device contains a pre-programmed program of the same type as the program to be programmed, then the pre-programmed program is erased, and the program to be programmed from the storage device is written into the corresponding storage area of ​​the electronic device.

[0033] If there is no program of the same type as the program to be programmed in the aforementioned electronic device, then the program to be programmed in the aforementioned storage device will be written into the corresponding storage area of ​​the aforementioned electronic device.

[0034] In this embodiment, by placing the boot program and / or application to be burned into the storage area of ​​the electronic device in one step, the boot program and / or application to be burned into the corresponding storage area of ​​the electronic device can be burned in one step. This can reduce the program update and burning steps of the electronic device, improve the flexibility of program burning, reduce the operational difficulty of pilot and production of electronic devices, and eliminate the need for production personnel to install the corresponding burning software on their own computers, thereby reducing their computer memory pressure and saving program burning costs.

[0035] In one possible implementation, the program to be burned includes a bootloader to be burned;

[0036] After writing the program to be programmed from the storage device into the corresponding storage area of ​​the electronic device, the method further includes:

[0037] Based on the aforementioned electronic devices, obtain the application update command triggered by the user;

[0038] In response to the aforementioned application update instruction, the application to be updated is retrieved from the network or the local database of the aforementioned electronic device;

[0039] Update the aforementioned application to the corresponding storage area of ​​the aforementioned electronic device.

[0040] In one possible implementation, after detecting whether the electronic device and the storage device are connected, the method further includes:

[0041] If the aforementioned electronic device and the aforementioned storage device are not connected, the aforementioned boot program will be started.

[0042] In one possible implementation, the program states of the aforementioned electronic device are different, and the state values ​​corresponding to the aforementioned jump flag bits are different.

[0043] In this embodiment, different program states of the electronic device can be indicated by different state values ​​corresponding to the jump flag bit, so that the electronic device can quickly and effectively perform the corresponding program jump processing according to the state value of the jump flag bit after power-on, thereby improving the efficiency and effectiveness of program jump and avoiding the electronic device from repeatedly performing invalid program jump processes.

[0044] Secondly, embodiments of this application provide a program jump device, which is applied to an electronic device and includes:

[0045] The first acquisition module is used to acquire the status value of the jump flag after the boot program starts; the jump flag is used to indicate the program status of the electronic device; the jump flag is obtained from the file corresponding to the boot program.

[0046] The first determining module is used to determine whether it is possible to jump to the application based on the status value of the aforementioned jump flag bit.

[0047] An initialization module is used to jump to the aforementioned application if possible, and to initialize the application to obtain an initialization result; the initialization result is used to determine whether the application can run normally.

[0048] In one possible implementation, the first determining module described above is specifically used for:

[0049] If the state value of the aforementioned jump flag is a jumpable state value, it is determined that the aforementioned electronic device can jump to the application; the aforementioned jumpable state value is at least one state value of the aforementioned jump flag corresponding to the aforementioned electronic device being in a state where the aforementioned application has been burned in and the aforementioned application has not been initialized or is running normally.

[0050] In one possible implementation, the above-mentioned program jump device further includes:

[0051] The first update module is used to update the status value of the jump flag bit to a second status value; the second status value is used to indicate the status of application initialization failure in the electronic device.

[0052] The second update module is used to update the status value of the jump flag from the second status value to the first status value if the initialization result is successful.

[0053] The state value holding module is used to hold the state value of the jump flag bit as the second state value if the initialization result is an initialization failure.

[0054] The first state value is used to indicate that the application in the electronic device has been successfully initialized and can run normally.

[0055] In one possible implementation, the above-mentioned program jump device further includes:

[0056] The identity matching module is used to match the hardware identity information of the electronic device with the valid hardware identity information corresponding to the application if the user can jump to the application, and obtain the matching result.

[0057] The second determining module is used to determine whether the electronic device can run the application normally based on the matching results and the initialization results.

[0058] Thirdly, embodiments of this application provide an electronic device, including: a processor and a memory; wherein the memory stores a computer program, the computer program being adapted to be loaded by the processor and execute the method steps provided by the first aspect of the embodiments of this application or any possible implementation thereof.

[0059] Fourthly, embodiments of this application provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the method steps provided by the first aspect of the embodiments of this application or any possible implementation thereof.

[0060] It is understood that the program jump device provided in the second aspect, the electronic device provided in the third aspect, and the computer storage medium provided in the fourth aspect are all used to execute the program jump method provided in the first aspect or any implementation of the first aspect. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects of the program jump method provided in the first aspect or any implementation of the first aspect, and will not be repeated here.

[0061] The above description is merely an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below. Attached Figure Description

[0062] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0063] Figure 1 A schematic diagram of the architecture of an electronic device provided for an exemplary embodiment of this application;

[0064] Figure 2 A flowchart illustrating a program jump method provided as an exemplary embodiment of this application;

[0065] Figure 3 A schematic diagram illustrating the implementation process of a program jump method provided in an exemplary embodiment of this application;

[0066] Figure 4 A flowchart illustrating another program jump method provided as an exemplary embodiment of this application;

[0067] Figure 5 This is a schematic diagram illustrating the program burning process provided in related technologies;

[0068] Figure 6 A schematic diagram illustrating the process of program upgrades provided in related technologies;

[0069] Figure 7 A flowchart illustrating a program burning and redirection method provided for an exemplary embodiment of this application;

[0070] Figures 8A-8D A schematic diagram illustrating the program burning process provided in an exemplary embodiment of this application;

[0071] Figure 9 A schematic diagram of a program jump device provided for an exemplary embodiment of this application;

[0072] Figure 10 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this application. Detailed Implementation

[0073] To make the features and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0074] The terms "first," "second," "third," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0075] Please refer to the following. Figure 1 This is a schematic diagram of the architecture of an electronic device provided in an exemplary embodiment of this specification.

[0076] like Figure 1 As shown, the electronic device includes: flash memory, a processor, and a storage device interface. Wherein:

[0077] Flash memory (FLASH) is a type of non-volatile memory, meaning that data is not lost after power is turned off. It is used to store programs (such as, but not limited to, bootloaders, applications, etc.) burned into storage devices (such as, but not limited to, SD cards) or programs, configuration files, and other data that need to be permanently stored, written through other means.

[0078] The storage device interface is a bridge connecting the processor and the storage device. The storage device may be, but is not limited to, a Secure Digital Card (SD card). The storage device interface may be, but is not limited to, an SD card interface, used to connect an SD card (storage device) to read the program to be burned from the SD card. The program to be burned may include, but is not limited to, a bootloader and / or an application program.

[0079] The processor is connected to both the flash memory and the storage device interface. After the electronic device is powered on, it first checks if a storage device is connected to the storage device interface. If a storage device is connected, the programming program can be executed; that is, the program to be programmed is read from the connected storage device through the storage device interface and written to the corresponding storage area of ​​the flash memory. If no storage device is connected, the program jump program can be executed; that is, after the bootloader written in the flash memory starts, it obtains the status value of the jump flag, which indicates the program state of the electronic device. This jump flag is obtained from the file corresponding to the bootloader. Based on the status value of the jump flag, it determines whether it can jump to the application program. If it can jump to the application program, it jumps to the application program and initializes it, obtaining the initialization result. The initialization result is used to determine whether the application program can run normally.

[0080] Next, combine Figure 1 Taking program jump in an electronic device as an example, this application introduces a program jump method provided in an exemplary embodiment. Please refer to [link / reference needed] for details. Figure 2 This is a flowchart illustrating a program jump method provided in an exemplary embodiment of this application. Figure 2 As shown, the program jump method may include the following steps:

[0081] S201, after the bootloader starts, obtain the status value of the jump flag.

[0082] Specifically, the aforementioned bootloader is the first program to run after the electronic device is powered on or reset. It is responsible for loading the core of the operating system into memory, setting up the hardware environment, and then transferring control to the operating system or other higher-level programs, such as, but not limited to, applications. The aforementioned jump flag is used to indicate the program state of the electronic device. This jump flag is obtained from the file corresponding to the bootloader. For example, but not limited to, after the bootloader is written into the electronic device, the jump flag is read from the bootloader file corresponding to that bootloader and stored in the corresponding storage area. This allows the bootloader or application in the electronic device to update the jump flag's value based on changes in the program state during subsequent operation. After the bootloader in the electronic device starts, it can directly read the jump flag's value from the storage area corresponding to it. The jump flag's value can be determined based on, but not limited to, the program's burning status and / or running status in the electronic device.

[0083] Understandably, the state values ​​corresponding to the jump flags differ depending on the program state of the aforementioned electronic device. The correspondence between the state values ​​corresponding to the jump flags and the program state of the electronic device is, for example but not limited to, as shown in Table 1:

[0084] Table 1. Correspondence between jump flag values ​​and electronic device program states.

[0085] The status value of the jump flag Program status of electronic devices 0xFF The status of the unburned bootloader and applications 0x00 The bootloader has been burned but the application has not been burned. 0x01 The application has been burned and the application upgrade has been successful. 0x02 Application initialization or device identity matching failure status 0x07 The status of the bootloader and applications has been burned. 0x11 The application has initialized successfully and is ready to run.

[0086] When the electronic device is in a state where the bootloader and application have not been burned, the status value corresponding to the jump flag can be set to 0xFF. Optionally, when the status value corresponding to the jump flag is 0xFF, it can also indicate, but is not limited to, a state where the bootloader burning has failed or the bootloader is faulty. When the electronic device is in a state where the bootloader has been burned but the application has not been burned, the status value corresponding to the jump flag can be set to 0x00. When the electronic device is in a state where the application has been burned and the application upgrade has been successful, the status value corresponding to the jump flag can be set to 0x01. When the electronic device is in a state where the application initialization has failed or the device identity matching has failed, the status value corresponding to the jump flag can be set to 0x02. When the electronic device is in a state where the bootloader and application have been burned, the status value corresponding to the jump flag can be set to 0x07. When the electronic device is in a state where the application initialization has been successful and the device can run normally, the status value corresponding to the jump flag can be set to 0x11.

[0087] In other words, in this embodiment of the application, different program states of the electronic device can be indicated by the jump flag bit corresponding to different state values, so that the electronic device can quickly and effectively perform the corresponding program jump processing according to the state value of the jump flag bit after power-on, thereby improving the efficiency and effectiveness of program jump and avoiding the electronic device from repeatedly performing invalid program jump processes.

[0088] S202, determine whether to jump to the application based on the status value of the jump flag.

[0089] Specifically, after obtaining the status value of the jump flag, the electronic device can first determine whether it can jump from the bootloader to the application based on the status value of the jump flag. Only if it is determined that it can jump to the application will it jump to the running application, thereby ensuring the security and effectiveness of the program jump.

[0090] It is understood that the aforementioned application may include one or more pre-specified applications to be redirected to in the electronic device, and this application embodiment does not limit this.

[0091] Optionally, such as Figure 3As shown, after obtaining the status value of the jump flag (S301), the above-mentioned S202, the process of determining whether to jump to the application based on the status value of the jump flag, may include, but is not limited to: first determining whether the status value of the jump flag belongs to the jumpable class status value (S302), and if the status value of the jump flag belongs to the jumpable class status value, it means that the electronic device has an application program burned in it, and the application program has not been initialized or the application program has been initialized and initialized successfully and can run normally. Then it can be determined that the electronic device can jump to the application program (S303). Thus, by determining whether the jump flag belongs to the jumpable class status value, it is possible to efficiently and flexibly determine whether to jump to the application program. This can avoid the problem of invalid program jump when the electronic device has not burned an application program, improve the flexibility and effectiveness of program jump, and also avoid the problem of damaged or malicious applications (such as applications that fail to initialize and cannot run normally) being repeatedly loaded and executed, thereby affecting the security of program jump. The aforementioned jumpable state values ​​are at least one state value of the jump flag corresponding to the electronic device being in a state where the application has been burned in and the application has not been initialized or is running normally. For example, but not limited to, the state values ​​0x01, 0x07, 0x11, etc. in Table 1 above.

[0092] Optionally, such as Figure 3 As shown, after obtaining the status value of the jump flag bit (S301), the above-mentioned S202, the process of determining whether to jump to the application based on the status value of the jump flag bit, may include, but is not limited to: if the status value of the jump flag bit does not belong to the jumpable status value (e.g., but not limited to the status values ​​0x00, 0x02, 0xFF, etc. in Table 1 above), it means that the electronic device has not been burned with an application, or the burned application has been initialized but failed to run normally. In this case, it can be determined that the electronic device cannot jump to the application (S314). Thus, when the jump flag bit corresponding to the electronic device does not belong to the jumpable status value, it can efficiently and flexibly determine that the electronic device cannot jump to the application, avoiding the problem that the jump will always fail or be invalid when the electronic device has not burned with an application or the burned application cannot run normally on the electronic device. This improves the flexibility and effectiveness of program jump.

[0093] S203, if it is possible to jump to the application, then jump to the application and initialize the application to obtain the initialization result. The initialization result is used to determine whether the application can run normally.

[0094] Specifically, if it is determined that the electronic device can jump to an application, a jump instruction corresponding to that application can be generated. In response to this jump instruction, the system jumps directly from the bootloader to the application based on the jump address carried by the instruction, thereby starting the execution of the application's code. After the application starts, it first performs initialization and obtains the corresponding initialization result. This initialization result is used to determine whether the application can run normally, that is, to determine whether the electronic device can accurately and flawlessly execute the various functions of the application according to its design and requirements, providing the user with the required service or experience.

[0095] In this embodiment, after the bootloader starts, it obtains the status value of the jump flag and determines whether it can jump to the application based on the status value of the jump flag. In the above scheme, since a jump flag indicating the program status of the electronic device is added, and the status value of the jump flag is used to determine whether it can jump to the application before program jump, the jump to the running application will only occur if it is determined that it can jump to the application. Compared with the related technology of directly jumping from the bootloader to the application, the method of determining whether it can jump to the application based on the status value of the jump flag before jumping to the application can efficiently and flexibly realize the safe jump from the bootloader to the application. This not only improves the flexibility and effectiveness of program jump, but also avoids the problem of problematic applications being repeatedly loaded and executed, thus affecting the security of program jump. In addition, the jump flag indicates the program status of the electronic device, which facilitates the debugging and testing of programs in the electronic device. At the same time, after the electronic device jumps from the bootloader to the application, it will also initialize the application and obtain the initialization result to determine whether the electronic device can run the application normally, thereby further ensuring the security and effectiveness of the application running in the electronic device.

[0096] Furthermore, such as Figure 3As shown, when the jump flag's state value belongs to the jumpable class and is not the first state value (S304), and before the application is initialized (S307), the program jump method may further include, but is not limited to, updating the jump flag's state value to the second state value (S305), thereby indicating that the application in the electronic device has been initialized but has not yet been successfully initialized. The second state value is used to indicate the state of application initialization failure in the electronic device, for example, but not limited to, the state value 0x02 in Table 1 above. Then, the application is initialized again (S307) to obtain the initialization result. If the initialization result is successful (S308), after confirming successful initialization, the status value of the jump flag is updated from the second status value to the first status value (S309), indicating that the application initialization was successful and the application can run normally on the electronic device (S310). If the initialization result is unsuccessful (S311), after confirming unsuccessful initialization, the status value of the jump flag is kept at the second status value (S312), indicating that the application initialization failed and the application cannot run normally on the electronic device. The bootloader then continues running (S313). This avoids repeating the jump and failed jump process after the device is powered on again, preventing problematic applications from repeatedly running on the electronic device and affecting its quality, and improving the effectiveness of program jumps. The first status value indicates that the application in the electronic device has been successfully initialized and can run normally. This first status value is, for example, but not limited to, the status value 0x11 in Table 1 above.

[0097] Optionally, such as Figure 3 As shown, in S303, after determining that it is possible to jump to the application, if the state value of the jump flag is the first state value, that is, in S306, when it is determined that the state value of the jump flag is the first state value, it means that the application has been initialized and has been initialized successfully. Therefore, there is no need to perform the step of updating it to the second state value, but the application still needs to be initialized, that is, in S307, to ensure the safe operation of the application.

[0098] In some possible embodiments, after determining whether a jump to the application can be performed based on the status value of the jump flag in S202, the above program jump method may also include, but is not limited to, the following: if a jump to the application cannot be performed, continue running the bootloader, or output program burning error message or hardware detection message, thereby avoiding the problem of invalid jump of the application.

[0099] Optionally, such as Figure 3As shown, the process of continuing to run the bootloader or outputting a program burning error message or hardware detection message if the application cannot be accessed may include, but is not limited to, the following: If it is determined that the application cannot be accessed, and the status value of the jump flag is not a jumpable status value and is not the initial status value (i.e., after determining in S315 that the status value of the jump flag is not the initial status value), it indicates that there is a bootloader in the application that can run, and the bootloader can continue to run (i.e., S313); or, if the status value of the jump flag is not a jumpable status value and is the initial status value (i.e., after determining in S316 that the status value of the jump flag is the initial status value), it indicates that there is an error in the burning process of the electronic device, resulting in the inability to read and run normally, or that there is a hardware problem in the electronic device that requires repair, and a program burning error message or hardware detection message can be output (i.e., S317) to inform the user that the program burning is incorrect and needs to be re-burned, or that there is a hardware problem that requires inspection and repair. The aforementioned initial state value is used to indicate that the electronic device is in a state where no boot program and application have been burned. The aforementioned initial state value is, for example, but not limited to, the state value 0xFF in Table 1 above.

[0100] Understandably, when there is a problem with the boot program already burned into an electronic device or when there is a problem with the hardware of the electronic device, the electronic device may be unable to read the boot program already burned into it, which may result in the jump flag bit reading the initial state value.

[0101] Please refer to the following. Figure 4 This is a flowchart illustrating another program jump method provided in an exemplary embodiment of this application. Figure 4 As shown, the program jump method may include the following steps:

[0102] S401, after the bootloader starts, it obtains the status value of the jump flag.

[0103] Specifically, S401 is the same as S201, and will not be repeated here.

[0104] S402 determines whether to jump to the application based on the status value of the jump flag.

[0105] Specifically, S402 is the same as S202, and will not be repeated here.

[0106] S403 If it is possible to jump to the application, then jump to the application and initialize the application to obtain the initialization result. The initialization result is used to determine whether the application can run normally.

[0107] Specifically, S403 is the same as S203, and will not be repeated here.

[0108] Please continue to refer to the following. Figure 4 ,like Figure 4 As shown, in step S402 above, after determining whether a jump to the application program is possible based on the status value of the jump flag, the program jump method may further include:

[0109] S404 If the user can jump to the application, the hardware identity information of the electronic device is matched with the valid hardware identity information corresponding to the application to obtain the matching result.

[0110] Specifically, the application may include, but is not limited to, a hardware compatibility check module. To ensure that the electronic device meets the basic hardware requirements for the application to run, and to prevent application errors, performance degradation, or crashes due to hardware incompatibility, this module reads the electronic device's hardware identity information (e.g., but not limited to, the electronic device's CPU model, memory size, screen resolution, etc.) during application runtime. It then matches the read hardware identity information with predefined valid hardware identity information within the application to obtain the corresponding matching result. This matching result is used to subsequently determine whether the electronic device is authorized to run the application. The aforementioned valid hardware identity information may include, but is not limited to, the hardware identity information of devices authorized to run the application, meeting the basic hardware requirements for its operation.

[0111] Understandably, S404 and S403 can be executed sequentially or synchronously, and this application embodiment does not limit this.

[0112] S405 determines whether the electronic device can run the application correctly based on the matching and initialization results.

[0113] Specifically, after obtaining the matching and initialization results corresponding to the application, if the matching is successful (i.e., the hardware identity information of the electronic device matches the valid hardware identity information corresponding to the application) and the application initialization is successful, it indicates that not only does the electronic device meet the basic hardware requirements for the application to run and is an authorized device to run the application, but the application can also run successfully on the electronic device. Therefore, it can be determined that the electronic device can run the application normally, that is, it can accurately and securely execute the various functions of the application according to its design and requirements. The electronic device will continue to run the application. Thus, by combining the application initialization result and the matching result of the electronic device's hardware identity information, it is determined whether the electronic device can run the application normally. This not only prevents malicious software or unauthorized applications from running on unqualified devices, and prevents problems such as application running errors, performance degradation, or crashes caused by hardware incompatibility, but also ensures that the application is in the correct state before running and is ready to perform its expected functions, thereby improving the effectiveness and security of application operation in electronic devices.

[0114] Specifically, if the matching fails—meaning the hardware identity information of the electronic device does not match the valid hardware identity information corresponding to the application—it indicates that the electronic device does not meet the basic hardware requirements for the application to run and is not an authorized device to run the application. Alternatively, if the application initialization fails, it means that the application cannot run successfully on the electronic device. In such cases, it can be determined that the electronic device cannot run the application normally, i.e., it cannot accurately and securely execute the various functions of the application. The electronic device will stop running the application and issue a problem message to inform the user that the electronic device does not meet the requirements, or suggest that the user upgrade the electronic device, or inform the user that the application initialization failed, etc. This is to prevent the application from crashing after being burned to an incompatible electronic device, or to prevent the continuous running of an incorrect application from affecting the hardware of the electronic device, thus protecting the quality of the electronic device.

[0115] In related technologies, program burning and upgrading are generally carried out in two stages, as follows: Figure 5 and Figure 6 As shown: First stage (e.g.) Figure 5 As shown, the BOOT needs to be burned via a programmer connection. After successful burning, the BOOT is written into the corresponding storage area of ​​the Flash memory of the new device (an electronic device without a programmed firmware). The second stage (as shown) Figure 6 As shown, the new device that has been successfully booted needs to be restarted, and then the APP is upgraded online through the upper-layer software. After the upgrade is successful, the APP is written into the corresponding storage area of ​​the FALSH of the new device that has been successfully booted, thereby completing the software booting and upgrade of the electronic device. That is, the electronic device has successfully completed the booting and APP booting.

[0116] However, the aforementioned technologies that use programmers for programming require programming equipment such as computers and corresponding programming software. This requires manual operation of multiple programming steps, which not only increases the difficulty of pilot testing and production of electronic devices, but also increases the computer memory requirements of production and testing personnel, and the programming cost is high.

[0117] To address the problems of complex program burning operations in the aforementioned related technologies, which increase the difficulty of pilot testing and production of electronic devices, and the high cost of program burning and upgrades, this application also provides a method for program burning via a storage device. Please refer to the following for details. Figure 7 This is a flowchart illustrating a program burning and redirection method provided in an exemplary embodiment of this application. Figure 7 As shown, the program burning and redirection method may include the following steps:

[0118] S701: After the electronic device is powered on, it detects whether the electronic device and the storage device are connected.

[0119] Specifically, once the electronic device is powered on, a connection detection mechanism is activated to quickly scan and verify whether the electronic device and the storage device are in a connected state, such as, but not limited to, detecting whether an SD card (storage device) has been inserted into the electronic device.

[0120] Optionally, if it is necessary to program the electronic device via a storage device, a jump flag can be added in advance to the bootloader file corresponding to the bootloader, and the bootloader file corresponding to the bootloader compiled by the development software and / or the application file corresponding to the application can be copied to the formatted storage device. To improve the compatibility and read / write performance of the storage device, broaden its application scenarios, and reduce its maintenance and management requirements, the above formatting can be either FAT32 or FAT16; this embodiment does not limit the formatting.

[0121] S702, if in a connected state, reads the program to be burned from the storage device.

[0122] Specifically, if the electronic device and the storage device are connected, it means that the electronic device needs to execute a programming program, and will read the program to be programmed that has been pre-copied in the storage device. The program to be programmed may include, but is not limited to, the bootloader and / or application program to be programmed.

[0123] S703: If an existing program of the same type as the program to be programmed exists in the electronic device, the existing program is erased, and the program to be programmed from the storage device is written to the corresponding storage area of ​​the electronic device.

[0124] Specifically, if there is a pre-programmed program of the same type as the program to be programmed in the electronic device, it is necessary to first erase the pre-programmed program of the same type in the electronic device to ensure that the storage area of ​​the pre-programmed program in the electronic device is cleared and ready to receive the program to be programmed of the same type. Then, the program to be programmed in the storage device is written into the corresponding storage area of ​​the electronic device.

[0125] For example, when the program to be burned in the storage device includes a boot program to be burned and the electronic device has already burned a boot program, after the electronic device reads the boot program to be burned in the storage device, it will first erase the already burned boot program, and then write the boot program to be burned into the corresponding storage area of ​​the electronic device, that is, the storage area corresponding to the boot program.

[0126] Please continue to refer to the following. Figure 7 ,like Figure 7 As shown, in the above-mentioned S702, if the device is in a connected state, after reading the program to be burned from the storage device, the program burning and jump method may also include, but is not limited to:

[0127] S704 If there is no program of the same type as the program to be programmed in the electronic device, the program to be programmed in the storage device is written to the corresponding storage area of ​​the electronic device.

[0128] Understandably, when the program to be burned includes a bootloader and an application program, the bootloader has a higher writing priority than the application program. That is, the bootloader needs to be written to the storage area corresponding to the electronic device first, and then the application program in the storage device is written to the storage area corresponding to the electronic device. In the electronic device, the storage area corresponding to the bootloader is different from the storage area corresponding to the application program.

[0129] For example, such as Figure 8A As shown, if the electronic device has not been programmed with a bootloader and application program, the bootloader and application program to be programmed can be copied to a storage device. Then, the storage device is connected to the electronic device, and programming is performed through the storage device. That is, after the electronic device is powered on, the bootloader and application program to be programmed are sequentially written into their respective storage areas in the FLASH memory of the electronic device, thereby completing the programming process.

[0130] For example, such as Figure 8BAs shown, if the electronic device does not have a bootloader and application program burned into it, only the bootloader to be burned can be copied to a storage device. Then, the storage device is connected to the electronic device, and the bootloader is burned through the storage device. That is, after the electronic device is powered on, the bootloader to be burned from the storage device is written to the corresponding storage area in the electronic device's FLASH memory, thus completing the burning of the bootloader. Then, the APP is upgraded through upper-layer software, that is, the APP to be upgraded is written to the corresponding storage area in the electronic device's FLASH memory, thus completing the upgrade of the electronic device's APP, i.e., the burning of the application program. The specific implementation process of upgrading the APP through upper-layer software is the same as the implementation process in S705-S707 below, and will not be repeated here.

[0131] For example, such as Figure 8C As shown, if the electronic device has a boot program but no application program, the application program to be burned can be copied to a storage device, and then the storage device can be connected to the electronic device. The application program to be burned can be burned through the storage device. That is, after the electronic device is powered on, the application program to be burned in the storage device is written into the corresponding storage area in the FLASH of the electronic device, thereby completing the burning of the application program.

[0132] For example, such as Figure 8D As shown, if the electronic device already has a bootloader and application program burned into it, the electronic device can not only upgrade the application through upper-layer software, but also update the application through a storage device. That is, the application to be updated can be copied to the storage device, then the storage device is connected to the electronic device, and the application to be updated is burned into the storage device. In other words, after the electronic device is powered on, the already burned application can be erased, and then the application to be updated from the storage device can be written to the corresponding storage area in the electronic device's FLASH memory, thus completing the application update.

[0133] Optionally, after the electronic device is powered on and the programming is completed, it may also output corresponding programming completion prompt information based on the electronic device's display screen and / or indicator lights and / or speaker.

[0134] In this embodiment, by placing the boot program and / or application to be burned into the storage area of ​​the electronic device in one step, the boot program and / or application to be burned into the corresponding storage area of ​​the electronic device can be burned in one step. This can reduce the program update and burning steps of the electronic device, improve the flexibility of program burning, reduce the operational difficulty of pilot and production of electronic devices, and eliminate the need for production personnel to install the corresponding burning software on their own computers, thereby reducing the pressure on their computer memory and saving program burning and upgrade costs.

[0135] Please continue to refer to the following. Figure 7When the program to be burned in the storage device includes the boot program to be burned, such as Figure 7 As shown, after writing the program to be programmed from the storage device into the corresponding storage area of ​​the electronic device, the program programming and jump method may also include, but is not limited to:

[0136] S705 acquires user-triggered application update commands based on electronic devices.

[0137] Specifically, when an electronic device has a bootloader written to it but no application has been written to it, or when an application that has been written to it needs to be updated, the user can trigger the electronic device to generate a corresponding application update command through the electronic device's display screen or buttons, but not limited to.

[0138] Optionally, if no application is written to the electronic device, the application update instruction may, but is not limited to, carry the address of the application to be updated; if an application is written to the electronic device, the application update instruction may, but is not limited to, carry the address of the application to be updated and the identity of the application already written to the electronic device that needs to be updated.

[0139] S706, in response to an application update command, retrieves the application to be updated from a local database on a network or electronic device.

[0140] Specifically, after receiving an application update instruction, the electronic device can respond to the application update instruction by retrieving the application to be updated from the network or the electronic device's local database according to the address of the application to be updated carried in the application update instruction.

[0141] S707 updates the application to be updated to the corresponding storage area of ​​the electronic device.

[0142] Specifically, if no application is written to the electronic device, the application to be updated can be directly written to the corresponding storage area of ​​the electronic device; if an application is already written to the electronic device, the corresponding application in the electronic device is erased according to the identity of the application to be updated carried by the application update instruction, and then the application to be updated is written to the corresponding storage area of ​​the electronic device, thereby completing the update of the electronic device application.

[0143] Please continue to refer to the following. Figure 7 ,like Figure 7 As shown in S701 above, after the electronic device is powered on and the connection between the electronic device and the storage device is detected, the program burning and jump method may also include, but is not limited to, the following:

[0144] S708, if the electronic device and the storage device are not connected, the boot program is started.

[0145] Specifically, since the execution priority of the burning program, which is burned into the storage device, is higher than that of the jump program, the electronic device will start the boot program only if it is disconnected from the storage device after being powered on. This avoids errors caused by the burning program and the jump program, or by performing a program jump before the program is burned, thus improving the effectiveness and security of the program operation within the electronic device.

[0146] S709, after the bootloader starts, it obtains the status value of the jump flag.

[0147] Specifically, S709 is the same as S201, and will not be repeated here.

[0148] S710 determines whether to jump to the application based on the status value of the jump flag.

[0149] Specifically, S710 is the same as S202, and will not be repeated here.

[0150] S711 If it can jump to the application, it will jump to the application and initialize the application, and obtain the initialization result. The initialization result is used to determine whether the application can run normally.

[0151] Specifically, S711 is the same as S203, and will not be repeated here.

[0152] Please refer to the following. Figure 9 This is a schematic diagram illustrating the structure of a program jump device provided in an exemplary embodiment of this application. The aforementioned program jump device is applied to electronic devices, such as... Figure 9 As shown, the program jump device 900 includes:

[0153] The first acquisition module 910 is used to acquire the status value of the jump flag after the boot program starts; the jump flag is used to indicate the program status of the electronic device; the jump flag is obtained from the file corresponding to the boot program.

[0154] The first determining module 920 is used to determine whether it is possible to jump to the application based on the status value of the aforementioned jump flag bit.

[0155] The initialization module 930 is used to jump to the above application if possible, and initialize the above application to obtain the initialization result; the initialization result is used to determine whether the above application can run normally.

[0156] In one possible implementation, the first determining module 920 is specifically used for:

[0157] If the state value of the aforementioned jump flag is a jumpable state value, it is determined that the aforementioned electronic device can jump to the application; the aforementioned jumpable state value is at least one state value of the aforementioned jump flag corresponding to the aforementioned electronic device being in a state where the aforementioned application has been burned in and the aforementioned application has not been initialized or is running normally.

[0158] In one possible implementation, the program jump device 900 further includes:

[0159] The first update module is used to update the status value of the jump flag bit to a second status value; the second status value is used to indicate the status of application initialization failure in the electronic device.

[0160] The second update module is used to update the status value of the jump flag from the second status value to the first status value if the initialization result is successful.

[0161] The state value holding module is used to hold the state value of the jump flag bit as the second state value if the initialization result is an initialization failure.

[0162] The first state value is used to indicate that the application in the electronic device has been successfully initialized and can run normally.

[0163] In one possible implementation, the program jump device 900 further includes:

[0164] The identity matching module is used to match the hardware identity information of the electronic device with the valid hardware identity information corresponding to the application if the user can jump to the application, and obtain the matching result.

[0165] The second determining module is used to determine whether the electronic device can run the application normally based on the matching results and the initialization results.

[0166] In one possible implementation, the program jump device 900 further includes:

[0167] The execution module is used to continue running the bootloader if the user cannot jump to the aforementioned application; or,

[0168] The prompt module is used to output a program burning error message or hardware detection message if the user cannot jump to the above application.

[0169] In one possible implementation, the first determining module 920 is specifically used for:

[0170] If the state value of the aforementioned jump flag does not belong to the jumpable state value, it is determined that the aforementioned electronic device cannot jump to the application; the aforementioned jumpable state value is at least one state value of the aforementioned jump flag corresponding to the aforementioned electronic device being in a state where the aforementioned application has been burned in and the aforementioned application has not been initialized or is running normally.

[0171] The aforementioned operating module is specifically used to: if it cannot jump to the aforementioned application, then, if the status value of the aforementioned jump flag is not a jumpable status value and the status value of the aforementioned jump flag is not the initial status value, continue running the aforementioned bootstrap program; or,

[0172] The above-mentioned prompt module is specifically used to: if it cannot jump to the above-mentioned application, and the status value of the above-mentioned jump flag does not belong to the above-mentioned jumpable status value and the status value of the above-mentioned jump flag is the above-mentioned initial status value, output program burning error prompt information or hardware detection prompt information;

[0173] The aforementioned initial state value is used to indicate that the electronic device is in a state where no boot program or application has been burned.

[0174] In one possible implementation, the program jump device 900 further includes:

[0175] The detection module is used to detect whether the electronic device and the storage device are connected after the electronic device is powered on.

[0176] The reading module is used to read the program to be burned from the storage device if the device is in a connected state; the program to be burned includes the boot program and / or application program to be burned.

[0177] The erase / write module is used to erase the already burned program if there is a program of the same type as the program to be burned in the above-mentioned electronic device, and write the program to be burned in the above-mentioned storage device into the corresponding storage area of ​​the above-mentioned electronic device.

[0178] The writing module is used to write the program to be burned from the storage device into the corresponding storage area of ​​the electronic device if there is no already burned program of the same type as the program to be burned in the electronic device.

[0179] In one possible implementation, the program to be burned includes a bootloader to be burned;

[0180] The aforementioned program jump device 900 also includes:

[0181] The second acquisition module is used to acquire the application update instruction triggered by the user based on the aforementioned electronic device;

[0182] The third acquisition module is used to acquire the application to be updated from the network or the local database of the electronic device in response to the application update instruction.

[0183] The third update module is used to update the application to be updated to the storage area corresponding to the electronic device.

[0184] In one possible implementation, the program jump device 900 further includes:

[0185] The startup module is used to start the boot program if the electronic device and the storage device are not connected.

[0186] In one possible implementation, the program states of the aforementioned electronic device are different, and the state values ​​corresponding to the aforementioned jump flag bits are different.

[0187] The division of modules in the above-described program jump device is for illustrative purposes only. In other embodiments, the program jump device can be divided into different modules as needed to complete all or part of the functions of the program jump device. The implementation of each module in the program jump device provided in this application embodiment can be in the form of a computer program. This computer program can run on an electronic device. The program modules constituted by this computer program can be stored in the memory of the electronic device. When the computer program is executed by a processor, it implements all or part of the steps of the program jump method described in this application embodiment.

[0188] Please see below. Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 10 As shown, the electronic device 1000 includes: at least one processor 1010, at least one communication bus 1020, user interface 1030, at least one network interface 1040, and memory 1050.

[0189] The communication bus 1020 can be used to realize the connection and communication of the above components.

[0190] The user interface 1030 may include a display screen and a camera. Optionally, the user interface 1030 may also include a standard wired interface and a wireless interface.

[0191] The network interface 1040 may include a Bluetooth module, a Near Field Communication (NFC) module, a Wireless Fidelity (Wi-Fi) module, etc.

[0192] The processor 1010 may include one or more processing cores. The processor 1010 connects to various parts within the electronic device 1000 using various interfaces and lines. It executes various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1050, and by calling data stored in the memory 1050. Optionally, the processor 1010 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 1010 may integrate one or more of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor 1010.

[0193] The memory 1050 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 1050 may include a non-transitory computer-readable medium. The memory 1050 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 1050 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as program jump function, program initialization function, fetch function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. The memory 1050 may also be at least one storage device located remotely from the aforementioned processor 1010. Figure 10 As shown, the memory 1050, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and program instructions.

[0194] Specifically, the processor 1010 can be used to call program instructions stored in the memory 1050 and perform the following operations:

[0195] After the bootloader starts, it obtains the status value of the jump flag bit; the jump flag bit is used to indicate the program status of the electronic device; the jump flag bit is obtained from the file corresponding to the bootloader; based on the status value of the jump flag bit, it is determined whether it can jump to the application; if it can jump to the application, it jumps to the application and initializes the application to obtain the initialization result; the initialization result is used to determine whether the application can run normally.

[0196] In some possible embodiments, when the processor 1010 executes the above-mentioned determination of whether to jump to the application based on the status value of the jump flag bit, it is specifically used to perform:

[0197] If the state value of the aforementioned jump flag is a jumpable state value, it is determined that the aforementioned electronic device can jump to the application; the aforementioned jumpable state value is at least one state value of the aforementioned jump flag corresponding to the aforementioned electronic device being in a state where the aforementioned application has been burned in and the aforementioned application has not been initialized or is running normally.

[0198] In some possible embodiments, when the state value of the jump flag is a jumpable state value and the state value of the jump flag is not a first state value, before the processor 1010 performs the above-mentioned initialization of the application, it is further configured to perform:

[0199] The method further includes: updating the status value of the jump flag to a second status value; the second status value indicating the failure of application initialization in the electronic device; after initializing the application and obtaining the initialization result, the method further includes: if the initialization result is successful, updating the status value of the jump flag from the second status value to the first status value; if the initialization result is failed, maintaining the status value of the jump flag at the second status value; wherein the first status value indicating the successful initialization of the application in the electronic device and its normal operation.

[0200] In some possible embodiments, after the processor 1010 performs the above-mentioned determination based on the status value of the jump flag bit to determine whether a jump to the application can be performed, it is also used to perform:

[0201] If the user can jump to the aforementioned application, the hardware identity information of the electronic device is matched with the valid hardware identity information corresponding to the application to obtain a matching result. Based on the matching result and the initialization result, it is determined whether the electronic device can run the application normally.

[0202] In some possible embodiments, after the processor 1010 performs the above-mentioned determination based on the status value of the jump flag bit to determine whether a jump to the application can be performed, it is also used to perform:

[0203] If you cannot jump to the above application, continue running the above bootloader, or output a program burning error message or hardware detection message.

[0204] In some possible embodiments, when the processor 1010 executes the above-mentioned determination of whether to jump to the application based on the state value of the jump flag bit, it is specifically used to perform: if the state value of the jump flag bit does not belong to the jumpable state value, determine that the electronic device cannot jump to the application; the jumpable state value is at least one state value corresponding to the jump flag bit when the electronic device is in a state where the application has been burned and the application is not initialized or running normally.

[0205] If the processor 1010 fails to jump to the application program as described above, it will continue running the bootloader, or output program burning error messages or hardware detection messages. Specifically, it will execute the following:

[0206] If the user cannot jump to the aforementioned application, then if the status value of the jump flag is not a jumpable status value and the status value of the jump flag is not the initial status value, the boot program will continue to run; or, if the status value of the jump flag is not a jumpable status value and the status value of the jump flag is the initial status value, a program burning error message or a hardware detection message will be output. The initial status value is used to indicate that the electronic device is in a state where the boot program and application have not been burned.

[0207] In some possible embodiments, after the processor 1010 executes the bootloader startup and before obtaining the status value of the jump flag, it is also used to perform:

[0208] After the electronic device is powered on, it checks whether the electronic device and the storage device are connected. If they are connected, it reads the program to be burned from the storage device. The program to be burned includes a bootloader and / or application program. If the electronic device has a pre-burned program of the same type as the program to be burned, it erases the pre-burned program and writes the program to be burned from the storage device to the corresponding storage area of ​​the electronic device. If the electronic device does not have a pre-burned program of the same type as the program to be burned, it writes the program to be burned from the storage device to the corresponding storage area of ​​the electronic device.

[0209] In some possible embodiments, the program to be burned includes a bootloader to be burned;

[0210] After the processor 1010 executes the above-mentioned process of writing the program to be programmed from the storage device into the corresponding storage area of ​​the electronic device, it is also used to execute:

[0211] Based on the aforementioned electronic device, an application update command triggered by the user is obtained; in response to the aforementioned application update command, the application to be updated is obtained from the network or the local database of the aforementioned electronic device; and the application to be updated is updated to the corresponding storage area of ​​the aforementioned electronic device.

[0212] In some possible embodiments, after the processor 1010 performs the above-mentioned detection of whether the electronic device and the storage device are connected, it is further configured to perform:

[0213] If the aforementioned electronic device and the aforementioned storage device are not connected, the aforementioned boot program will be started.

[0214] In some possible embodiments, the program states of the above-mentioned electronic device are different, and the state values ​​corresponding to the jump flag bits are different.

[0215] This application also provides a computer storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform one or more steps of any of the above methods. If the constituent modules of the above-described program jump device are implemented as software functional units and sold or used as independent products, they can be stored in the storage medium.

[0216] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0217] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. Unless otherwise specified, the technical features of this embodiment and its implementation can be combined arbitrarily.

[0218] The embodiments described above are merely preferred embodiments of this application and are not intended to limit the scope of this application. Any modifications and improvements made by those skilled in the art to the technical solutions of this application without departing from the spirit of this application should fall within the protection scope defined by the claims of this application.

Claims

1. A method for program jump, characterized in that, The method is applied to an electronic device, and the method includes: After the bootloader starts, it obtains the status value of the jump flag; the jump flag is used to indicate the program status of the electronic device; the jump flag is obtained from the file corresponding to the bootloader. The status value of the jump flag is used to determine whether a jump to the application is possible. If the user can jump to the application, then the user jumps to the application and initializes the application to obtain the initialization result; the initialization result is used to determine whether the application can run normally.

2. The method as described in claim 1, characterized in that, The process of determining whether to jump to the application based on the status value of the jump flag includes: If the state value of the jump flag is a jumpable state value, it is determined that the electronic device can jump to the application; the jumpable state value is at least one state value of the jump flag corresponding to the electronic device being in a state where the application has been burned in and the application is not initialized or running normally.

3. The method as described in claim 2, characterized in that, If the state value of the jump flag belongs to the jumpable class state value and the state value of the jump flag is not the first state value, the method further includes the following steps before initializing the application: Update the status value of the jump flag to a second status value; the second status value is used to indicate the state of application initialization failure in the electronic device. After initializing the application and obtaining the initialization result, the method further includes: If the initialization result is successful, the status value of the jump flag will be updated from the second status value to the first status value. If the initialization result is an initialization failure, the state value of the jump flag will be maintained at the second state value; The first status value indicates that the application in the electronic device has been successfully initialized and is in a normal operating state.

4. The method as described in claim 2, characterized in that, After determining whether a jump to the application is possible based on the status value of the jump flag, the method further includes: If the user can be redirected to the application, the hardware identity information of the electronic device is matched with the valid hardware identity information corresponding to the application to obtain a matching result. Based on the matching results and the initialization results, it is determined whether the electronic device can run the application normally.

5. The method as described in claim 1, characterized in that, After determining whether a jump to the application is possible based on the status value of the jump flag, the method further includes: If the application cannot be redirected, the bootloader will continue running, or an error message or hardware detection message will be output.

6. The method as described in claim 5, characterized in that, The process of determining whether to jump to the application based on the status value of the jump flag includes: If the state value of the jump flag does not belong to the jumpable state value, it is determined that the electronic device cannot jump to the application; the jumpable state value is at least one state value of the jump flag corresponding to the electronic device being in a state where the application has been burned in and the application is not initialized or running normally. If the program cannot be redirected to the application, the bootloader will continue running, or an error message or hardware detection message will be output, including: If the application cannot be redirected, the bootloader will continue running if the status value of the jump flag does not belong to the jumpable class and the status value of the jump flag is not the initial status value; or, if the status value of the jump flag does not belong to the jumpable class and the status value of the jump flag is the initial status value, a program burning error message or a hardware detection message will be output. The initial state value is used to indicate that the electronic device is in a state where no boot program or application has been burned.

7. The method as described in claim 1, characterized in that, After the bootloader starts, before obtaining the status value of the jump flag, the method further includes: After the electronic device is powered on, it is detected whether the electronic device and the storage device are in a connected state; If the device is connected, the program to be burned is read from the storage device; the program to be burned includes the bootloader and / or application program to be burned. If the electronic device contains a pre-programmed program of the same type as the program to be programmed, then the pre-programmed program is erased, and the program to be programmed from the storage device is written into the corresponding storage area of ​​the electronic device. If there is no pre-programmed program of the same type as the program to be programmed in the electronic device, then the program to be programmed in the storage device is written into the corresponding storage area of ​​the electronic device.

8. The method as described in claim 7, characterized in that, The program to be burned includes the boot program to be burned; After writing the program to be programmed from the storage device into the corresponding storage area of ​​the electronic device, the method further includes: Based on the electronic device, obtain the application update command triggered by the user; In response to the application update instruction, the application to be updated is retrieved from the network or the local database of the electronic device; Update the application to be updated to the storage area corresponding to the electronic device.

9. The method as described in claim 7, characterized in that, After detecting whether the electronic device and the storage device are connected, the method further includes: If the electronic device and the storage device are not connected, the boot program is started.

10. An electronic device, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed as described in any one of claims 1-9.

Citation Information

Patent Citations

  • STM32 IAP based online program updating method

    CN106874049A

  • A method and a device for updating a Bootloader in an electronic control unit

    CN109933348A