Serial port log management method and system and storage medium

By generating debugging keys based on product serial numbers and using multi-level management with hash functions, the system fulfills the dual requirements of domain controller serial port log security and after-sales problem analysis, solving the problems of information security and after-sales analysis difficulties in traditional solutions.

CN121786900APending Publication Date: 2026-04-03HUIZHOU DESAY SV AUTOMOTIVE
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-27
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Traditional domain controller serial port log management solutions cannot simultaneously meet the dual needs of information security and after-sales problem analysis in the era of intelligent assisted driving vehicles. Completely closing the serial port makes after-sales analysis difficult, while completely opening it cannot guarantee information security.

Method used

A debug key is generated based on the product serial number of the microcontroller. This key is combined with a random salt value and a hash function to generate the first key data. The input and output of the log level are controlled through a multi-level management system, ensuring that only authorized personnel or devices with the correct key can obtain critical information.

Benefits of technology

It effectively prevents external personnel from arbitrarily obtaining and tampering with serial port log information, improves information security, and solves the problem of difficult after-sales analysis by obtaining key information through the correct key when problems occur.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121786900A_ABST
    Figure CN121786900A_ABST
Patent Text Reader

Abstract

The invention provides a serial port log management method and system and a storage medium. The serial port log management method comprises the following steps: generating a debugging key based on a product serial number of a microcontroller, and generating first key data based on the debugging key, so as to store the first key data and an initial log level into a target memory; receiving serial port information, and reading the initial log level and the first key data from the target memory; wherein the serial port information at least comprises second key data and a target log level; and performing verification based on the second key data and the first key data, and when the verification is passed, storing the target log level into a target memory. According to the application, external personnel can be effectively prevented from randomly acquiring and tampering the serial port log information, and the microcontroller has a unique debugging key, so that the information security is greatly improved; in addition, after-sales personnel can obtain the required key information through the correct secret key to carry out problem analysis, and the problem that after-sales problems are difficult to analyze is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information security technology, and in particular to a serial port log management method, system and storage medium. Background Technology

[0002] In a vehicle's various systems, the domain controller is responsible for coordinating and managing the operation of multiple subsystems to ensure the vehicle's safety, stability, and high efficiency. The microcontroller's serial port within the domain controller outputs a wealth of critical information (such as power-on configuration error messages), which helps engineers quickly pinpoint problems. However, this critical information also contains sensitive vehicle data and technical details, and its exposure to external personnel could pose serious information security risks.

[0003] However, traditional serial port log management solutions have significant limitations. Current solutions typically employ two extreme approaches: complete shutdown or complete opening. While completely shutting down the serial port effectively prevents information leakage, it also introduces significant difficulties in analyzing after-sales issues. Conversely, while fully opening the serial port allows after-sales personnel to quickly obtain crucial information and perform rapid problem analysis and resolution when issues arise, it compromises information security.

[0004] In summary, traditional domain controller serial port log management solutions can no longer meet the dual needs of information security and after-sales problem analysis in the era of intelligent assisted driving vehicles. Summary of the Invention

[0005] To address the aforementioned technical issues, this application provides a serial port log management method, system, and storage medium that can meet the dual needs of information security and after-sales problem analysis in the era of intelligent assisted driving vehicles.

[0006] Specifically, this application provides a serial port log management method, including the following steps: generating a debugging key based on the microcontroller's product serial number, and generating first key data based on the debugging key, so as to store the first key data and an initial log level in a target memory; receiving serial port information, and reading the initial log level and the first key data from the target memory; wherein the serial port information includes at least second key data and a target log level; performing verification based on the second key data and the first key data, so that when the verification passes, the target log level is stored in the target memory.

[0007] In the above technical solution, only authorized personnel or devices with the correct key can perform relevant operations on log management, effectively preventing external personnel from arbitrarily obtaining and tampering with serial port log information, thus greatly improving information security. By storing the initial log level and first key data, the log level can be adjusted according to authorization when needed. When after-sales problems occur, after-sales personnel can use the correct key to send serial port information containing the target log level. After successful verification, the log level is updated, thereby obtaining the necessary key information for problem analysis, solving the problem of difficulty in after-sales problem analysis. In addition, the debugging key is generated based on the product serial number, so that each microcontroller has its own unique debugging key, further ensuring information security.

