Micro-control unit, chip and electronic equipment
By introducing a direct startup mechanism of marking characters and bootstrap programs into the microcontroller unit, the problem of interference with Bootloader initialization on application startup is solved, and the reliability and stability of the microcontroller unit is improved.
Patent Information
- Application Number
- CN202411931189.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-05-30
AI Technical Summary
The Bootloader of the microcontroller unit of the vehicle controller needs to initialize the MCU's peripheral resources before starting the application, which may interfere with the startup of the application, and the de-initialization operation is cumbersome and complicated and not universal.
A microcontroller unit is designed, including a boot program and a random access memory, which is configured to start an application, and the random access memory is used to write mark characters, which are used to instruct the boot program to start the application directly, avoiding initialization operations.
By determining whether the marker characters in the random access memory are preset values, the microcontroller unit can directly start the application, improving the reliability and stability of the microcontroller unit and avoiding the interference of the Bootloader on the application startup.
Smart Images

Figure CN120066592A_ABST
Abstract
Description
Technical Field
[0001] The embodiments disclosed in the present application relate to the field of electronic technologies, and more particularly, to a microcontroller unit, a chip, and an electronic device. Background Art
[0002] The bootloader of a microcontroller unit (MCU) for a vehicle controller is a software used to load and update application programs on an automotive electronic control unit (ECU). Before the bootloader starts the application program, it is necessary to perform an operation to initialize the MCU. However, this may interfere with the startup of the application program. Summary of the Invention
[0003] According to the embodiments of the present application, the present application provides a microcontroller unit, a chip, and an electronic device to solve the above problems.
[0004] The first aspect of the present application discloses a microcontroller unit, including: a bootloader configured to start an application program in the microcontroller unit; a random access memory configured to write a marker character; wherein the marker character is used to indicate that the bootloader starts the application program.
[0005] In some embodiments, in response to the microcontroller unit performing a soft reset, it is determined whether the marker character is a preset value, where the preset value is used to indicate that the bootloader directly starts the application program; in response to the marker character not being the preset value, the microcontroller unit is initialized; in response to the marker character being the preset value, the bootloader directly starts the application program.
[0006] In some embodiments, in response to the microcontroller unit being powered on, the microcontroller unit performs a reset operation; in response to the marker character not being the preset value and / or the reset operation not being a soft reset, the microcontroller unit is initialized, where the preset value is used to indicate that the bootloader directly starts the application program.
[0007] In some embodiments, the microcontroller unit performs an upgrade operation of the application program; and performs a soft reset of the microcontroller unit.
[0008] In some embodiments, the performing the upgrade operation of the application program includes: determining whether to perform the upgrade of the application program; wherein, in response to performing the upgrade of the application program, the application program is upgraded.
[0009] In some embodiments, performing a soft reset of the microcontroller unit includes: writing the marker character as the preset value; and in response to the marker character being written as the preset value, performing a soft reset of the microcontroller unit.
[0010] In some embodiments, in response to the marker character being the preset value, the microcontroller unit performs a clearing operation on the preset value.
[0011] In some embodiments, the microcontroller unit further includes a register for storing the entry address of the application program.
[0012] A second aspect of the present application discloses a chip including the microcontroller unit as described in the first aspect.
[0013] A third aspect of the present application discloses an electronic device including the microcontroller unit as described in the first aspect or the chip as described in the second aspect.
[0014] The beneficial effects of the present application are as follows: The microcontroller unit includes a bootloader and a random access memory. The bootloader is configured to start the application program in the microcontroller unit, and the random access memory is configured to write a marker character, which is used to indicate the bootloader to start the application program. Thus, the microcontroller unit can complete the corresponding application program startup process based on the marker character written in the random access memory, thereby improving the reliability and stability of the microcontroller unit. Description of the Drawings
[0015] The present application will be further described below in conjunction with the drawings and embodiments. In the drawings:
[0016] Figure 1 is a schematic structural diagram of the microcontroller unit according to an embodiment of the present application;
[0017] Figure 2 is a schematic structural diagram of the microcontroller unit according to an embodiment of the present application;
[0018] Figure 3 is a schematic flowchart of starting an application program according to an embodiment of the present application;
[0019] Figure 4 is a schematic structural diagram of the chip according to an embodiment of the present application;
[0020] Figure 5 is a schematic structural diagram of the electronic device according to an embodiment of the present application. Detailed Embodiments
[0021] References to "embodiments" in this application mean that the specific features, structures, or characteristics described in connection with the embodiments can be included in at least one embodiment of this application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0022] The term "and / or" in this application is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this text generally represents an "or" relationship between the associated objects before and after. In addition, "plurality" in this text means two or more than two. In addition, the term "at least one" in this application means any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set composed of A, B, and C. In addition, the terms "first", "second", and "third" in this application are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features.
[0023] For ease of understanding, a brief description of the conventional method for the Bootloader to start an application is given. In order to complete the task of starting and guiding the application or upgrading the application, the main program of the Bootloader needs to initialize the peripheral resources of the MCU. There is a time interval between when the Bootloader starts the application and when the application completes all necessary initialization work. During this interval, if the interrupts that have been initialized in the Bootloader may request interrupt responses at any time, but the interrupts of the application have not been configured yet, which will cause destructive interference to the startup of the application. Therefore, it is usually necessary to de-initialize all initialized peripheral resources before the Bootloader starts the application. The conventional method of de-initialization includes, before the Bootloader starts the application, designing the corresponding de-initialization operation code for all initialized MCU peripheral resources in the Bootloader to ensure that the application startup environment is not interfered by the Bootloader. However, implementing de-initialization by designing the corresponding de-initialization operation code requires studying and developing the de-initialization operations for each module one by one, which is cumbersome and complex and has low development efficiency. In addition, the de-initialization operations of different MCUs are different, making the corresponding de-initialization process not universal and portable.
[0024] Therefore, this application proposes a microcontroller unit, a chip, and an electronic device to solve the above problems.
[0025] To enable those skilled in the art to better understand the technical solution of this application, the technical solution of this application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0026] Please refer to Figure 1 , Figure 1 which is a schematic structural diagram of the microcontroller unit of the embodiment of this application. The microcontroller unit 100 includes a bootloader 110 and a random access memory 120.
[0027] The bootloader 110 is configured to start the application (APP, application) in the microcontroller unit 100. The bootloader 110 can be a Bootloader, which can be used to start the application in the microcontroller unit 100 or upgrade the application in the microcontroller unit 100.
[0028] The random access memory 120 is configured to write a marker character. The random access memory 120 can be a RAM (Random Access Memory), which can be used to temporarily store programs, data, and intermediate results. The random access memory 120 is configured to write a marker character, that is, store the marker character in the random access memory 120. The marker character can be a magic number, and the marker character is set to a specific marker to notify the subsequent executor through this specific marker.
[0029] Among them, the marker character written into the random access memory 120 is used to instruct the bootloader 110 to start the application. For example, based on the specific content of the marker character, the bootloader 110 can determine how to start the application. For example, the bootloader 110 does not perform initialization operations and directly starts the application.
[0030] In this embodiment, the microcontroller unit 100 includes a bootloader 110 and a random access memory 120. The bootloader 110 is configured to start the application in the microcontroller unit 100. The random access memory 120 is configured to write a marker character, and the marker character is used to instruct the bootloader 110 to start the application, so that the microcontroller unit 100 can complete the corresponding application startup based on the marker character written into the random access memory 120, thereby improving the reliability and stability of the microcontroller unit 100.
[0031] In some embodiments, in response to the microcontroller unit 100 performing a soft reset, it is judged whether the marker character is a preset value, where the preset value is used to instruct the bootloader 110 to directly start the application; in response to the marker character not being the preset value, the microcontroller unit 100 is initialized; in response to the marker character being the preset value, the bootloader 110 directly starts the application.
[0032] In some examples, in response to a software command or a reset instruction triggered by a control register, etc., the microcontroller unit 100 performs a soft reset to re-initialize the state of the microcontroller unit 100. Further, it is determined whether the marker character in the random access memory 120 is a preset value, where the preset value is used to indicate that the bootloader 110 directly starts the application program. For example, the preset value is 0X55AAAA55.
[0033] Wherein, in response to the marker character not being the preset value, the microcontroller unit 100 is initialized. For example, after the microcontroller unit 100 performs a soft reset operation, the marker character in the random access memory 120 is a random value and not equal to the preset value (for example, the above 0X55AAAA55), then the microcontroller unit 100 is initialized. For example, the CPU clock source, clock divider, communication interface, system bus timing, interrupt controller and other peripheral resources of the microcontroller unit 100 are initialized.
[0034] Alternatively, in response to the marker character being the preset value, the bootloader 110 directly starts the application program. For example, after the microcontroller unit 100 performs a soft reset operation, the marker character in the random access memory 120 is the preset value (for example, the above 0X55AAAA55), then the bootloader 110 directly starts the application program of the microcontroller unit 100, thereby entering the application program.
[0035] In this embodiment, in response to the microcontroller unit 100 performing a soft reset, it is determined whether the marker character is the preset value, where the preset value is used to indicate that the bootloader 110 directly starts the application program. If the marker character is not the preset value, the microcontroller unit 100 is initialized; if the marker character is the preset value, the bootloader 110 directly starts the application program, so that the microcontroller unit 100 can complete the corresponding application program startup process by performing a soft reset and determining whether the marker character written into the random access memory 120 is the preset value, improving the reliability and stability of the microcontroller unit 100.
[0036] In some embodiments, in response to the power-on of the microcontroller unit 100, the microcontroller unit 100 performs a power-on reset to perform a reset operation; in response to the marker character not being the preset value and / or the reset operation not being a soft reset, the microcontroller unit 100 is initialized, where the preset value is used to indicate that the bootloader 110 directly starts the application program.
[0037] In response to the power-on of the microcontroller unit 100, the microcontroller unit 100 performs a reset operation. For example, after the microcontroller unit 100 is connected to a stable power supply, the reset circuit in the microcontroller unit 100 is triggered to perform a power-on reset. Further, it is determined whether the marker character is the preset value and / or whether the current reset operation is a soft reset to determine whether to initialize the microcontroller unit 100.
[0038] In some examples, in response to the power-on of the microcontroller unit 100, the microcontroller unit 100 performs a reset operation, and in response to the marker character not being the preset value and / or the current reset operation not being a soft reset, the microcontroller unit 100 is initialized. Among them, the preset value is used to indicate that the bootloader 110 directly starts the application program. For example, the preset value is 0X55AAAA55, and the soft reset can refer to re-initializing the state of the microcontroller unit 100 through software instructions.
[0039] Among them, in response to the marker character not being the preset value or the reset operation not being a soft reset, the microcontroller unit 100 is initialized. For example, if the marker character in the random access memory 120 is not the preset value, the microcontroller unit 100 is initialized; or if it is determined that the current reset operation of the microcontroller unit 100 is not a soft reset, the microcontroller unit 100 is initialized; or if the marker character in the random access memory 120 is not the preset value and the current reset operation of the microcontroller unit 100 is not a soft reset, the microcontroller unit 100 is initialized; or if the marker character in the random access memory 120 is the preset value, but the current reset operation of the microcontroller unit 100 is not a soft reset, the microcontroller unit 100 is initialized.
[0040] In some examples, in response to the marker character not being the preset value and the reset operation not being a soft reset, the microcontroller unit 100 is initialized. For example, after the microcontroller unit 100 is power-on reset, the marker character in the random access memory 120 is a random value and not equal to the preset value (for example, the above 0X55AAAA55). At this time, the marker character is not the preset value and the current power-on reset of the microcontroller unit 100 does not belong to a soft reset, then the microcontroller unit 100 is initialized. For example, the peripheral resources of the microcontroller unit 100 such as the CPU clock source, clock divider, communication interface, system bus timing, and interrupt controller of the microcontroller unit 100 are initialized.
[0041] Or, in some examples, in response to the marker character being the preset value but the reset operation not being a soft reset, the microcontroller unit 100 is initialized. For example, after the microcontroller unit 100 is power-on reset, the marker character in the random access memory 120 is a random value and equal to the preset value (for example, the above 0X55AAAA55). At this time, the marker character is the preset value but the current power-on reset of the microcontroller unit 100 does not belong to a soft reset, then the microcontroller unit 100 is initialized. For example, the peripheral resources of the microcontroller unit 100 such as the CPU clock source, clock divider, communication interface, system bus timing, and interrupt controller of the microcontroller unit 100 are initialized.
[0042] In this embodiment, in response to the power-on of the microcontroller unit 100, the microcontroller unit 100 performs a reset operation. In response to the marker character not being the preset value and / or the reset operation not being a soft reset, the microcontroller unit 100 is initialized. Among them, when the microcontroller unit 100 performs a power-on reset, it can be determined that if the marker character in the random access memory 120 is not the preset value and / or the current reset operation of the microcontroller unit 100 is not a soft reset, and then the microcontroller unit 100 is initialized, so that the microcontroller unit 100 can complete the corresponding application program startup process by judging whether the marker character written into the random access memory 120 is the preset value and whether the current reset operation is a soft reset, improving the reliability and stability of the microcontroller unit 100.
[0043] It can be understood that in the embodiment of the present application, by judging whether the marker character is the preset value and / or whether the current reset operation is a soft reset, it is determined whether to initialize the microcontroller unit 100, avoiding the potential MagicNumber collision risk brought by the power-on reset, that is, the marker character in the random access memory 120 after the power-on reset is a random value, which may happen to be the same as the preset value. For example, if the marker character is the preset value but the current reset operation is not a soft reset, then the microcontroller unit 100 is initialized instead of directly entering the startup of the application program.
[0044] Further, in some embodiments, the initialized microcontroller unit 100 performs an upgrade operation of the application program; and performs a soft reset of the microcontroller unit 100.
[0045] In some examples, in response to the power-on of the microcontroller unit 100, the microcontroller unit 100 performs a reset operation. For example, after the microcontroller unit 100 is connected to a stable power supply, the reset circuit in the microcontroller unit 100 is triggered to perform a power-on reset. After determining that the marker character in the random access memory 120 is not the preset value or the current reset operation is not a soft reset, the microcontroller unit 100 is initialized. Further, the microcontroller unit 100 performs an upgrade operation of the application program and performs a soft reset of the microcontroller unit 100. Among them, performing the upgrade operation of the application program, such as judging whether it is necessary to perform the upgrade of the application program. Performing the soft reset of the microcontroller unit 100, such as the microcontroller unit 100 responds to the soft reset control instruction to perform a soft reset of the microcontroller unit 100, that is, re-initializes the state of the microcontroller unit 100, and then judges whether the marker character in the random access memory 120 is the preset value and whether the reset operation is a soft reset to determine whether it can directly enter the startup process of the application program.
[0046] In this embodiment, the microcontroller unit 100 performs the upgrade operation of the application program and the soft reset of the microcontroller unit 100. By using the reset timing function inherent in the hardware of the microcontroller unit 100 during the startup / upgrade process of the bootloader 110, the peripheral resources of the microcontroller unit 100 are automatically de-initialized, enabling the microcontroller unit 100 to directly start the application program based on the marker characters written in the random access memory 120, thereby improving the reliability and stability of the microcontroller unit 100.
[0047] In some embodiments, performing the upgrade operation of the application program includes: determining whether to perform the upgrade of the application program; wherein, in response to performing the upgrade of the application program, the application program is upgraded.
[0048] In some examples, in response to the power-on of the microcontroller unit 100, the microcontroller unit 100 performs a reset operation. For example, after the microcontroller unit 100 is connected to a stable power supply, the reset circuit in the microcontroller unit 100 is triggered to perform a power-on reset. After determining that the marker characters in the random access memory 120 are not the preset value or the current reset operation is not a soft reset, the microcontroller unit 100 is initialized. Further, the upgrade operation of the application program is performed. For example, it is determined whether the upgrade of the application program needs to be performed. If the determination result is that the upgrade of the application program needs to be performed, the application program in the microcontroller unit 100 is upgraded. If the determination result is that the upgrade of the application program does not need to be performed, the soft reset operation of the microcontroller unit 100 can be directly performed.
[0049] In this embodiment, in response to the power-on of the microcontroller unit 100, the microcontroller unit 100 performs a reset operation. In response to the marker characters in the random access memory 120 not being the preset value or the current reset operation not being a soft reset, the microcontroller unit 100 is initialized, and further, the upgrade operation of the application program is performed, enabling the microcontroller unit 100 to complete the corresponding application program startup by judging the marker characters written in the random access memory 120, thereby improving the reliability and stability of the microcontroller unit 100.
[0050] In some embodiments, performing the soft reset of the microcontroller unit 100 includes: writing the marker characters as the preset value; in response to the marker characters being written as the preset value, performing the soft reset of the microcontroller unit 100.
[0051] In some examples, in response to the power-on of the microcontroller unit 100, the microcontroller unit 100 performs a reset operation. For example, after the microcontroller unit 100 is connected to a stable power supply, the reset circuit in the microcontroller unit 100 is triggered to perform a power-on reset. After determining that the marker character in the random access memory 120 is not the preset value or the current reset operation is not a soft reset, the microcontroller unit 100 is initialized. Further, an upgrade operation of the application program is performed, and a soft reset of the microcontroller unit 100 is performed.
[0052] Among them, after the upgrade operation of the corresponding application program is completed, the marker character is written as the preset value. For example, the random value stored in the random access memory 120 after the power-on reset is modified to the preset value, such as the above 0X55AAAA55. Further, in response to the marker character being written as the preset value, a soft reset of the microcontroller unit 100 is performed. For example, the microcontroller unit 100 performs a soft reset of the microcontroller unit 100 in response to a soft reset control instruction, that is, re-initializes the state of the microcontroller unit 100, and then determines whether the marker character in the random access memory 120 is the preset value and whether the reset operation is a soft reset to determine whether the startup process of the application program can be directly entered.
[0053] In the embodiment of the present application, the initialization of the microcontroller unit 100 to perform the upgrade operation of the application program and the soft reset of the microcontroller unit 100 are achieved by performing a soft reset operation of the microcontroller unit 100 during the process of the bootloader 110 starting / upgrading the application program, and using the reset timing function built into the hardware of the microcontroller unit 100 to automatically de-initialize the peripheral resources of the microcontroller unit 100, so that the microcontroller unit 100 can complete the startup of the corresponding application program based on the marker character written in the random access memory 120, thereby improving the reliability and stability of the microcontroller unit 100.
[0054] In some embodiments, in response to the marker character being the preset value, the microcontroller unit 100 performs a clearing operation on the preset value.
[0055] For example, the microcontroller unit 100 performs a soft reset and determines whether the marker character in the random access memory 120 is the preset value. In response to the marker character being the preset value, the microcontroller unit 100 performs a clearing operation on the preset value.
[0056] Alternatively, the microcontroller unit 100 performs a reset operation, determines whether the marker character in the random access memory 120 is the preset value and whether the current reset operation is a soft reset. In response to the marker character being the preset value and the current reset operation being a soft reset, the microcontroller unit 100 performs a clearing operation on the preset value.
[0057] Understandably, the microcontroller unit 100 performs a clearing operation on the preset value to prevent the bootloader 110 from failing to correctly enter the upgrade process of the bootloader 110 when the subsequent application software reset request is upgraded. That is, after determining whether the marker character is the preset value and whether the reset operation is a software reset, it enters the upgrade process of the application.
[0058] In this embodiment, in response to the marker character being the preset value, the microcontroller unit 100 performs a clearing operation on the preset value to prevent the bootloader 110 from failing to correctly enter the upgrade process when the subsequent application software reset request is upgraded, improving the reliability and stability of the microcontroller unit 100.
[0059] In some embodiments, as Figure 2 shown, Figure 2 FIG. is a schematic structural diagram of a microcontroller unit according to an embodiment of the present application. The microcontroller unit 100 not only includes a bootloader 110 and a random access memory 120, but also includes a register 130 for storing the application entry address.
[0060] The register 130 can be a PC register (Program Counter), and the register 130 is connected to the processor of the microcontroller unit 100, enabling the processor of the microcontroller unit 100 to read instructions from the register 130 and update the value of the register 130 to point to the next instruction after execution.
[0061] In some examples, the register 130 is used to store the application entry address. For example, after the microcontroller unit 100 performs a software reset and the marker character in the random access memory 120 is the preset value, the microcontroller unit 100 performs a clearing operation on the preset value and jumps to the application, that is, sets the value of the register 130 to the application entry address, so that the microcontroller unit 100 enters the application entry to start executing the application.
[0062] In this embodiment, after the microcontroller unit 100 performs a software reset, in response to the marker character being the preset value, it can directly jump to the application entry address stored in the register 130, realizing not starting the application program in the main program of the bootloader 110, thereby improving the reliability and stability of the microcontroller unit 100.
[0063] For ease of understanding, in combination with the above microcontroller unit 100, an example of starting the application program in the embodiment of the present application is given, as Figure 3 shown, Figure 3 is a schematic flowchart of starting the application program according to an embodiment of the present application.
[0064] S31: The microcontroller unit is powered on.
[0065] In response to the power-on of the microcontroller unit 100, the microcontroller unit 100 performs a reset operation. For example, after the microcontroller unit 100 is connected to a stable power supply, the reset circuit in the microcontroller unit 100 is triggered to perform a power-on reset.
[0066] S32: Determine whether the marker character is a preset value and whether the reset operation is a soft reset.
[0067] Determine whether the marker character in the random access memory 120 is a preset value and whether the current reset operation is a soft reset. Here, the preset value is used to indicate that the bootloader 110 directly starts the application program. For example, the preset value is 0X55AAAA55. A soft reset may refer to making the microcontroller unit 100 re-initialize its state through software instructions.
[0068] One of the judgment results of S32: If the marker character is not the preset value or the reset operation is not a soft reset, then execute step S33.
[0069] The second judgment result of S32: If the marker character is the preset value and the reset operation is a soft reset, then execute step S38.
[0070] S33: Initialize the microcontroller unit.
[0071] In response to the marker character not being the preset value or the reset operation not being a soft reset, initialize the microcontroller unit 100. For example, if the marker character in the random access memory 120 is not the preset value, then initialize the microcontroller unit 100; or if the marker character in the random access memory 120 is the preset value but the current reset operation of the microcontroller unit 100 is not a soft reset, then initialize the microcontroller unit 100.
[0072] For example, initialize the CPU clock source, clock divider, communication interface, system bus timing, interrupt controller and other peripheral resources of the microcontroller unit 100.
[0073] S34: Determine whether to perform an upgrade of the application program. That is, determine whether an upgrade of the application program is required.
[0074] One of the judgment results of S34: If an upgrade of the application program is required, execute step S35.
[0075] The second judgment result of S34: If an upgrade of the application program is not required, execute step S36.
[0076] S35: Upgrade the application program.
[0077] In response to the need to perform an upgrade of the application program, upgrade the application program.
[0078] S36: Write the marked character as a preset value.
[0079] After completing the judgment on the upgrade operation of the corresponding application, write the marked character as a preset value. For example, modify the random value stored in the random access memory 120 after power-on reset to the preset value.
[0080] S37: Perform a soft reset of the microcontroller unit.
[0081] For example, in response to the soft reset control instruction, perform a soft reset of the microcontroller unit 100 to determine again whether the marked character in the random access memory 120 is the preset value and whether the reset operation is a soft reset.
[0082] S38: Perform a clearing operation on the preset value.
[0083] In response to the marked character being the preset value and the current reset operation being a soft reset, the microcontroller unit 100 performs a clearing operation on the preset value.
[0084] S39: Jump to the application entry address.
[0085] For example, set the value of the register 130 to the entry address of the application.
[0086] S40: Enter the application.
[0087] The microcontroller unit 100 enters the application entry and completes the startup of the application.
[0088] Please refer to Figure 4 , Figure 4 is a schematic structural diagram of the chip according to an embodiment of the present application. The chip 400 includes the above-mentioned microcontroller unit 100. Among them, the microcontroller unit 100 includes a boot program 110 and a random access memory 120. The boot program 110 is configured to start the application in the microcontroller unit 100. The random access memory 120 is configured to write a marked character, and the marked character is used to indicate that the boot program 110 starts the application, so that the microcontroller unit 100 can complete the corresponding application startup based on the marked character written in the random access memory 120, improving the reliability and stability of the microcontroller unit 100. Correspondingly, the reliability and stability of the chip 400 are improved.
[0089] Please refer to Figure 5 , Figure 5 is a schematic structural diagram of the electronic device according to an embodiment of the present application. As shown in (a) of Figure 5 , the electronic device 500 includes the above-mentioned microcontroller unit 100, or as shown in Figure 5As shown in (b) of , the electronic device 500 includes the above-mentioned chip 400. Among them, the microcontroller unit 100 includes a bootloader 110 and a random access memory 120. The bootloader 110 is configured to start the application program in the microcontroller unit 100, and the random access memory 120 is configured to write a marker character, which is used to indicate that the bootloader 110 starts the application program, so that the microcontroller unit 100 can complete the corresponding application program startup based on the marker character written in the random access memory 120, improving the reliability and stability of the microcontroller unit 100. Correspondingly, the reliability and stability of the electronic device 500 are improved. The electronic device 500 may include, but is not limited to: in-vehicle devices, microcomputers, servers, which are not limited herein.
[0090] Those skilled in the art can understand that in the above method of the specific implementation manner, the writing order of each step does not mean a strict execution order and does not constitute any limitation to the implementation process. The specific execution order of each step should be determined according to its function and possible internal logic.
[0091] The above descriptions of the various embodiments tend to emphasize the differences between the various embodiments. Their similarities or similarities can be referred to each other. For the sake of brevity, they will not be repeated herein.
[0092] In several embodiments provided in the present application, it should be understood that the disclosed methods and related devices can be implemented in other ways. For example, the above-described related device embodiments are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication disconnection between each other can be through some interfaces. The indirect coupling or communication disconnection of devices or units can be in electrical, mechanical or other forms.
[0093] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0094] When an integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.
[0095] Those skilled in the art will readily appreciate that many modifications and variations can be made to the apparatus and methods while maintaining the teachings of this application. Accordingly, the foregoing disclosure should be considered as being limited only by the scope of the appended claims.
Claims
1. A micro control unit, characterized in that: include: A boot program, configured to start an application program in the micro control unit; a random access memory configured to write a tag character; The marking character is used to instruct the boot program to start the application.
2. The micro control unit according to claim 1, characterized in that: In response to the microcontroller executing a soft reset, determining whether the marking character is a preset value, wherein the preset value is used to instruct the boot program to directly start the application program; In response to the marking character not being the preset value, initializing the micro control unit; In response to the marking character being the preset value, the boot program directly starts the application program.
3. The micro control unit according to claim 1, characterized in that: In response to the micro control unit being powered on, the micro control unit performs a reset operation; In response to the mark character not being a preset value and / or the reset operation not being a soft reset, the micro control unit is initialized, wherein the preset value is used to instruct the boot program to directly start the application program.
4. The micro control unit according to claim 2 or 3, characterized in that: The micro control unit executes an upgrade operation of the application program; and A soft reset of the microcontroller unit is performed.
5. The micro control unit according to claim 4, characterized in that: The step of executing the upgrade operation of the application program includes: Determining whether to execute an upgrade of the application; In which, in response to executing the upgrade of the application, the application is upgraded.
6. The micro control unit according to claim 4, characterized in that: The performing of soft resetting of the microcontroller unit comprises: Writing the marking character as the preset value; In response to the mark character being written as the preset value, a soft reset of the micro control unit is performed.
7. The micro control unit according to claim 2, characterized in that: In response to the mark character being the preset value, the micro control unit performs a clearing operation on the preset value.
8. The micro control unit according to claim 1, characterized in that: The micro control unit also includes a register, and the register is used to store the entry address of the application program.
9. A chip, characterized in that: The method comprises a micro control unit as claimed in any one of claims 1 to 8.
10. An electronic device, characterized in that: It comprises the micro control unit according to any one of claims 1 to 8 or the chip according to claim 9.