CN116560594A - Method, device and equipment for controlling serial port terminal to print based on hardware state - Google Patents

Method, device and equipment for controlling serial port terminal to print based on hardware state Download PDF

Info

Publication number
CN116560594A
CN116560594A CN202310506572.6A CN202310506572A CN116560594A CN 116560594 A CN116560594 A CN 116560594A CN 202310506572 A CN202310506572 A CN 202310506572A CN 116560594 A CN116560594 A CN 116560594A
Authority
CN
China
Prior art keywords
serial port
printing
level value
gpio pin
pin
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310506572.6A
Other languages
Chinese (zh)
Inventor
杨萍萍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Changan Automobile Co Ltd
Original Assignee
Chongqing Changan Automobile Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Changan Automobile Co Ltd filed Critical Chongqing Changan Automobile Co Ltd
Priority to CN202310506572.6A priority Critical patent/CN116560594A/en
Publication of CN116560594A publication Critical patent/CN116560594A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1224Client or server resources management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1203Improving or facilitating administration, e.g. print management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1229Printer resources management or printer maintenance, e.g. device status, power levels
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Accessory Devices And Overall Control Thereof (AREA)

Abstract

The invention provides a method, a device and equipment for controlling serial port terminal printing based on a hardware state, and belongs to the technical field of signal processing. The method comprises the following steps: acquiring an input level value of a GPIO pin; and determining the printing working state of the serial port terminal according to the input level value of the GPIO pin. The working states of the serial port terminal printing comprise serial port printing starting and serial port printing closing; the level value of the input is determined by the circuit connection state between the GPIO pin and the pin external power supply equipment. The invention realizes the control of serial port printing through a small hardware change, and can provide a serial port printing function of opening a back door in the after-sale stage of the embedded equipment. Moreover, the control method is simple and flexible and has strong operability.

Description