[0008] Furthermore, the first key data includes at least a random salt value and a first hash value; generating the first key data based on the debugging key includes: generating a random salt value based on the debugging key, so as to generate a first hash value according to the random salt value and the debugging key.

[0009] In the above technical solution, the addition of a random salt ensures that even if different microcontrollers use the same debugging key, the generated first hash value will be different. This increases the complexity and uniqueness of the key data, effectively preventing attackers from cracking the system by pre-compiling hash values ​​of common keys. For example, without a random salt, attackers might try to obtain the debugging key through brute force or rainbow tables; however, with a random salt, each device's hash value is unique, greatly increasing the difficulty of cracking and further ensuring information security.

[0010] Furthermore, after reading the initial log level from the target memory, the method further includes setting the input / output enable for the initial log level.

[0011] In the above technical solution, after reading the initial log level from the target memory, its input and output enable is set. This allows the system to flexibly control the input and output of the initial log level according to actual needs. For example, in some cases, it may only be necessary to receive log information without outputting it, or only specific devices or users may be allowed to input logs. Through this setting, the flow of log information can be managed more accurately, unnecessary information transmission and leakage can be avoided, and the utilization efficiency of system resources can also be improved.

[0012] Furthermore, the verification based on the second key data and the first key data includes: generating a second hash value based on the second key data and a random salt value, and comparing the first hash value and the second hash value. If they are the same, the verification is deemed successful; otherwise, the verification fails.

[0013] In the above technical solution, the hash function has one-way and uniqueness, that is, the same input will produce the same output, and different inputs will produce different outputs. By comparing hash values ​​instead of directly comparing the key itself, the risk of the key being leaked during transmission and verification is avoided. Even if an attacker intercepts the second key data and the random salt value, they will not be able to deduce the original key from the hash value and will not be able to obtain access to the system, which further enhances the security of key verification.

[0014] Furthermore, after storing the target log level in the target memory, the method further includes setting the input / output enable for the target log level.

[0015] In the above technical solution, after storing the target log level in the target memory, its input and output enablement is also set. This allows the input and output of log information to be adjusted according to new needs after the log level is updated. For example, when troubleshooting, it may be necessary to temporarily increase the level of detail in the log output. However, after the problem is solved, the log output enablement can be adjusted in a timely manner to reduce the risk of information leakage and system resource consumption. This dynamic setting method enhances the flexibility and adaptability of log management and can better meet the usage needs in different scenarios.

[0016] Based on the same concept, this application also provides a serial port log management system, the system comprising: a key generation module for generating a debugging key based on the product serial number of a microcontroller; a microcontroller key injection module for generating first key data based on the debugging key, so as to store the first key data and an initial log level in a target memory; a microcontroller serial port module for receiving serial port information and reading the initial log level and the first key data from the target memory; wherein the serial port information includes at least second key data and a target log level; and a verification based on the second key data and the first key data, so that when the verification passes, the target log level is stored in the target memory.

[0017] In the above technical solution, multi-level management is achieved through the collaboration of the key generation module, the microcontroller key injection module, and the microcontroller serial port module. This multi-level management method ensures the security of serial port log information and also enables the correct key to be used to obtain key information based on the stored initial log level and first key data when after-sales problems occur, thereby solving the problem of difficulty in analyzing after-sales problems.

[0018] Furthermore, the microcontroller serial port module is also used to set the input / output enable for the initial log level and the target log level.

[0019] In the above technical solution, the microcontroller serial port module is not only responsible for receiving serial port information, performing key verification and updating log levels, but also for setting the input and output enable of the initial log level and the target log level. Combined with the serial port information containing the target log level sent by the external serial port device, the system can flexibly adjust the log level according to actual needs, and realize fine management of serial port log information.

[0020] Furthermore, the system also includes a host computer key injection module, used to send the debugging key and the initial log level to the microcontroller key injection module.

[0021] Furthermore, the system also includes an external serial port device for sending the serial port information to the microcontroller serial port module.

[0022] In the above technical solution, the system introduces an external serial port device, which can send serial port information containing the second key data and the target log level to the microcontroller serial port module. This allows the system to interact with external debugging devices or tools, making it convenient for after-sales personnel or developers to obtain key information for problem analysis when needed.

[0023] Based on the same concept, this application also provides a storage medium storing a computer program, wherein the computer program is configured to execute the serial port log management method at runtime.

[0024] Compared with the prior art, the beneficial effects of this application are as follows: This application can effectively prevent external personnel from arbitrarily obtaining and tampering with serial port log information, and the microcontroller has a unique debugging key, which greatly improves information security; in addition, after-sales personnel can obtain the necessary key information for problem analysis through the correct key, which solves the problem of difficulty in after-sales problem analysis. Attached Figure Description

[0025] Figure 1 This is a flowchart of the serial port log management method described in this application.

[0026] Figure 2 This is a timing diagram of the key injection described in this application.

[0027] Figure 3 This is a timing diagram for modifying the microcontroller log level as described in this application.

[0028] Figure 4 This is a framework diagram of the serial port log management system described in this application. Detailed Implementation

[0029] The following describes in further detail a serial port log management method, system, and storage medium of this application with reference to specific embodiments and accompanying drawings.

[0030] Please see Figure 1 This application provides a serial port log management method, including the following steps S100-S300.

[0031] In one feasible implementation, when a domain controller MCU (Microcontroller Unit) completes production and is ready to be rolled off the production line, the system performs some initialization operations. Each domain controller MCU is equipped with a unique identification code SN (microcontroller product serial number). Using this unique identification code SN, a corresponding debugging key is generated through a specific encryption algorithm. At the same time, the initial log level of the domain controller MCU is set to 00 to indicate that log input and output are disabled to avoid information leakage. After the debugging key and initial log level are set, they are injected into the target memory of the microcontroller. Furthermore, when a vehicle encounters problems during use and requires after-sales analysis, after-sales personnel can use an external serial port device to connect to the domain control MCU via a specific communication protocol. During the connection process, the external serial port device will input the UART key (generated based on the unique identification code SN, which has the same generation logic and encryption rules as the previously generated debugging key) and modify the log level to 11 (indicating input / output enable). At this time, the domain control MCU will begin recording detailed log information during system operation, including various sensor data, control command execution status, system status changes, etc. Finally, the domain control MCU will update the modified log level to the target memory so that it continues to run at log level 11 during the after-sales analysis process to collect sufficient log information.

[0032] Step S100: Generate a debugging key based on the microcontroller's product serial number, and generate first key data based on the debugging key, so as to store the first key data and the initial log level into the target memory.

[0033] The first key data includes at least a random salt value and a first hash value; generating the first key data based on the debugging key includes: generating a random salt value based on the debugging key, and generating a first hash value according to the random salt value and the debugging key.

[0034] In some embodiments, the serial port log management method is mainly implemented through a product host computer, a microcontroller, and an external serial port device. The product host computer includes a key generation module and a host computer key injection module, and the microcontroller is equipped with at least a microcontroller key injection module and a microcontroller serial port module.

[0035] For details, please see Figure 2 The system provides a key injection timing diagram; wherein, the key generation module receives the microcontroller's product serial number (SN) to generate a debug key; further, it uses PBKDF2 (Password-BasedKey Derivation Function 2) in conjunction with a hash function (such as SHA-256) as a key derivation function; wherein, the algorithm parameters are defined as follows: Password: 20 bytes of fixed data, pre-set inside the module, no input required; Salt: 16 bytes of product serial number, a unique identifier; Iteration count: set to 100,000 times, large enough to ensure security; Key length: the length of the output key in bytes, set to 32 bytes; Hash function: usually SHA-256.