Method, device and equipment for controlling serial port terminal to print based on hardware state
Technical Field
The invention relates to the technical field of signal processing, in particular to a method for controlling serial port terminal printing based on a hardware state, a device for controlling serial port terminal printing based on the hardware state, an embedded device and a computer readable storage medium.
Background
In the actual development process of the embedded product, the function debugging is always required to be performed by using the serial port terminal, and meanwhile, the positioning problem is required to be analyzed by using the output of the serial port terminal. However, for security reasons, in the formal version of software, the serial port terminal function is usually prohibited to prevent the disclosure by being broken maliciously. In general, the serial port terminal and the printing function can be reserved under the debugging version through software version management, and the modifying function is removed under the formal version of the software. Therefore, smooth debugging of the development process can be ensured, and the safety problem after the later shipment can be also ensured.
However, there is a drawback in doing so, when there is a problem that occurs in the machine leaving the factory, the factory needs to be debugged, and in a software state that the current problem can be reproduced without changing, there is a need to debug the output log, but the factory equipment is closed, the problem log cannot be output, and this greatly affects the problem debugging of the machine. Therefore, in order to flexibly control the serial port function, the tester puts forward the following demands on the serial port function:
(1) The serial port debugging function is normal in the development stage;
(2) Any serial port cannot output information in the delivery stage;
(3) The serial port opening function can be provided with a 'back door' at the after-sale stage.
For example, a method, a system, a device and a storage medium for controlling application serial port printing are proposed in chinese patent literature with publication number CN109358827a, the publication number being 2019, 2, 19, and the method comprising: reading a configuration file pre-configured in a memory, and acquiring a serial port printing state identifier in the configuration file; determining the working state of serial port printing according to the serial port printing state identification; the serial port printing identification comprises an execution identification or a forbidden identification; the operating state of application serial port printing includes allowing application serial port printing or prohibiting application serial port printing. Although the method realizes the printing control of the serial port through the serial port printing mark, the following disadvantages still exist: 1) The implementation of the method needs to rely on additionally writing application programs and integrating the application programs into products, and has certain complexity; 2) This method may not be applicable in situations where after-market failure prototypes are stuck, the system is dead, etc.
Therefore, it is necessary to provide a simpler and flexible serial port print control method.
Disclosure of Invention
The invention aims to provide a method for controlling serial port terminal printing based on hardware state, which solves the problem that embedded equipment cannot start serial port printing in the after-sale stage in the prior art; the second aim is to provide a device for controlling serial port terminal printing based on hardware state; a third object is to provide an embedded device and a computer-readable storage medium for implementing a serial port terminal print control method.
In order to achieve the above purpose, the technical scheme adopted by the invention is as follows:
in a first aspect, the present invention provides a method for controlling printing of a serial port terminal based on a hardware state, where the method is applied to an embedded device, and includes: acquiring an input level value of a GPIO pin; determining the printing working state of the serial port terminal according to the input level value of the GPIO pin; the working states of the serial port terminal printing comprise serial port printing starting and serial port printing closing; the level value of the input is determined by the circuit connection state between the GPIO pin and the pin external power supply equipment.
According to the technical means, the high-low level of the GPIO input is controlled by changing the connection state of the GPIO interface and the external power supply device, and whether serial port printing is started or not is determined according to the high-low level value. Compared with the serial port control application program in the prior art, the invention achieves version exchange between the debugging version and the formal factory version of the embedded equipment by switching the connection relation between the GPIO and the external power supply equipment from the hardware perspective, so as to achieve the starting and closing of the debugging serial port function. The method is very convenient, has strong operability, and can effectively avoid the situation that the serial port function cannot be started due to system blocking, dead halt and the like.
Further, the determining the working state of the serial port terminal according to the input level value of the GPIO pin may include: if the input level value of the GPIO pin is a first level value, determining to start serial port printing; if the input level value of the GPIO pin is a second level value, determining to close serial port printing; wherein the first level value is higher than the second level value.
According to the technical means, the high level input by the GPIO pin is determined to be the signal for starting the serial port printing, the low level input by the GPIO pin is determined to be the signal for closing the serial port printing, and the control mode can rapidly judge that the serial port printing is started through an increased voltage value in the process of debugging the embedded equipment of the formal version. In addition, for the after-sale embedded equipment, the voltage value input by the GPIO pin is slightly reduced due to overlong use period, aging of power equipment and the like, if the low-level value is adopted as a signal for starting serial port printing, the error starting serial port printing of the embedded equipment in a formal version is most likely to happen; the high level value is selected as a signal for starting serial port printing, so that the situation can be avoided.
Further, when a pull-up resistor is connected between the GPIO pin and the pin external power supply device, the input level value of the GPIO pin may be a first level value; when the circuit connection between the GPIO pin and the pin external power supply device is disconnected, the input level value of the GPIO pin may be a second level value.
According to the technical means, the difference of the input level values of the GPIO pins is realized by connecting the pull-up resistor between the GPIO pins and the external power supply equipment and controlling the on-off mode of the circuit, and the off serial port printing can be realized simply and quickly by switching off the circuit switch.
Further, when a pull-up resistor is connected between the GPIO pin and the pin external power supply device, the input level value of the GPIO pin may be a first level value; when a pull-down resistor is connected between the GPIO pin and the pin external power supply device, the input level value of the GPIO pin may be the second level value.
According to the technical means, the pull-up resistor and the pull-down resistor are connected in parallel between the GPIO pin and the external power supply equipment, and the difference of the input level values of the GPIO pin is realized in a mode of switching circuit connection.
Further, the closing serial port printing may include closing serial port printing of uboot, closing serial port printing of kernel, and closing serial port printing of application layer.
According to the technical means, the place where the serial port printing needs to be closed by default in the embedded equipment of the formal version is determined, and the method is beneficial to comprehensively preventing the embedded equipment from being incapable of outputting any serial port information in the factory stage.
Further, the method for closing serial port printing may include: the position of the output function is changed, or the output function is directly returned before no output action is performed on the output function.
According to the technical means, a mode of closing serial port printing by default of the embedded equipment is provided, and the default closing serial port printing can be realized in the embedded equipment of the formal version by the mode, so that the output of serial port information is prevented.
In a second aspect, the invention provides a device for controlling serial port terminal printing based on hardware state, which comprises a level reading module, a judging module and a serial port printing determining module; the level reading module is used for reading the input level value of the GPIO pin; the judging module is used for judging the input level value of the GPIO pin; the serial port printing determining module is used for determining the working state of serial port terminal printing according to the input level value of the GPIO pin, and the working state of serial port terminal printing comprises serial port printing starting and serial port printing closing.
According to the technical means, the device capable of simply and flexibly controlling the serial port terminal to print is provided, and the device can provide a serial port printing function of opening a back door in the after-sale stage of the embedded equipment.
In a third aspect, the present invention provides an embedded device, including a processor and a memory, where the embedded device includes the processor and the memory, two circuit connection states are set between a GPIO pin in the processor and a pin external power supply device, and the GPIO pin changes an input level value of the GPIO pin by switching the circuit connection state between the GPIO pin and the pin external power supply device; the memory stores at least one computer program, and the at least one computer program is loaded and executed by one or more processors, so that the computer realizes the method for controlling the serial port terminal to print based on the hardware state.
In a fourth aspect, the present invention provides a computer-readable storage medium having stored therein at least one program code loaded and executed by a processor to cause a computer to implement a method of controlling serial port terminal printing based on hardware status as described above.
In a fifth aspect, the present invention provides a method for debugging an embedded device, the method for debugging comprising: confirming whether the embedded equipment needs to be debugged; if yes, connecting the embedded equipment with the serial port terminal, and controlling the embedded equipment to start serial port printing by adopting the method for controlling serial port terminal printing based on the hardware state; if not, the method for controlling the serial port terminal printing based on the hardware state is adopted to control the embedded equipment to close the serial port printing.
Through the technical scheme provided by the invention, the invention has at least the following technical effects:
(1) The invention realizes the control of serial port printing through a small hardware change, and can provide a serial port printing function of opening a back door in the after-sale stage of the embedded equipment;
(2) The invention does not need to update or change software to control the serial port printing function, not only can effectively avoid the situation that the serial port cannot be opened caused by the states of system blocking, dead halt and the like, but also can realize the serial port printing operation more simply and rapidly, thereby being beneficial to saving debugging time and improving debugging efficiency;
(3) The invention does not need to redevelop the serial port control application program, and greatly shortens the development period of the embedded equipment.
Additional features and advantages of the invention will be set forth in the detailed description which follows.
Drawings
The accompanying drawings are included to provide a further understanding of embodiments of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain, without limitation, the embodiments of the invention. In the drawings:
fig. 1 is a flow chart of a method for controlling serial port terminal printing based on hardware status according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of an embedded device control serial port printing function according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of a software internal control serial port printing function according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a device for controlling serial port terminal printing based on hardware status according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an embedded device according to an embodiment of the present invention;
FIG. 6 is a schematic circuit diagram of a debug-version embedded device according to an embodiment of the present invention;
FIG. 7 is a circuit diagram of an embodiment of the present invention for a formal version of an embedded device;
fig. 8 is another circuit connection diagram of an embedded device of a formal version according to an embodiment of the present invention.
Description of the reference numerals
A 101-level reading module; 102-judging module; 103-determining a serial port printing module; 201-a processor; 202-memory.
Detailed Description
Further advantages and effects of the present invention will become readily apparent to those skilled in the art from the disclosure herein, by referring to the accompanying drawings and the preferred embodiments. The invention may be practiced or carried out in other embodiments that depart from the specific details, and the details of the present description may be modified or varied from the spirit and scope of the present invention. It should be understood that the preferred embodiments are presented by way of illustration only and not by way of limitation.
It should be noted that, without conflict, the embodiments of the present invention and features of the embodiments may be combined with each other. In the present invention, "first," "second," etc. are merely for convenience of description and for convenience of distinction, and are not to be construed as indicating or implying relative importance.
At present, for testing of embedded devices, a serial port printing function is controlled by mostly adopting a mode of developing a serial port control application program. The method not only greatly increases development burden in the development stage, but also can not flexibly control serial printing in the after-sales stage. In order to solve the above-mentioned problems, the present invention proposes a relatively flexible serial port printing control method implemented by small hardware modification, and determines whether to open serial port printing by using the state of a GPIO interface (or GPIO pin).
The invention will be described in detail below with reference to the drawings in connection with embodiments.
Example 1
A first embodiment of the present invention provides a method for controlling printing of a serial port terminal based on a hardware state, and referring to fig. 1, the method is applied to an embedded device, and includes the following steps:
step S101, obtaining an input level value of a GPIO pin.
Here, the GPIO interface (General-purpose input/output interface) is a pin of a chip, and is connected to an external device, so that functions such as communication, control, and data acquisition between the chip and the outside are realized.
Step S102, determining the printing working state of the serial port terminal according to the input level value of the GPIO pin. The working states of serial port terminal printing comprise serial port printing starting and serial port printing closing; the level of the input level value is determined by the state of the circuit connection between the GPIO pin and the pin external power supply device.
Illustratively, the process of determining the working state of the serial port terminal printing according to the input level value of the GPIO pin may be: and determining a high-level signal input by the GPIO pin as a signal for closing serial port printing, and determining a low-level signal input by the GPIO pin as a signal for opening serial port printing.
Of course, the invention is not limited to this, and the process of determining the working state of the serial port terminal printing according to the input level value of the GPIO pin may be: and determining a high-level signal input by the GPIO pin as a signal for starting serial port printing, and determining a low-level signal input by the GPIO pin as a signal for closing serial port printing.
Further, in this embodiment, a pull-up resistor may be connected between the GPIO pin and the pin external power device, and when the circuit is in the connected state, the input level value of the GPIO pin is adjusted to the first level value; when the circuit is in an off state, the input level value of the GPIO pin is adjusted to a second level value, and the first level value is higher than the second level value.
Further, in this embodiment, a pull-up resistor and a pull-down resistor may be connected in parallel between the GPIO pin and the pin external power device, and when the GPIO pin and the circuit in which the pull-up resistor is located are in a connected state, the input level value of the GPIO pin is adjusted to the first level value; when the GPIO pin is in a communication state with a circuit in which the pull-down resistor is positioned, the input level value of the GPIO pin is adjusted to a second level value; and the first level value is higher than the second level value.
Example two
A second embodiment of the present invention provides a method for debugging an embedded device, referring to fig. 2, the method for debugging includes the steps of:
step S201, confirming whether the embedded device needs to be debugged.
Step S202, if the embedded equipment is confirmed to need to be debugged, the embedded equipment is considered to need to be switched to a debugging version, and a tester can adjust the input voltage value of the GPIO pin to be high level, so that the function of controlling the embedded equipment to start serial terminal printing is realized; if the embedded equipment is confirmed to be not required to be debugged, the embedded equipment is considered to be required to be switched to a formal version, and a tester can adjust the input voltage value of the GPIO pin to be low level, so that the function of controlling the embedded equipment to close the serial terminal printing is realized.
The control of the serial port terminal printing function of the embedded device may be implemented by developing a serial port control application program by adopting the method in the first embodiment. For example, on software, the IO is configured as an input mode of GPIO, a level value of the IO port (input/output port) is read where serial port function initialization is required, and a conditional select statement is added. When the IO level is read to be high, the original logic is reserved, and the serial port debugging function is started. And otherwise, when the IO level is read to be low, the serial printing is turned off.
And the level value of the IO port is controlled by the level value of the IO port on software to control whether serial port printing is started or not, and the level value of the IO port is determined by a hardware circuit. The difference of hardware versions is small, and the conversion before each other can be completed through welding and disassembling of resistors, so that the serial port function is opened and closed.
Referring to fig. 3, there are mainly three places where serial printing needs to be turned off, uboot printing, kernel printing (printk function), and application layer printing (printf). There are numerous ways to shut down serial printing, and it is an option to output functions (printk, printf) from the orientation elsewhere, such as dev/null. Or directly returning the function before the output function has no output action, or outputting the con to other wrong tty (fully called Teletypes or Teletypewriters) serial devices at the position of initializing the con.
It should be noted that uboot (full name Universal Boot Loader) refers to a boot loader mainly used for an embedded system, and may support a plurality of different computer system structures. kernel refers to the kernel (i.e., core portion) of the operating system whose functions are responsible for scheduling and synchronization of events, inter-process communication (messaging), and memory management. printk refers to a kernel-mode information print function, and printf refers to a formatted output function. The control initialization refers to a drive initialization function of the control port. tty is a terminal device composed of a virtual console, a serial port and a pseudo terminal device.
dev/null refers to an empty device file in the Linux system that will absorb any input and not return anything. In most cases, an administrator uses an if function to dump useless data for output therein so that it does not occupy system memory and processing power. Even useless files can be deleted by moving them directly to dev/null.
The implementation environment of the embodiments of the present application may include at least one terminal and a server, and the method is executed on the terminal or the server, respectively. The terminal and the server can be in communication connection to realize starting serial port printing and output a problem log. The terminal and the server output the problem log by acquiring the authority for starting serial port printing.
The terminal may be any electronic product that can perform man-machine interaction with a user through one or more modes of a keyboard, a touch pad, a touch screen, voice interaction, and the like, for example, a PC (Personal Computer ), a PPC (Pocket Personal Computer, palm computer), a tablet computer, and the like.
The server may be a server, or may be a server cluster formed by a plurality of servers, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), and basic cloud computing services such as big data and artificial intelligence platforms.
Example III
Referring to fig. 4, the third embodiment of the present invention provides an apparatus for controlling serial port terminal printing based on hardware status, where the apparatus includes a level reading module 101, a judging module 102, and a serial port printing determining module 103.
The level reading module 101 is configured to read an input level value of the GPIO pin.
The judging module 102 is connected to the level reading module 101, and is configured to judge the level value of the input of the GPIO pin.
The serial port printing module 103 is connected with the judging module 102 and is used for determining the working state of serial port terminal printing according to the input level value of the GPIO pin, wherein the working state of serial port terminal printing comprises serial port printing starting and serial port printing closing.
For example, if the input level value of the GPIO pin is high, the serial port printing module is determined to start serial port printing; if the input level value of the GPIO pin is low level, the serial port printing module is determined to shut down serial port printing.
It should be noted that, when the above-mentioned device is implemented with the functions, only the division of the above-mentioned functional modules is used as an example, in practical application, the above-mentioned functional distribution may be implemented by different functional modules according to the need, i.e. the internal structure of the device is divided into different functional modules, so as to implement all or part of the functions described above. In addition, the apparatus and the method embodiments provided in the foregoing embodiments belong to the same concept, and specific implementation processes of the apparatus and the method embodiments are detailed in the method embodiments and are not repeated herein.
Example IV
The fourth embodiment of the present invention also provides an embedded device, see fig. 5, comprising a processor 201 and a memory 202.
Two circuit connection states are provided between the GPIO pin and the pin external power supply device in the processor 201, and the GPIO pin changes the input level value of the GPIO pin by switching the circuit connection state with the pin external power supply device.
For example, referring to fig. 6, for a debug version of the embedded device, the input level of the GPIO port is a high level value when the input port of the processor is multiplexed into a GPIO input mode and externally connected to the pull-up resistor R1, so that the serial port printing function can be started.
Referring to fig. 7, for an embedded device of a formal version, an IO port on a processor is multiplexed into a GPIO input mode, and an external pull-down resistor R2 is grounded, and at this time, the input level of the GPIO port is a low level value, so that the serial port printing function can be turned off.
Referring to fig. 8, for another formal version of embedded device, the input level of the GPIO port is a low level value when the input level of the GPIO port is suspended from the outside and the serial port printing function can be turned off.
The embedded device in fig. 6 can be converted into the embedded device in fig. 8 by removing the resistor R1, so that the serial port function is changed from the on state to the off state. Meanwhile, the embedded device in fig. 6 can also change the serial port function from the on state to the off state by removing the resistor R1 and converting the welding resistor R2 into the embedded device in fig. 7.
Similarly, the embedded device in fig. 7 can change the serial port function from the off state to the on state by welding the resistor R1 and removing the resistor R2. The embedded device in fig. 8 can also change the serial port function from the off state to the on state by making the level input value high through the welding resistor R1.
In fig. 6, 7, and 8, "VDD" represents a drain power supply voltage (Voltage Drain Drain), GND "represents a Ground line or a 0 line (Ground), and SOC" represents a System on Chip (System on Chip).
The memory 202 stores therein at least one computer program loaded and executed by one or more of the above processors to cause the computer to implement the method of controlling serial port terminal printing based on hardware status in the first embodiment or the debugging method described in the second embodiment.
Of course, the embedded device may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the embedded device may also include other components for implementing the functions of the device, which are not described herein.
Example five
The fifth embodiment of the present invention also provides a computer-readable storage medium having stored therein at least one program code loaded and executed by a processor to cause a computer to implement the method of controlling serial port terminal printing based on hardware status in the first embodiment or the debugging method described in the second embodiment.
Alternatively, the computer readable storage medium may be a Read-0nlymemory (ROM), a random access memory (Random Access Memory, RAM), a compact disk Read-only (Compact Disc Read-0nlymemory, cd-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like. Those skilled in the art will appreciate that all or part of the steps in implementing the methods of the embodiments described above may be implemented by a program stored in a storage medium, including instructions for causing a single-chip microcomputer, chip or processor (processor) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In summary, the present invention has at least the following technical effects:
(1) The factory equipment closes the serial port printing function, and ensures the safety requirement;
(2) The problem equipment returned to the factory can be provided with a rear door opening debugging serial port, so that the problem can be found in time;
(3) From the perspective of hardware, the difference between the embedded equipment of the debugging version and the formally manufactured version is very small, and version exchange can be achieved by welding resistors, disassembling resistors and the like, so that the function of debugging the serial port can be started and closed; the mode is very convenient, and the operability is also very high;
(4) The development period is greatly shortened without redevelopment of the serial port control application program.
The above embodiments are merely preferred embodiments for fully explaining the present invention and the technical principles applied thereto, and the scope of the present invention is not limited thereto. It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application.
Equivalent changes or transformations, readjustments and substitutions will be apparent to those skilled in the art based on the present invention, or may be applied directly or indirectly to other related technical fields, which are within the scope of the present invention. Therefore, while the invention has been described in connection with the above embodiments, it is to be understood that the invention is not limited to the specific embodiments disclosed and that many other equivalent embodiments may be made without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. The method for controlling serial port terminal printing based on hardware state is applied to embedded equipment and is characterized by comprising the following steps:
acquiring an input level value of a GPIO pin;
determining the printing working state of the serial port terminal according to the input level value of the GPIO pin;
the working states of the serial port terminal printing comprise serial port printing starting and serial port printing closing; the level value of the input is determined by the circuit connection state between the GPIO pin and the pin external power supply equipment.
2. The method for controlling serial port terminal printing based on hardware state according to claim 1, wherein the determining the working state of serial port terminal printing according to the input level value of the GPIO pin comprises:
if the input level value of the GPIO pin is a first level value, determining to start serial port printing;
if the input level value of the GPIO pin is a second level value, determining to close serial port printing;
wherein the first level value is higher than the second level value.
3. The method for controlling serial port terminal printing based on hardware state according to claim 2, wherein when a pull-up resistor is connected between the GPIO pin and the pin external power supply device, the input level value of the GPIO pin is a first level value; when the circuit connection between the GPIO pin and the pin external power supply device is disconnected, the input level value of the GPIO pin is a second level value.
4. The method for controlling serial port terminal printing based on hardware state according to claim 2, wherein when a pull-up resistor is connected between the GPIO pin and the pin external power supply device, the input level value of the GPIO pin is a first level value; when a pull-down resistor is connected between the GPIO pin and the pin external power supply device, the input level value of the GPIO pin is a second level value.
5. The method for controlling serial port terminal printing based on hardware state according to claim 1, wherein the closing serial port printing includes closing serial port printing of uboot, closing serial port printing of kernel, and closing serial port printing of application layer.
6. The method for controlling serial port terminal printing based on hardware state according to claim 5, wherein the mode of turning off serial port printing comprises: the position of the output function is changed, or the output function is directly returned before no output action is performed on the output function.
7. A method for debugging an embedded device, the method comprising:
confirming whether the embedded equipment needs to be debugged;
if yes, connecting the embedded equipment with the serial port terminal, and controlling the embedded equipment to start serial port printing by adopting the method for controlling serial port terminal printing based on the hardware state according to any one of claims 1-6;
if not, the method for controlling the serial port terminal printing based on the hardware state according to any one of claims 1 to 6 is adopted to control the embedded equipment to close the serial port printing.
8. The device for controlling the serial port terminal to print based on the hardware state is characterized by comprising a level reading module, a judging module and a serial port printing determining module;
the level reading module is used for reading the input level value of the GPIO pin;
the judging module is used for judging the input level value of the GPIO pin;
the serial port printing determining module is used for determining the working state of serial port terminal printing according to the input level value of the GPIO pin, and the working state of serial port terminal printing comprises serial port printing starting and serial port printing closing.
9. The embedded equipment is characterized by comprising a processor and a memory, wherein two circuit connection states are arranged between a GPIO pin in the processor and pin external power equipment, and the input level value of the GPIO pin is changed by switching the circuit connection state between the GPIO pin and the pin external power equipment;
at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by one or more processors, so that the computer realizes the method for controlling serial port terminal printing based on hardware state according to any one of claims 1 to 6.
10. A computer-readable storage medium, wherein at least one program code is stored in the computer-readable storage medium, and the program code is loaded and executed by a processor, so that a computer implements the method for controlling printing of a serial port terminal based on a hardware state according to any one of claims 1 to 6.
CN202310506572.6A 2023-05-06 2023-05-06 Method, device and equipment for controlling serial port terminal to print based on hardware state Pending CN116560594A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310506572.6A CN116560594A (en) 2023-05-06 2023-05-06 Method, device and equipment for controlling serial port terminal to print based on hardware state

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310506572.6A CN116560594A (en) 2023-05-06 2023-05-06 Method, device and equipment for controlling serial port terminal to print based on hardware state

Publications (1)

Publication Number Publication Date
CN116560594A true CN116560594A (en) 2023-08-08

Family

ID=87494029

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310506572.6A Pending CN116560594A (en) 2023-05-06 2023-05-06 Method, device and equipment for controlling serial port terminal to print based on hardware state

Country Status (1)

Country Link
CN (1) CN116560594A (en)

Similar Documents

Publication Publication Date Title
KR101959359B1 (en) Method for updating boot image for fast booting and image forming apparatus for performing the same
CN110032405B (en) System boot code memory management method, memory device and electronic system using same
US6668261B1 (en) Method of upgrading a program using associated configuration data
JP2003345618A (en) Method of switching between tow or more images of firmware
CN113254286B (en) Log output method and system of server and related device
CN111767066A (en) Method and apparatus for in-situ mitigation of firmware failures
US20030221035A1 (en) CPU life-extension apparatus and method
US8806474B2 (en) Computer-hardware, life-extension apparatus and method
KR101305502B1 (en) Computer system and control method thereof
US7100032B2 (en) Method and apparatus for identifying hardware compatibility and enabling stable software images
WO2011120774A1 (en) Method for managing usb devices
CN116560594A (en) Method, device and equipment for controlling serial port terminal to print based on hardware state
CN1983195A (en) Mounting device, electronic device, method of controlling mounting device, controlling program, and recording medium
CN115509622A (en) Configuration information updating method and device
KR101850275B1 (en) Method for generating boot image for fast booting and image forming apparatus for performing the same, method for performing fast booting and image forming apparatus for performing the same
US20060195653A1 (en) Switchable mass storage system
US20230359741A1 (en) Trusted boot method and apparatus, electronic device, and readable storage medium
KR101850272B1 (en) Method for updating boot image for fast booting and image forming apparatus for performing the same
KR101845467B1 (en) Method for restoring error of boot image for fast booting and image forming apparatus for performing the same
CN107153542B (en) Business logic decoupling method and device
CN115016850B (en) UEFI firmware starting mode switching method based on domestic processor platform
CN113448644B (en) Operating system ring3 mode OC hard disk configuration method, device, terminal and storage medium
CN117234544B (en) Method and device for recovering system of server equipment
US20230350755A1 (en) Coordinated operating system rollback
Zhang et al. A Serial Port Data Filtering System

Legal Events

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