[0036] Furthermore, the host computer key injection module is responsible for sending the Debug Key generated by the key generation module to the microcontroller key injection module via Ethernet. After receiving the Debug Key, the microcontroller key injection module will return the injection result to the host computer key injection module via Ethernet. The microcontroller key injection module generates a random number salt (i.e., the random salt value) based on the received Debug Key. Then, it uses the SHA-256 algorithm to generate a sha256hash value (i.e., the first hash value) based on the Debug Key and the random salt value. Finally, it stores the sha256hash value, the random salt value, and the initial log level (00) into the target memory.

[0037] The target memory is preferably NVM (Non-Volatile Memory), which is a type of non-volatile memory that retains stored data even after the power is turned off. Common non-volatile memories include flash memory, read-only memory (ROM), and EEPROM (Electrically Erasable Programmable Read-Only Memory).

[0038] It should also be noted that the initial log level is 00 by default, which means that input and output are disabled to protect user privacy and vehicle safety information.

[0039] In the above technical solution, the addition of a random salt ensures that even if different microcontrollers use the same debugging key, the generated first hash value will be different. This increases the complexity and uniqueness of the key data, effectively preventing attackers from cracking the system by pre-compiling hash values ​​of common keys. For example, without a random salt, attackers might try to obtain the debugging key through brute force or rainbow tables; however, with a random salt, each device's hash value is unique, greatly increasing the difficulty of cracking and further ensuring information security.

[0040] Step S200: Receive serial port information and read the initial log level and first key data from the target memory; wherein the serial port information includes at least the second key data and the target log level.

[0041] After reading the initial log level from the target memory, the method further includes setting the input / output enable for the initial log level.

[0042] In some embodiments, see Figure 3 The system provides a timing diagram for log level modification. In this process, an external serial port device sends serial port information to the microcontroller's serial port module. The microcontroller's serial port module then reads the initial log level from the target memory and sets the input / output enable for the initial log level. At this time, the initial log level is modified based on the target log level in the serial port information, such as setting it to 11.

[0043] Furthermore, the protocol positioning of the serial port information is: password xxxx yy; where password represents the command to modify the log level, xxxx represents the second key data, and yy represents the target log level, which includes 2 bits of data. The first bit represents the input enable state, and the second bit represents the output enable state. 1 indicates enable, and 0 indicates disable.

[0044] Such as password aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899 11.

[0045] In the above technical solution, after reading the initial log level from the target memory, its input and output enable is set. This allows the system to flexibly control the input and output of the initial log level according to actual needs. For example, in some cases, it may only be necessary to receive log information without outputting it, or only specific devices or users may be allowed to input logs. Through this setting, the flow of log information can be managed more accurately, unnecessary information transmission and leakage can be avoided, and the utilization efficiency of system resources can also be improved.

[0046] Step S300: Verify based on the second key data and the first key data, so that when the verification passes, the target log level is stored in the target memory.

[0047] The verification based on the second key data and the first key data includes: generating a second hash value based on the second key data and a random salt value, and comparing the first hash value and the second hash value. If they are the same, the verification is deemed successful; otherwise, the verification fails.

[0048] In some embodiments, the microcontroller serial port module reads a SHA256 hash value from the target memory and names it hash1, and reads a random salt value; further, it parses the serial port information to obtain the UART key (i.e., the second key data); then, it uses the SHA-256 algorithm to calculate a SHA256 hash value based on the UART key and the random salt value as hash2 (i.e., the second hash value).

[0049] In this embodiment, the key length of the UART key is the same as that of the debugging key above, which is set to 32 bytes.

[0050] Furthermore, hash1 and hash2 are compared. If they are the same, the verification passes; otherwise, the verification fails and the log level cannot be changed.

[0051] In the above technical solution, the hash function has one-way and uniqueness, that is, the same input will produce the same output, and different inputs will produce different outputs. By comparing hash values ​​instead of directly comparing the key itself, the risk of the key being leaked during transmission and verification is avoided. Even if an attacker intercepts the second key data and the random salt value, they will not be able to deduce the original key from the hash value and will not be able to obtain access to the system, which further enhances the security of key verification.

[0052] Furthermore, after storing the target log level in the target memory, the method further includes setting the input / output enable for the target log level.

[0053] In some embodiments, after the hash value verification is successful, the new log level (i.e. the target log level) is stored in the target memory, and the corresponding input / output enable is set.

[0054] In the above technical solution, after storing the target log level in the target memory, its input and output enablement is also set. This allows the input and output of log information to be adjusted according to new needs after the log level is updated. For example, when troubleshooting, it may be necessary to temporarily increase the level of detail in the log output. However, after the problem is solved, the log output enablement can be adjusted in a timely manner to reduce the risk of information leakage and system resource consumption. This dynamic setting method enhances the flexibility and adaptability of log management and can better meet the usage needs in different scenarios.

[0055] In summary, the serial port log management method described in this application ensures that only authorized personnel or devices with the correct key can perform related operations on the log management, effectively preventing external personnel from arbitrarily obtaining and tampering with serial port log information, thus greatly improving information security. By storing the initial log level and first key data, the log level can be adjusted according to authorization when needed. When after-sales problems occur, after-sales personnel can use the correct key to send serial port information containing the target log level. After successful verification, the log level is updated, thereby obtaining the necessary key information for problem analysis, solving the problem of difficulty in after-sales problem analysis. In addition, the debugging key is generated based on the product serial number, ensuring that each microcontroller has its own unique debugging key, further guaranteeing information security.

[0056] Based on the same concept, please refer to Figure 4 This application also provides a serial port log management system, the system comprising: a key generation module for generating a debugging key based on the product serial number of a microcontroller; a microcontroller key injection module for generating first key data based on the debugging key, so as to store the first key data and an initial log level in a target memory; a microcontroller serial port module for receiving serial port information and reading the initial log level and the first key data from the target memory; wherein the serial port information includes at least second key data and a target log level; and a verification based on the second key data and the first key data, so that when the verification passes, the target log level is stored in the target memory.

[0057] In the above technical solution, multi-level management is achieved through the collaboration of the key generation module, the microcontroller key injection module, and the microcontroller serial port module. This multi-level management method ensures the security of serial port log information and also enables the correct key to be used to obtain key information based on the stored initial log level and first key data when after-sales problems occur, thereby solving the problem of difficulty in analyzing after-sales problems.

[0058] Furthermore, the microcontroller serial port module is also used to set the input / output enable for the initial log level and the target log level.

[0059] In the above technical solution, the microcontroller serial port module is not only responsible for receiving serial port information, performing key verification and updating log levels, but also for setting the input and output enable of the initial log level and the target log level. Combined with the serial port information containing the target log level sent by the external serial port device, the system can flexibly adjust the log level according to actual needs, and realize fine management of serial port log information.

[0060] Furthermore, the system also includes a host computer key injection module, used to send the debugging key and the initial log level to the microcontroller key injection module.

[0061] Furthermore, the system also includes an external serial port device for sending the serial port information to the microcontroller serial port module.

[0062] In some embodiments, the system mainly includes three subsystems: a key generation system, a key injection system, and a microcontroller serial port management system; wherein, the key generation system includes a key generation module, the key injection system includes a host computer key injection module and a microcontroller key injection module, and the microcontroller serial port management system includes a microcontroller serial port module.

[0063] Specifically, the key generation module generates a debug key based on the microcontroller's product serial number and sends the debug key to the microcontroller key injection module via Ethernet through the host computer key injection module. Simultaneously, the microcontroller injection module returns the injection result to the host computer key injection module via Ethernet to notify successful key injection. Further, the microcontroller key injection module generates a random salt value based on the received debug key and uses the SHA-256 algorithm to generate a first hash value based on the debug key and the random salt value. The first hash value, the random salt value, and the initial log level are then stored in the target memory. The initial log level is sent by the host computer key injection module along with the debug key to the microcontroller key injection module; it is typically 00 to indicate that input / output is disabled.

[0064] Furthermore, the external serial port device sends serial port information to the microcontroller's serial port module. The microcontroller's serial port module then reads the initial log level from the target memory and sets the input / output enable of the initial log level based on the target log level in the serial port information, such as setting it to 11 to indicate input / output enable. Further, the microcontroller's serial port module reads the first hash value and random salt value from the target memory and obtains the second key data based on the serial port information. Using the SHA-256 algorithm, it calculates the second hash value based on the second key data and the random salt value. The first hash value and the second hash value are then compared to determine if they match. If they match, the verification passes, and the new log level can be stored in the target memory. This enables the microcontroller's log module to perform input / output, facilitating after-sales problem analysis.

[0065] Here, after storing the target log level in the target memory, the corresponding input / output enable is further set to further control the flow of log data and prevent unauthorized information access and leakage.

[0066] In the above technical solution, the system introduces an external serial port device, which can send serial port information containing the second key data and the target log level to the microcontroller serial port module. This allows the system to interact with external debugging devices or tools, making it convenient for after-sales personnel or developers to obtain key information for problem analysis when needed.

[0067] Based on the same concept, this application also provides a storage medium storing a computer program, wherein the computer program is configured to execute the serial port log management method at runtime.

[0068] In some embodiments, the storage medium stores a plurality of computer programs to cause a device to perform all or part of the steps of the methods described in the various embodiments of this application. The medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory, a random access memory, a magnetic disk, or an optical disk.

[0069] Although exemplary embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above exemplary embodiments are merely illustrative and are not intended to limit the scope of this application. Various changes and modifications can be made therein by those skilled in the art without departing from the scope and spirit of this application. All such changes and modifications are intended to be included within the scope of this application as claimed in the appended claims.

[0070] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0071] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed.

[0072] The various component embodiments of this application can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some modules according to the embodiments of this application. This application can also be implemented as an apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such an implementation of this application can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0073] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0074] Although the description of this application has been made in conjunction with the specific embodiments described above, it will be apparent to those skilled in the art that many substitutions, modifications, and variations can be made based on the foregoing. Therefore, all such substitutions, modifications, and variations are included within the spirit and scope of the appended claims.

Claims

1. A serial port log management method, characterized in that, Includes the following steps: A debug key is generated based on the product serial number of the microcontroller, and first key data is generated based on the debug key, so as to store the first key data and the initial log level into the target memory; Receive serial port information and read the initial log level and first key data from the target memory; wherein, the serial port information includes at least second key data and target log level; In addition, a verification is performed based on the second key data and the first key data, so that when the verification passes, the target log level is stored in the target memory.

2. The serial port log management method according to claim 1, characterized in that, The first key data includes at least a random salt value and a first hash value; The generation of the first key data based on the debugging key includes: A random salt value is generated based on the debugging key, and a first hash value is generated based on the random salt value and the debugging key.

3. The serial port log management method according to claim 1, characterized in that, After reading the initial log level from the target storage, the process also includes: Configure the input / output enable for the initial log level.

4. The serial port log management method according to claim 2, characterized in that, The verification based on the second key data and the first key data includes: A second hash value is generated based on the second key data and the random salt value. The first hash value and the second hash value are compared. If they are the same, the verification is deemed to have passed; otherwise, the verification fails.

5. The serial port log management method according to claim 1, characterized in that, After storing the target log level in the target storage, the method further includes: Configure the input / output enable for the target log level.

6. A system employing the serial port log management method as described in any one of claims 1-5, characterized in that, The system includes: The key generation module is used to generate debugging keys based on the microcontroller's product serial number; A microcontroller key injection module is used to generate first key data based on the debug key, and to store the first key data and the initial log level into the target memory; A microcontroller serial port module is used to receive serial port information and read an initial log level and a first key data from the target memory; wherein the serial port information includes at least a second key data and a target log level; and to perform verification based on the second key data and the first key data, so that when the verification passes, the target log level is stored in the target memory.

7. The system according to claim 6, characterized in that, The microcontroller serial port module is also used to set the input / output enable for the initial log level and the target log level.

8. The system according to claim 6, characterized in that, The system also includes: The host computer key injection module is used to send the debugging key and the initial log level to the microcontroller key injection module.

9. The system according to claim 6, characterized in that, The system also includes: An external serial port device is used to send the serial port information to the microcontroller serial port module.

10. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the serial port log management method as described in any one of claims 1-5 when running.