CN110457215A - A kind of cross-platform MCU adjustment method - Google Patents
A kind of cross-platform MCU adjustment method Download PDFInfo
- Publication number
- CN110457215A CN110457215A CN201910701812.1A CN201910701812A CN110457215A CN 110457215 A CN110457215 A CN 110457215A CN 201910701812 A CN201910701812 A CN 201910701812A CN 110457215 A CN110457215 A CN 110457215A
- Authority
- CN
- China
- Prior art keywords
- module
- mcu
- debugging
- log
- instruction
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3466—Performance evaluation by tracing or monitoring
- G06F11/3476—Data logging
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3648—Software debugging using additional hardware
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/12—Digital output to print unit, e.g. line printer, chain printer
- G06F3/1201—Dedicated interfaces to print systems
- G06F3/1223—Dedicated interfaces to print systems specifically adapted to use a particular technique
- G06F3/1237—Print job management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Software Systems (AREA)
- Computer Security & Cryptography (AREA)
- Human Computer Interaction (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present invention provides a kind of cross-platform MCU adjustment method, including host computer and MCU, it is characterized in that, at least include the following steps: host computer sends debugging instruction and receive to MCU, MCU according to debugging demand Start-up and Adjustment instruction module to be started corresponding debugging function module after debugging instruction and debugs to MCU;Debugging instruction module is configured as calling corresponding debugging instruction to debug MCU according to debugging demand;Debugging function module, is configured as debugging instruction corresponding with debugging instruction module and issue according to debugging instruction module and starts corresponding debugging function module debugging MCU.Compared to existing MCU adjustment method, directlys adopt MCU and host computer carries out assembly and adjustment, without using dedicated debugging tool as intermediate medium, so that debugging cost reduces, adjustment method flexibility and changeability.
Description
Technical field
The present invention relates to the microprocessor controller field (Microcontroller Unit, MCU) more particularly to a kind of pair of vapour
In vehicle MCU development process or the method that the MCU failure of completion is debugged is developed.
Background technique
Universal with automobile, more and more automobiles enter huge numbers of families, the rapid development of present information technology so that
More stringent requirements are proposed to vehicle intellectualized by people, it is desirable to which intelligent vehicle can offer convenience to the practical of people.Intelligence
Vehicle is the integrated system for integrating the functions such as environment sensing, programmed decision-making, multi-grade auxiliary driving, it, which is concentrated, uses
The technologies such as computer, modern sensing, information fusion, communication, artificial intelligence and automatic control are that typical new and high technology is comprehensive
Body.The research of intelligent vehicle is directed generally at present to improve safety, the comfort of automobile, and excellent people's vehicle is provided and is handed over
Mutual interface.In recent years, oneself hot spot and auto industry through becoming the research of world's Vehicle Engineering of intelligent vehicle increase new dynamic
Power, many developed countries all incorporate it into the intelligent transportation system respectively given priority to.The development of intelligent automobile is to vehicle
Body control system various aspects propose strict requirements, including software and hardware, and the processing of software and hardware is all be unable to do without
MCU.And the powerful MCU development cycle is longer, needs constantly to debug MCU in the process of development, traditional tune
Method for testing is as shown in Figure 1 comprising host computer, debugging tool, MCU, MCU debugging need special debugging tool, debugged
Cheng Zhong debugs MCU by PC control debugging tool, on the one hand, needs special debugging tool, and adjusts
Trial work tool is difficult to be modified once completing, and can be only applied to the MCU debugging of specific model, inflexible, has biggish
Limitation.The internal information of MCU, such as register, variable, the numerical value of region of memory can only be got.But MCU collection at this stage
At more function, just know that register, variable, the numerical value of region of memory be it is far from being enough, can not be obtained from these data
The operating status of system is taken, the relation of interdependence between system operational process and each module can not be also obtained.
In order to facilitate the debugging of developer, in time to each functional module in MCU development process and related to MCU
The function of matching debugged, need to develop a kind of new MCU debugging apparatus and MCU debugged.
Summary of the invention
Based on defect existing in the prior art, the technical problem to be solved in the present invention is that a kind of cross-platform MCU tune
Method for testing, applied to the system debug including host computer and MCU, which is characterized in that at least include the following steps:
Host computer sends debugging instruction according to debugging demand Start-up and Adjustment instruction module and receives debugging instruction to MCU, MCU
After start corresponding debugging function module MCU debugged;
Debugging instruction module is configured as calling corresponding debugging instruction program to debug MCU according to debugging demand;
Debugging function module is configured as debugging that is corresponding with debugging instruction module and issuing according to debugging instruction module
Instruction starts corresponding certain functional modules and debugs to MCU.
The present invention provides a kind of cross-platform MCU adjustment method, further, further includes: the data hair that MCU debugging generates
It gives host computer to be shown, the data that the MCU debugging generates include log, and log is multiple logs etc. according to Type division
Grade;In to MCU debugging process, the data exported will be needed to be temporarily stored into memory, waiting system externally exports when the free time;
Or including when in discovery MCU debugging function module there is no built-in preset functional module or according to debugging result, need to increase volume
Outer functional module will be directly written in MCU at this time by host computer containing required functional module.
The present invention provides a kind of cross-platform MCU adjustment method, and further, the modulation instructions need before issuing MCU
Debugging instruction is packaged, the MCU needs obtain modulation instructions after unpacking to the encapsulated data packet received;
The data that the MCU debugging generates need for data to be packaged before being sent to host computer, and the host computer needs
The data packet that debugging generates is obtained after unpacking to the encapsulated data packet received.
The present invention provides a kind of cross-platform MCU adjustment method, further, the data be packaged include at least with
Lower step:
Step S701 obtains the payload (payload) for needing package and therefrom obtains address, the length of payload
Degree, type of data packet;
Whether effective step S702 judges address, if address is invalid, thens follow the steps S707, terminates package process;If ground
Location is effective, thens follow the steps S703;
Step S703 judges payload command type, if the command type of payload is effective, thens follow the steps
S704 thens follow the steps S707 if the command type of payload is invalid, terminates package process;
Step S704 judges whether the data length of payload is effective, if data length is invalid, thens follow the steps
S707 terminates package process if data length is effective and thens follow the steps S705;
Step S705 carries out assignment to payload;
The good data of package are stored in data field to be sent by step S706.
The present invention provides a kind of cross-platform MCU adjustment method, further, described to carry out unpacking packet to encapsulated data packet
Include following steps:
Whether step S800, detection frame prefix include high byte, if containing high byte, S801 are thened follow the steps, if not having
High byte returns to step S800, detects to next frame;
Step S801, whether detection frame prefix includes low byte, if thening follow the steps S802 comprising low byte;If not wrapping
Containing low byte, then step S800 is returned to, next frame data are detected;
Step S802 obtains the length of data packet;
Step S803 parses Packet type, judges data packet is which kind of belongs to;
Step S804 obtains payload after unpacking;
The present invention provides a kind of cross-platform MCU adjustment method, and further, the debugging instruction module includes at least day
Will print command module, logging level filtering instructions module, process interaction instruction module, firmware acquisition instruction module, content are write
Enter instruction module, content reads instruction module, online upgrading instruction module, one of tool self-adapting estimation instruction module or
It is a variety of;
Debugging function module includes at least log print module, logging level filtering module, process interaction module, firmware and obtains
One of modulus block, content writing module, content read module, online upgrading module, tool self-adapting estimation module are more
Kind
Further, log print command module is configured as according to debugging demand starting log print command and issues
To the log print module in MCU;
Logging level filtering instructions module is configured as according to debugging demand starting log grade filtering instructions and is handed down to
Logging level filtering module in MCU;
Process interaction instruction module is configured as starting according to debugging demand the process interaction between each process and instructs simultaneously
It is handed down to the process interaction module of MCU;
Firmware acquisition instruction module, the instruction for being configured as starting according to debugging demand acquisition firmware are handed down in MCU
Firmware obtains module;
Content write instruction module, the instruction for being configured as starting according to debugging demand content write-in are handed down in MCU
Content writing module;
Content reads instruction module, and the instruction for being configured as starting according to debugging demand content reading is handed down in MCU
Content read module;
Online upgrading instruction module, the instruction for being configured as starting according to debugging demand online upgrading are handed down in MCU
Online upgrading module.
Tool self-adapting estimation instruction module, is configured as starting tool according to demand and adaptively instructs and be handed down to MCU
In tool self-adapting estimation module;
Application layer instruction module is configured as starting the application level function that application layer instruction is handed down in MCU according to demand
Customized module.
The present invention provides a kind of cross-platform MCU adjustment method, and further, the debugging function module includes at least day
Will print module, logging level filtering module, process interaction module, firmware obtain module, content writing module, content and read mould
One of block, online upgrading module, tool self-adapting estimation module are a variety of;
Further, log print module is configured as realizing log printing, according to the finger of log print command module
It enables log (log) message by printing out, for informing the operating status of developer's program;
Logging level filtering module is configured as realizing logging level filtering, according to logging level filtering instructions module
Instruction, selectively realize the different grades of log capability of dynamic filtration;
Process interaction module is configured as recording the information transmitting between multiple tasks in real time, is referred to according to process interaction
The information between starting multiple tasks is enabled to transmit record;
Firmware obtains module, is configured as obtaining the information of firmware, obtains firmware information according to firmware acquisition instruction;
Content writing module is configured as needing to be written the information of memory and being written to receiving, according to content
Write instruction will be in the memory of corresponding data write-in MCU;
Content read module, is configured as being read out the information that needs are read, and reads instruction to phase according to content
The content answered is read out;
Online upgrading module is configured as upgrading MCU, and basis receives the upgrade command pair from host computer
MCU is upgraded;
Tool self-adapting estimation module, be configured as according to the tool self-adapting estimation of host computer instruct to host computer whether
It is identified with matched serial ports tool;
Application level function customized module is configured as instructing the function progress to application program according to the application layer of host computer
Customization.
The present invention provides a kind of cross-platform MCU adjustment method, and further, the log in debugging process is to pass through log
Print command module sends instructions under passing through controls what log print module was printed, log printing the following steps are included:
Step S901, judges whether logging level matches, if matching, thens follow the steps S902, if mismatching, executes step
Rapid S912;
Step S902 reads the character for needing to print the character string first address in tune-up data packet;
Step S903 judges whether the initial character of the address is that " end mark " is then tied if address initial character is end mark
The beam process.If initial character is not end mark, continue to act in next step;
Step S904 judges whether character is that ' % ' if character is not ' % ' thens follow the steps S910, saves the character;
If character is ' % ', character late is obtained;
Step S905 judges whether character late is x or d, if d, thens follow the steps S906, if x, then executes step
Rapid S908;
Step S906 obtains next parameter;
Step S907, the parameter that will acquire are converted into character to decimal and execute step S910;
Step S908 obtains next parameter;
Step S909, the parameter that will acquire switch to hexadecimal character and execute step S910;
Step S910 saves the character;
Step S911 is directed toward next byte, jumps repetition step S903, until all character prints terminate.
The present invention provides a kind of cross-platform MCU adjustment method, further, realizes that print log grade is filtered through day
Will grade filtering module is completed,
Step S601 receives the data of upper computer end;
Step S602, the integrality of inspection data packet, if data packet is completely, S603 to be thened follow the steps, if data packet
When imperfect, then terminate the process;
Step S603 carries out parsing to the type of data packet and is put into data packet in corresponding grade according to type;
Step S604 is not required to log selection OFF to be shown, is then printed to needing log to be shown to select ON;
When the grade of log module shows ON, then it represents that need to print the grade and come out, if the grade of log module is shown
When OFF, then it represents that without printing the logging level.
The present invention provides a kind of cross-platform MCU adjustment method, and further, the logging level includes at least Debug
Log, Info log, OsMsg log, Warn log, ERROR log, any two in FATAL log;
Debug log: for recording coomand mode during system debug;
Info log a: operating status for recording current system;
OsMsg log: for an interactive process between record the process, as long as the message queue that process is sent out,
It it is all labeled with the label of OsMsg, externally exports, can be according to originating process, target process, command type filters out disappearing for concern
Breath;
Warn log: for alerting developer, it is possible to mistake have occurred, or carried out illegal operation;
ERROR log: informing in developer's program operation process and encounter mistake, but this kind of mistake is in a program
Relevant processing has been done, function may have been failed, but system operation is unaffected;
FATAL log: for informing developer, system encounters grave error, caused the result is that program crashing,
Software restarting.
The present invention also provides a kind of cross-platform MCU debugging apparatus, which is characterized in that and it including MCU, MCU include CPU,
Debugging function module, communication module, memory module, encapsulation unpack module, CPU respectively with debugging function module, communication module, deposit
Store up module, encapsulation unpacks module connection;
CPU is configurable for the calling and operation being responsible between each module of system;
Debugging function module is configured as starting corresponding certain functional modules to MCU according to the debugging instruction received
It is debugged, debugging function module can be increased according to debugging demand or be reduced debugging function;
Memory module is configurable for data, the data of generation and the tune used required in storage debugging process
Try function program or data cached;
Communication module is configurable for MCU and is communicated with host computer;
Encapsulation unpacks module, is configurable for being unpacked or being encapsulated accordingly according to unpacking instruction or encapsulation instruction.
It further include further host computer, host computer is extremely the present invention also provides a kind of cross-platform MCU debugging apparatus
Less include CPU, memory module, debugging instruction module, communication module, encapsulation unpack module, CPU respectively with memory module, debugging
Instruction module, communication module, encapsulation unpack module and are electrically connected;
The communication module of the host computer is electrically connected with the communication module in MCU, wherein the communication module of host computer with
Communication module in MCU is communicatively coupled using wireless communication or wire communication;
CPU is configurable for the calling and operation being responsible between each module of system;
Memory module is configurable for the data and debugging instruction program used required in storage debugging process;
Debugging instruction module is configured as adjusting MCU according to the corresponding debugging instruction program of debugging demand calling
Examination;
Encapsulation unpacks module, is configurable for being unpacked or being encapsulated accordingly according to unpacking instruction or encapsulation instruction;
Communication module is configurable for host computer and is communicated with external equipment.
The present invention also provides a kind of cross-platform MCU debugging apparatus, and further, the debugging function module is at least wrapped
It includes log print module, logging level filtering module, process interaction module, firmware and obtains module, content writing module, content reading
One of modulus block, online upgrading module, tool self-adapting estimation module;
Log print module is configured as realizing log printing, according to the instruction of log print command module by log
(log) message is by being printed out, for informing the operating status of developer's program;Logging level filtering module, quilt
It is arranged for carrying out logging level filtering, according to the instruction of logging level filtering instructions module, selectively realizes dynamic filtration
Different grades of log capability;Process interaction module is configured as recording the information transmitting between multiple tasks, basis in real time
Information between process interaction instruction starting multiple tasks transmits record;Firmware obtains module, is configured as obtaining the letter of firmware
Breath obtains firmware information according to firmware acquisition instruction;Content writing module is configured as needing that memory is written to receiving
Information be written, according to content write instruction by corresponding data write-in MCU memory in;Content read module,
It is configured as being read out the information that needs are read, instruction is read according to content, corresponding content is read out;Online
Upgraded module is configured as upgrading MCU, upgrades according to the upgrade command from host computer is received to MCU;
Tool self-adapting estimation module is configured as whether having host computer according to the instruction of the tool self-adapting estimation of host computer mating
Serial ports tool identified.
The present invention also provides a kind of cross-platform MCU debugging apparatus, and further, the debugging instruction module is at least wrapped
Include log print command module, logging level filtering instructions module, process interaction instruction module, firmware acquisition instruction module, interior
Hold write instruction module, content reads instruction module, online upgrading instruction module, one in tool self-adapting estimation instruction module
Kind:
Log print command module is configured as according to debugging demand starting log print command and is handed down in MCU
Log print module;Logging level filtering instructions module is configured as according to debugging demand starting log grade filtering instructions simultaneously
The logging level filtering module being handed down in MCU;Process interaction instruction module, be configured as according to debugging demand start it is each into
Process interaction between journey instructs and is handed down to the process interaction module of MCU;Firmware acquisition instruction module, is configured as according to tune
The instruction that the starting of examination demand obtains firmware is handed down to the firmware in MCU and obtains module;Content write instruction module, is configured as root
The content writing module in MCU is handed down to according to the instruction of debugging demand starting content write-in;Content reads instruction module, is configured
The content read module in MCU is handed down to start the instruction that content is read according to debugging demand;Online upgrading instruction module, quilt
It is configured to the online upgrading module being handed down in MCU according to the instruction that debugging demand starts online upgrading.Tool self-adapting estimation
Instruction module, is configured as starting tool according to demand and adaptively instructs and be handed down to the tool self-adapting estimation module in MCU.
The present invention also provides a kind of cross-platform MCU debugging apparatus, and further, the encapsulation unpacks module and is used for root
According to unpack instruction or encapsulation instruction unpacked or encapsulated accordingly, it is described encapsulate the following steps are included:
Step S701 obtains the payload (payload) for needing package and therefrom obtains address, the length of payload
Degree, type of data packet;
Whether effective step S702 judges address, if address is invalid, thens follow the steps S707, terminates package process;If ground
Location is effective, thens follow the steps S703;
Step S703 judges payload command type, if the command type of payload is effective, thens follow the steps
S704 thens follow the steps S707 if the command type of payload is invalid, terminates package process;
Step S704 judges whether the data length of payload is effective, if data length is invalid, thens follow the steps
S707 terminates package process if data length is effective and thens follow the steps S705;
Step S705 carries out assignment to payload;
The good data of package are stored in data field to be sent by step S706.
The present invention also provides a kind of cross-platform MCU debugging apparatus, further, it is described unpack the following steps are included:
Whether step S800, detection frame prefix include high byte, if containing high byte, S801 are thened follow the steps, if not having
High byte returns to step S800, detects to next frame;
Step S801, whether detection frame prefix includes low byte, if thening follow the steps S802 comprising low byte;If not wrapping
Containing low byte, then step S800 is returned to, next frame data are detected;
Step S802 obtains the length of data packet;
Step S803 parses Packet type, judges data packet is which kind of belongs to;
Step S804 obtains payload after unpacking.
The present invention also provides a kind of cross-platform MCU debugging apparatus, and further, log print module is used for debugging
In the process generate log printed, log printing the following steps are included:
Step S901, judges whether logging level matches, if matching, thens follow the steps S902, if mismatching, executes step
Rapid S912;
Step S902 reads the character for needing to print the character string first address in tune-up data packet;
Step S903 judges whether the initial character of the address is that " end mark " terminates if address initial character is end mark
The process;If initial character is not end mark, continue to act in next step;
Step S904 judges whether character is that ' % ' if character is not ' % ' thens follow the steps S910, saves the character;
If character is ' % ', character late is obtained;
Step S905 judges whether character late is x or d, if d, thens follow the steps S906, if x, then executes step
Rapid S908;
Step S906 obtains next parameter;
Step S907, the parameter that will acquire are converted into character to decimal and execute step S910;
Step S908 obtains next parameter;
Step S909, the parameter that will acquire switch to hexadecimal character and execute step S910;
Step S910 saves the character;
Step S911 is directed toward next byte, jumps repetition step S903, until all character prints terminate;
Or the logging level filtering module, for realizing the filtering of print log grade, logging level filtering includes following step
It is rapid:
Step S601 receives the data of upper computer end;
Step S602, the integrality of inspection data packet, if data packet is completely, S603 to be thened follow the steps, if data packet
When imperfect, then terminate the process;
Step S603 carries out parsing to the type of data packet and is put into data packet in corresponding grade according to type;
Step S604 is not required to log selection OFF to be shown, is then printed to needing log to be shown to select ON.
The present invention also provides a kind of cross-platform MCU debugging apparatus, and further, the MCU further includes at least one
Peripheral Interface, Peripheral Interface are configurable for MCU and are communicatively coupled with external measurement equipment, and the Peripheral Interface type includes
SPI interface, USB interface, one of I2C interface, CAN interface, DOIP interface, UART interface, R232 interface or a variety of.
Advantageous effects of the present invention:
1. adjustment method of the invention is compared with prior art, directlys adopt MCU and host computer carries out assembly and adjustment, without adopting
Use special debugging tool as intermediate medium, so that debugging cost reduces, adjustment method flexibility and changeability.Make host computer with
MCU direct communication to be debugged, so that data transmission is more reliable.And can be had according to debugging demand increasing MCU at any time
There is the functional module of special debugging demand, to realize the MCU debugging of different platform.
2. the information that institute's some need exports is placed in memory (caching) by adjustment method of the invention, waiting system is empty
Idle waits externally output, this avoid the time is fought for the task of other high priorities, also takes full advantage of MCU resource.It is existing
Some debugging tools call the data generated when function or order not save, when function call is complete in debugging process
Cheng Hou, the data generated can cover the data that a upper function generates when carrying out next function call.This hair
In the bright data deposit caching by needing externally to export, has the effect of saving resource, function is avoided to be called again.
3. having divided logging level, and logging level filtering module is set, log is filtered.Therefore the present invention has
Powerful filtering function supports Log record.When product is delivered after test, when test, needs to disconnect emulator.Also
It is to say use when traditional debud mode is only applicable to functional development.The operation feelings of program can not be just known in test phase
Condition.The log tracking of tool addition and filtering function can be very good to solve the problems, such as this.The developer's property of can choose mistake
It filters and positions the position of bug with the incoherent log message of bug, fast track.
4. program facilitates transplanting, the debugger and compiler that the MCU of different producers needs are different, and can not be accomplished
It is compatible.The debugging apparatus provided through the invention, it is only necessary to can debug the MCU of debugging function module write-in debugging.
Therefore, debugging tool of the invention relieves the limitation of platform, and the library limitation of the compiler of releasing relieves the limit to debugger
System.
5. the present invention can real time print debugging log can pass through log print module pair when debugging to MCU
The log generated after MCU debugging is printed.
Detailed description of the invention
Only illustratively description and explain the present invention for the following drawings, not delimit the scope of the invention.
Fig. 1 is in the prior art to the debugging flow diagram of MCU.
Fig. 2 is MCU debugging system structural schematic diagram in the embodiment of the present invention.
Fig. 3 is that debugging instruction module includes specific command function modular structure schematic diagram in the embodiment of the present invention.
Fig. 4 is that debugging function module includes specific functional module structure schematic diagram in the embodiment of the present invention.
Fig. 5 is that host computer is handed down to MCU according to debugging demand Start-up and Adjustment instruction and carries out to MCU in the embodiment of the present invention
The flow chart of debugging.
Fig. 6 is that the data that MCU debugging generates in the embodiment of the present invention are sent to the flow chart that host computer is shown.
Specific embodiment
For a clearer understanding of the technical characteristics, objects and effects of the present invention, now control attached drawing 2-6 illustrates this
The specific embodiment of invention, identical label indicates identical part in the various figures.To make simplified form, only showing in each figure
Part related to the present invention is indicated to meaning property, and does not represent its practical structures as product.In addition, so that drawing is simple
It is clean to be easy to understand, with the component of identical structure or function in some figures, one of those is only symbolically depicted, or only
One of those is marked.
It is well known to those skilled in the art to be about control system, any form appropriate can be used, either
Hardware is also possible to software, either multiple functional modules of discrete setting, are also possible to be integrated into more on a hardware
A functional unit.As simplest form, the control system can be controller, such as combinational logic control device, shred
Sequence controller etc., as long as can be realized operation described herein.Certainly, control system can also be used as different modules
It is integrated on a physical equipment, these are all without departing from basic principle and protection scope of the invention.
Embodiment 1:
The present embodiment provides a kind of cross-platform MCU debugging apparatus, referring to fig. 2 to Fig. 4, including host computer 1, MCU 2, on
Position machine 1 includes CPU11, memory module 12, debugging instruction module 13, communication module 14, encapsulation unpacking module 15, CPU11 difference
It unpacks module 15 with memory module 12, debugging module 13, communication module 14, encapsulation and is electrically connected, MCU2 includes CPU21, is adjusted
Try functional module 22, communication module 24, memory module 23, encapsulation unpacking module 25, at least one Peripheral Interface 26.
The communication module 14 of host computer 1 is connect with the communication module 24 in MCU, wherein communication module 14 and communication module 24
Can be using wireless communication or wired communication mode, according to communication, communication can be with WIFI, indigo plant
The modes such as tooth, ultra wide band, 4G, 5G communication, or wireless communication is T-box.Wired communication mode, such as host computer can also be used
The matched interface of 1 and MCU2 phase mutual, can for Ethernet interface, I2C interface, USB interface, RS232 interface, CAN interface,
DOIP interface, UART interface etc..Such as: the communication module 14 of host computer 1 has I2C interface, and the communication module 24 of MCU2 has I2C
Interface, then host computer 1 and MCU2 pass through I2C data line progress wired connection.When using wireless communication, the communication of host computer 1
Module 14 contains wireless communication components, such as has Wifi, and the communication module 24 of MCU2, which has, contains wireless communication components, is
WIFI, host computer 1 can be attached by WIFI and MCU2.Either when host computer 1 is remote computer or server,
It can be attached by T-box and MCU2.
In host computer 1, CPU11 is mainly used for the calling and operation being responsible between each module of system;
Memory module 12 is configurable for the data and debugging instruction journey used required in storage debugging process
Sequence;
Debugging instruction module 13 is configured as calling corresponding debugging instruction program to adjust MCU according to debugging demand
Examination;
Encapsulation unpacks module 15, is configurable for being unpacked or being sealed accordingly according to unpacking instruction or encapsulation instruction
Dress;
Communication module 14 is configurable for host computer and is communicated with external equipment;
In MCU2, MCU that MCU2 can be positive in exploitation, or the MCU completed.
CPU21 is configurable for the calling and operation being responsible between each module of system;
Memory module 23, be configurable for storage debugging process in required for use data, the data of generation and
Debugging function program is data cached etc.;
Debugging function module 22 is configured as the debugging instruction issued according to debugging instruction module and starts corresponding specific function
Energy module debugs MCU, and debugging function module 22 can be increased according to debugging demand or be reduced debugging function;
Communication module 24 is configurable for MCU and is communicated with host computer;
Encapsulation unpacks module 25, is configurable for being unpacked or being sealed accordingly according to unpacking instruction or encapsulation instruction
Dress;
Peripheral Interface 26 is configurable for MCU and is communicatively coupled with external measurement equipment;
Specifically, Peripheral Interface includes multiple and different interface, such as SPI interface, USB, I2C interface, CAN interface, RS232
Different external equipments can be connected in MCU by interface, DOIP interface, UART interface by different types of interface, be led to
The debugging module for crossing host computer debugs external device through MCU.
In particular it is required that it can be directly to be electrically connected or be electrically connected indirectly that is illustrated, which is the electrical connection in the present invention,.
Referring to Fig. 3, debugging instruction module includes:
Log print command module is configured as according to debugging demand starting log print command and is handed down in MCU
Log print module;
Logging level filtering instructions module is configured as according to debugging demand starting log grade filtering instructions and is handed down to
Logging level filtering module in MCU;
Process interaction instruction module is configured as starting according to debugging demand the process interaction between each process and instructs simultaneously
It is handed down to the process interaction module of MCU;
Firmware acquisition instruction module, the instruction for being configured as starting according to debugging demand acquisition firmware are handed down in MCU
Firmware obtains module;
Content write instruction module, the instruction for being configured as starting according to debugging demand content write-in are handed down in MCU
Content writing module;
Content reads instruction module, and the instruction for being configured as starting according to debugging demand content reading is handed down in MCU
Content read module;
Online upgrading instruction module, the instruction for being configured as starting according to debugging demand online upgrading are handed down in MCU
Online upgrading module.
Tool self-adapting estimation instruction module, is configured as starting tool according to demand and adaptively instructs and be handed down to MCU
In tool self-adapting estimation module;
Application layer instruction module is configured as starting the application level function that application layer instruction is handed down in MCU according to demand
Customized module;
Referring to fig. 4, debugging function module includes
Log print module is configured as realizing log printing, according to the instruction of log print command module by log
(log) message is printed out, for informing the operating status of developer's program;
Logging level filtering module is configured as realizing logging level filtering, according to logging level filtering instructions module
Instruction, selectively realize the different grades of log capability of dynamic filtration.Specifically, log is divided into six grades;
Process interaction module is configured as recording the information transmitting between multiple tasks in real time, is referred to according to process interaction
The information between starting multiple tasks is enabled to transmit record;
Firmware obtains module, is configured as obtaining the information of firmware, obtains firmware information according to firmware acquisition instruction;
Content writing module is configured as needing to be written the information of memory and being written to receiving, according to content
Write instruction will be in the memory of corresponding data write-in MCU;
Content read module, is configured as being read out the information that needs are read, and reads instruction to phase according to content
The content answered is read out;
Online upgrading module is configured as upgrading MCU, and basis receives the upgrade command pair from host computer
MCU is upgraded;
Tool self-adapting estimation module, be configured as according to the tool self-adapting estimation of host computer instruct to host computer whether
It is identified with matched serial ports tool;
Application level function customized module is configured as instructing the function progress to application program according to the application layer of host computer
Customization.
Embodiment 2:
This implementation provide it is a kind of to cross-platform MCU adjustment method, referring to figs. 5 and 6 comprising two stages,
One stage, which included host computer, is handed down to MCU according to debugging demand Start-up and Adjustment instruction, MCU receive start after debugging instruction it is corresponding
Debugging function module MCU is debugged;
Second stage includes that the data that generate of MCU debugging are sent to host computer and are shown, the data that MCU debugging generates are extremely
It less include log, log is multiple logging levels according to Type division.In to MCU debugging process, the data that export will be needed
It is temporarily stored into memory, waiting system externally exports when the free time.Or it is no built-in including working as debugging function module in discovery MCU
Preset functional module or according to debugging demand, needs to increase special functional module formula, directly will be containing required by host computer
Functional module write-in MCU in.Specifically such as: such as needing to restore MCU, existing functional module does not have this function
Can, at this point it is possible to which the function program is write direct in MCU by host computer.
Debugging instruction module is configured as calling corresponding debugging instruction program to debug MCU according to debugging demand;
Debugging function module is configured as debugging that is corresponding with debugging instruction module and issuing according to debugging instruction module
Instruction starts corresponding functional module and debugs to MCU.
First stage the following steps are included:
Step S101: instruction is sent by host computer Start-up and Adjustment instruction module according to debugging demand;
Specifically, debugging demand is carried out according to the debugging plan of engineer's formulation, and debugging instruction module is integrated with often
The MCU debugging instruction seen, can also be according to demand automatically by host computer by adding or deleting specific debugging instruction.It adjusts
System instruction be it is predefined, when MCU termination receive corresponding debugging instruction when, debugging function module can refer to according to debugging
It enables and executes corresponding movement.
Step S102, the encapsulation of host computer unpack module and are packaged and form data packet to receiving instruction;
In particular it is required that the data packet of transmission requires to carry out package, so that it is met the standard agreement of transmission can be into
Row transmission.Herein, encapsulation, which unpacks module, to carry out package according to protocol requirement predetermined to the instruction that needs transmit.
Packaged data packet is sent to MCU by step S103, the communication module in host computer;
Specifically, it is the communication module of MCU to host computer that the communication module in host computer, which sends data packet to the process of MCU,
The data packet of transmission received.
The data packet received is stored in memory by the communication module of step S104, MCU;
Encapsulation in step S105, MCU unpacks module and the data packet received is unpacked and instructed;
Debugging function module in step S106, MCU calls the debugging of corresponding function program execution MCU according to instruction.
Specifically, debugging function module is previously written in MCU, the debugging instruction in debugging function module and host computer
Module is corresponding, can carry out corresponding debugging movement according to debugging instruction.If without corresponding debugging function module in MCU,
Debugging function module can be written in MCU by host computer and debugged by it.
Debugging function module includes packaged program, the program of encapsulation directly can be directly write to MCU,
As a result convenient and efficient.
MCU debugging generate data be sent to host computer carry out display at least include the following steps:
Step S201: the data generated to MCU debugging are sent according to debugging demand;
Specifically, debugging demand is to be started according to according to the instruction issued in the first stage by the debugging function in MCU
Corresponding debugging function module debug to MCU, and debugging process can generate the log of a system, debugging result, MCU fortune
The data such as row state need to send these data to host computer and are shown, thus engineer can check these data into
And the debugging result of MCU is analyzed.
Step S202, judges data type;
Specifically, data packet can be generated in debugging process, also can produce order packet, therefore need in data transfer procedure
Judge the type of data packet.
Encapsulation in step S203, MCU unpacks module and carries out package according to demand and data packet is stored in memory;
In particular it is required that the data packet of transmission requires to carry out package, so that it is met the standard agreement of transmission can be into
Row transmission.Herein, encapsulation, which unpacks module, to carry out package according to protocol requirement predetermined to the instruction that needs transmit.
Data packet in memory is sent to host computer by the communication module in step S204, MCU;
Specifically, host computer is sent data in MCU to be carried out by communication module.
Step S205, the encapsulation in host computer unpack module and unpack to received data packet;
Step S206, host computer show the data of unpacking.
Specifically, the data that MCU debugging generates are shown that engineering is the Content inspection that can be shown on host computer
MCU whether there is problem, and problem, data can show the reason of leading to the problem of if it exists, and then engineering can be more easily
It modifies to data.
Debugging function module includes packaged program, the program of encapsulation directly can be directly write to MCU, as a result
It is convenient and efficient.
Embodiment 3
The method for present embodiments providing data encapsulation and data unpacking, unpacks module by encapsulation and completes.
Data encapsulation method the following steps are included:
Step S701 obtains the payload (payload) for needing package and therefrom obtains address, the length of payload
Degree, type of data packet;
In particular it is required that the payload of transmission has existed for, need to carry out package when transmission, according to data
Payload can be just transmitted by the type of packet plus header;
Whether effective step S702 judges address, if address is invalid, thens follow the steps S707, terminates package process;If ground
Location is effective, thens follow the steps S703;
Specifically, it since load data storage is segmentation, carries out searching whether to deposit in storage region according to the address of acquisition
In the address, the address, then illustrate that the address is effective if it exists.The address if it does not exist, then address is invalid.
Step S703 judges payload command type, if the command type of payload is effective, thens follow the steps
S704 thens follow the steps S707 if the command type of payload is invalid, terminates package process;
Specifically, the type of payload is judged, the payload in the present invention includes four seed types, respectively
It is defined as follows: the first kind: 0x01:Log message the second class of packet.: 0x02:CMD message packet.Third
Class: 0x03:Firmware packet.4th class: 0x04:OS Msg packet.If payload is above-mentioned four seed type,
Then think effectively, if payload is not above-mentioned four seed type, then it is assumed that invalid.
Step S704 judges whether the data length of payload is effective, if data length is invalid, thens follow the steps
S807 terminates package process if data length is effective and thens follow the steps S705;
Step S705 carries out assignment to payload;
Specifically, assignment includes the type of data packet to payload according to judgement, data packet length, along with verification letter
Breath, encryption information etc..
The good data of package are stored in data field to be sent by step S706.
Data unpacking method at least includes the following steps:
Step S800, whether detection frame prefix is, if containing high byte, to then follow the steps S801 comprising high byte, if not having
There is high byte, returns to step S800, next frame is detected;
Specifically, by the data packet of encapsulation by including frame prefix (head) and payload (payload), frame prefix
(i.e. header) defines some rules, if two bytes can be used as the opening flag of this data packet, one is exactly frame head
High byte, one is frame head low byte.When unpacking, primarily seeking to analyze frame prefix, data are transmitted with frame,
Therefore frame prefix is detected, is checked whether comprising high byte.
Step S801, when detection frame prefix, have comprising low byte, if thening follow the steps S802 comprising low byte;If not wrapping
Containing low byte, then step S800 is returned to, next frame data are detected;
Specifically, by the data packet of encapsulation by including frame prefix (head) and payload (payload), frame prefix
(i.e. header) defines some rules, if two bytes can be used as the opening flag of this data packet, one is exactly frame head
High byte, one is frame head low byte.When unpacking, primarily seeking to analyze frame prefix, data are transmitted with frame,
Therefore frame prefix is detected, is checked whether comprising low byte.
Step S802 obtains the length of data packet;
Specifically, data transmission comes, and a frame data are generally divided into two sections, respectively frame head (head) and payload
(payload), data packet length information are placed in frame head, therefore pass through analysis frame subheader, it will be able to know the length of data packet
Degree.
Step S803 parses Packet type, judges data packet is which kind of belongs to.
Payload in the present invention includes four seed types, is defined respectively as: the first kind: 0x01:Log message
Packet. the second class: 0x02:CMD message packet. third class: the 4th class of 0x03:Firmware packet.:
0x04:OS Msg packet.During data packet, data type is defined, therefore by frame prefix
It is analyzed, it will be able to know the type of data packet.
Step S804 obtains payload after unpacking;
Specifically, after the frame prefix by analyzing data packet, relevant information is obtained, frame prefix is removed, be left effectively to carry
Lotus.
Embodiment 4:
Developer can call Log interface during developing program, and Log is distributed in the program oneself write
Any position.For the operating status of offline detection system.Programmer can also be concerned about in debugging process some
Variable comes out according to various format prints, and Log can be understood as the window of the only one detection system after off line.Debugging
Log in the process is to send instructions to control log print module and printed under passing through by log print command module, specifically
Log printing process it is as described below:
Step S901, judges whether logging level matches, if matching, thens follow the steps S902, if mismatching, executes step
Rapid S912;
Specifically, logging level is divided into multiple grades by the present invention, if the grade of printing is in defined grade
It is opened when in content and filtering module, then it is assumed that be matched, if the content of printing is not in predefined rate range
Interior or filtering module middle grade range is closed state, then is mismatch.
Step S902 reads the character for needing to print the character string first address in tune-up data packet;
Step S903 judges whether the initial character of the address is that " end mark " is then tied if address initial character is end mark
The beam process.If initial character is not end mark, continue to act in next step.
Specifically, end mark can oneself definition, usually " 0 ".
Step S904 judges whether character is that ' % ' if character is not ' % ' thens follow the steps S910, saves the character;
If character is ' % ', character late is obtained;
Step S905 judges whether character late is x or d, if d, thens follow the steps S906, if x, then executes step
Rapid S908;
Step S906 obtains next parameter;
Step S907, the parameter that will acquire are converted into character to decimal and execute step S910;
Step S908 obtains next parameter;
Step S909, the parameter that will acquire switch to hexadecimal character and execute step S910;
Step S910 saves the character;
Step S911 is directed toward next byte, jumps repetition step S903, until all character prints terminate.
Such as: printing a line debugging log, logPintf (LOG_INFO, " this is test%d 0 ", cnt1,
Cnt2, cnt3),
LOG_INFO is one in multiple grades predetermined, if in the printing of LOG_INFO, logging level filter module
Block, if opening state, LOG_INFO grade is matched.If not the rating-type or logging level filtering module of definition
When close, then mismatch.
If matching, display character " t " is not " % ", then saves " t ", until saving this is test, at this time program
% is gone to, which is %, checks next step character, is d, obtains next parameter cnt1, cnt1 is switched to decimal number
Display.It should be noted that " 0 " is that system loads automatically, do not show actually.Therefore, the content for defaulting " % " is not
Display, it is believed that the character after " % " is cnt1.
In log print procedure, it can be handed down to logging level filtering module by logging level filtering instructions and held
Log can be divided into multiple grades by the filtering of row grade, logging level filtering module, and in the present embodiment, grade includes 6, with closing
Position machine realizes the ability of dynamic filtration different brackets log.
6 grades of Log module definition, respectively debug (debugging message), info (information), (type disappears OsMsg
Breath), Warn (warning), Error (mistake), Fatal (fatal), each waits level logs to be both provided with display (on) or close
(off), type selecting is shown or closed by selection, the log of needs can quickly be found out, be filtered out relevant module.
Such as: if we need to show debug log, debug needs to select On debug message, if to filter out debug
Log, then debug needs to select OFF debug message, other and so on.
Realize that print log grade is filtered through logging level filtering module to complete, specifically includes the following steps:
Step S601 receives the data of upper computer end;
Step S602, the integrality of inspection data packet, if data packet is completely, S603 to be thened follow the steps, if data packet
Be it is incomplete, then terminate the process;
Step S603 carries out parsing to the type of data packet and is put into data packet in corresponding grade according to type;
Step S604 is not required to log selection OFF to be shown, is then printed to needing log to be shown to select ON;
Specifically, when the grade of log module shows ON, then it represents that it needs to print the grade and comes out, if log module etc.
When grade display OFF, then it represents that without printing the logging level;
Debug log is used to record coomand mode during system debug, mainly when some simple function is debugged
It waits and uses, can not have to consider whole system.Because the Log default of this grade is to close when software release.When
After this program development finishes, the log of debug type can be deleted.For example we are when debugging speed, it can be real-time
The vehicle speed value currently acquired from CAN network is printed.It waits this function to carry out completely, then this section of Log is deleted.
Exploitation and debugging because the Log of this grade does not make much sense for system, but for current function is highly useful.
The Log of Info Log Types is primarily used to an operating status of record current system.Stage, it is significant
Movement will use the message of this type after having executed.For example peripheral hardware powers on completion, peripheral hardware initializes successfully.These message
It can inform that commissioning staff has which stage present procedure runs to the operating status of monitoring system.If it find that should print
Info message do not print but, then illustrate that the function of corresponding region is likely to occur failure.
The message of OsMsg Log Types is an interactive process between record the process.As long as process is sent out
Message queue, be all labeled with the label of OsMsg, externally export.Can be according to originating process, target process, command type came
Filter out the message of concern.On the one hand it can detecte the process of burden weight, more resources can be distributed to this kind of processes and be used to
Ensure its normal operation.The operational process that some critical orders carry out more deep understanding system can also be filtered out.
Warn Log Types are primarily used to warning developer, it is possible to mistake have occurred, or carried out illegal behaviour
Make.
The message of ERROR Log Types, which is mainly informed, encounters mistake in developer's program operation process, but this kind of
Mistake has done relevant processing in a program, and function may be failed, but system operation is unaffected.
The message of FATA Log Types is used to inform developer, and system encounters grave error, it is caused the result is that
Program crashing, the serious consequence such as software restarting.
Embodiment 5:
Developer is during debugging MCU, by debugging instruction module in host computer, as log printing,
These instructions are issued to debugging function module in MCU, pass through and start corresponding function by the instructions such as process interaction, content reading
The tune-up data that module generates, these data is stored in memory, it is preferred that be stored in caching, without removing immediately
Waiting system externally exports when the free time, this avoid the time is fought for the task of other high priorities, also takes full advantage of
MCU resource.
Claims (10)
1. a kind of cross-platform MCU adjustment method, applied to the debugging including host computer and MCU, which is characterized in that include at least
Following steps:
Host computer sends after debugging instruction receives debugging instruction to MCU, MCU according to debugging demand Start-up and Adjustment instruction module and opens
Corresponding debugging function module is moved to debug MCU;
Debugging instruction module is configured as calling corresponding debugging instruction program to debug MCU according to debugging demand;
Debugging function module is configured as debugging instruction that is corresponding with debugging instruction module and issuing according to debugging instruction module
Start corresponding certain functional modules to debug MCU.
2. the cross-platform MCU adjustment method of one kind according to claim 1, which is characterized in that further include: MCU debugging produces
Raw data are sent to host computer and are shown, the data that the MCU debugging generates include at least log, and log is drawn according to type
It is divided into multiple logging levels;
In to MCU debugging process, the data that export will be needed to be temporarily stored into memory, waiting system free time when is externally defeated
Out;
Or including when in discovery MCU debugging function module there is no built-in preset functional module or according to debugging demand, need to increase
Add additional functional module, will be directly written in MCU containing required functional module by host computer at this time.
3. the cross-platform MCU adjustment method of one kind according to claim 2, which is characterized in that
The modulation instructions need for debugging instruction to be packaged before issuing MCU, and the MCU is needed to the encapsulation number received
Modulation instructions are obtained after being unpacked according to packet;
The data that the MCU debugging generates need for data to be packaged before being sent to host computer, the host computer needs pair
The encapsulated data packet received obtains the data packet that debugging generates after being unpacked.
4. the cross-platform MCU adjustment method of one kind according to claim 3, which is characterized in that
The data, which are packaged, to be at least included the following steps:
Step S701 obtains the payload for needing package and therefrom obtains address, the length, type of data packet of payload;
Whether effective step S702 judges address, if address is invalid, thens follow the steps S707, terminates package process;If address has
Effect, thens follow the steps S703;
Step S703 judges payload command type, if the command type of payload is effective, thens follow the steps S704, if
The command type of payload is invalid, thens follow the steps S707, terminates package process;
Step S704 judges whether the data length of payload is effective, if data length is invalid, thens follow the steps S707, knot
Beam package process thens follow the steps S705 if data length is effective;
Step S705 carries out assignment to payload;
The good data of package are stored in data field to be sent by step S706.
5. the cross-platform MCU adjustment method of one kind according to claim 3, which is characterized in that
It is described encapsulated data packet is unpacked the following steps are included:
Step S800, whether detection frame prefix is, if containing high byte, to then follow the steps S801 comprising high byte, if without height
Byte returns to step S800, detects to next frame;
Step S801, whether detection frame prefix includes low byte, if thening follow the steps S802 comprising low byte;If not including low
Byte then returns to step S800, detects to next frame data;
Step S802 obtains the length of data packet;
Step S803 parses Packet type, judges data packet is which kind of belongs to;
Step S804 obtains payload after unpacking.
6. the cross-platform MCU adjustment method of one kind according to claim 1, which is characterized in that the debugging instruction module
Including at least log print command module, logging level filtering instructions module, process interaction instruction module, firmware acquisition instruction mould
Block, content write instruction module, content read instruction module, online upgrading instruction module, tool self-adapting estimation instruction module,
One of application layer instruction module is a variety of;
The debugging function module includes at least log print module, logging level filtering module, process interaction module, firmware and obtains
Modulus block, content writing module, content read module, online upgrading module, tool self-adapting estimation module, application level function system
One of cover half block is a variety of.
7. the cross-platform MCU adjustment method of one kind according to claim 6, which is characterized in that
Log print command module is configured as according to debugging demand starting log print command and is handed down to the log in MCU
Print module;
Logging level filtering instructions module is configured as according to debugging demand starting log grade filtering instructions and is handed down to MCU
In logging level filtering module;
Process interaction instruction module, the process interaction for being configured as being started according to debugging demand between each process are instructed and are issued
To the process interaction module of MCU;
Firmware acquisition instruction module is configured as starting the firmware that the instruction for obtaining firmware is handed down in MCU according to debugging demand
Obtain module;
Content write instruction module is configured as starting the content that the instruction that content is written is handed down in MCU according to debugging demand
Writing module;
Content reads instruction module, is configured as starting the content that the instruction that content is read is handed down in MCU according to debugging demand
Read module;
Online upgrading instruction module is configured as being handed down to according to the instruction that debugging demand starts online upgrading online in MCU
Upgraded module;
Tool self-adapting estimation instruction module, is configured as starting tool according to demand and adaptively instructs and be handed down in MCU
Tool self-adapting estimation module;
Application layer instruction module is configured as starting the application layer customization function that application layer instruction is handed down in MCU according to demand
Module;
Log print module is configured as realizing log printing, according to the instruction of log print command module by log information
By being printed out, for informing the operating status of developer's program;
Logging level filtering module is configured as realizing logging level filtering, according to the finger of logging level filtering instructions module
It enables, selectively realizes the different grades of log capability of dynamic filtration;
Process interaction module is configured as recording the information transmitting between multiple tasks in real time, is opened according to process interaction instruction
Information between dynamic multiple tasks transmits record;
Firmware obtains module, is configured as obtaining the information of firmware, obtains firmware information according to firmware acquisition instruction;
Content writing module is configured as needing to be written the information of memory and being written to receiving, is written according to content
Instruction will be in the memory of corresponding data write-in MCU;
Content read module, is configured as being read out the information that needs are read, and reads instruction to corresponding according to content
Content is read out;
Online upgrading module is configured as upgrading MCU, and basis receives the upgrade command from host computer to MCU
Upgraded;
Whether tool self-adapting estimation module, being configured as being instructed according to the tool self-adapting estimation of host computer has host computer
Matched serial ports tool is identified;
Application level function customized module is configured as being instructed according to the application layer of host computer and determine the function of application program
System.
8. the cross-platform MCU adjustment method of one kind according to claim 7, which is characterized in that the log in debugging process
It is to control log print module by sending instructions under log print command module and printed, log printing includes following step
It is rapid:
Step S901, judges whether logging level matches, if matching, thens follow the steps S902, if mismatching, thens follow the steps
S912;
Step S902 reads the character for needing to print the character string first address in tune-up data packet;
Step S903 judges whether the initial character of the address is " end mark ", if address initial character is end mark, terminates the mistake
Journey;If initial character is not end mark, continue to act in next step;
Step S904 judges whether character is that ' % ' if character is not ' % ' thens follow the steps S910, saves the character;If character
It is ' % ', then obtains character late;
Step S905 judges whether character late is x or d, if d, thens follow the steps S906, if x, is thened follow the steps
S908;
Step S906 obtains next parameter;
Step S907, the parameter that will acquire are converted into character to decimal and execute step S910;
Step S908 obtains next parameter;
Step S909, the parameter that will acquire switch to hexadecimal character and execute step S910;
Step S910 saves the character;
Step S911 is directed toward next byte, jumps repetition step S903, until all character prints terminate.
9. the cross-platform MCU adjustment method of one kind according to claim 7, which is characterized in that realize print log grade
Logging level filtering module is filtered through to complete, comprising the following steps:
Step S601 receives the data of upper computer end;
Step S602, the integrality of inspection data packet, if data packet is completely, S603 to be thened follow the steps, if data packet is endless
When whole, then terminate the process;
Step S603 carries out parsing to the type of data packet and is put into data packet in corresponding grade according to type;
Step S604 is not required to log selection OFF to be shown, is then printed to needing log to be shown to select ON;
When the grade of log module shows ON, then it represents that need to print the grade and come out, if the grade of log module shows OFF
When, then it represents that without printing the logging level.
10. the cross-platform MCU adjustment method of one kind according to claim 2, which is characterized in that
The logging level includes at least Debug log, Info log, OsMsg log, Warn log, ERROR log, FATAL
Any two in log;
Debug log: for recording coomand mode during system debug;
Info log a: operating status for recording current system;
OsMsg log: for an interactive process between record the process, as long as the message queue that process is sent out, all by
The label of OsMsg is stamped, is externally exported, can be according to originating process, target process, command type filters out the message of concern;
Warn log: for alerting developer, it is possible to mistake have occurred, or carried out illegal operation;
ERROR log: it informs in developer's program operation process and encounters mistake, but this kind of mistake has been done in a program
Relevant processing, may fail function, but system operation is unaffected;
FATAL log: for informing developer, system encounters grave error, caused the result is that program crashing, software
Restart.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910701812.1A CN110457215B (en) | 2019-07-31 | 2019-07-31 | Cross-platform MCU debugging method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910701812.1A CN110457215B (en) | 2019-07-31 | 2019-07-31 | Cross-platform MCU debugging method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110457215A true CN110457215A (en) | 2019-11-15 |
CN110457215B CN110457215B (en) | 2023-01-10 |
Family
ID=68484288
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910701812.1A Active CN110457215B (en) | 2019-07-31 | 2019-07-31 | Cross-platform MCU debugging method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110457215B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111505977A (en) * | 2020-03-11 | 2020-08-07 | 浙江吉利汽车研究院有限公司 | Function auxiliary debugging method, device, system and medium |
CN112084142A (en) * | 2020-08-10 | 2020-12-15 | 广州汽车集团股份有限公司 | Log storage method and device and T-BOX |
CN112685066A (en) * | 2020-12-25 | 2021-04-20 | 英博超算(南京)科技有限公司 | MCU software agent mode development method for heterogeneous platform |
CN113297217A (en) * | 2021-05-20 | 2021-08-24 | 广州光点信息科技有限公司 | Data transmission method, device and system |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105260315A (en) * | 2015-11-13 | 2016-01-20 | 上海斐讯数据通信技术有限公司 | Method for debugging log in embedded system process |
CN106568168A (en) * | 2016-10-27 | 2017-04-19 | 珠海格力电器股份有限公司 | Debugging method, debugger and system |
CN107305526A (en) * | 2016-04-22 | 2017-10-31 | 深圳市博巨兴实业发展有限公司 | A kind of debugger for microcontroller |
US20180173612A1 (en) * | 2016-12-20 | 2018-06-21 | Undo Ltd. | Debugging method |
CN109902355A (en) * | 2019-01-29 | 2019-06-18 | 中国航空无线电电子研究所 | The method of load data processing unit is laid out in MCU cabinet |
-
2019
- 2019-07-31 CN CN201910701812.1A patent/CN110457215B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105260315A (en) * | 2015-11-13 | 2016-01-20 | 上海斐讯数据通信技术有限公司 | Method for debugging log in embedded system process |
CN107305526A (en) * | 2016-04-22 | 2017-10-31 | 深圳市博巨兴实业发展有限公司 | A kind of debugger for microcontroller |
CN106568168A (en) * | 2016-10-27 | 2017-04-19 | 珠海格力电器股份有限公司 | Debugging method, debugger and system |
US20180173612A1 (en) * | 2016-12-20 | 2018-06-21 | Undo Ltd. | Debugging method |
CN109902355A (en) * | 2019-01-29 | 2019-06-18 | 中国航空无线电电子研究所 | The method of load data processing unit is laid out in MCU cabinet |
Non-Patent Citations (1)
Title |
---|
王海光等: "基于SOPC的M8051嵌入式调试器设计", 《单片机与嵌入式***应用》 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111505977A (en) * | 2020-03-11 | 2020-08-07 | 浙江吉利汽车研究院有限公司 | Function auxiliary debugging method, device, system and medium |
CN111505977B (en) * | 2020-03-11 | 2022-05-10 | 浙江吉利汽车研究院有限公司 | Function auxiliary debugging method, device, system and medium |
CN112084142A (en) * | 2020-08-10 | 2020-12-15 | 广州汽车集团股份有限公司 | Log storage method and device and T-BOX |
CN112685066A (en) * | 2020-12-25 | 2021-04-20 | 英博超算(南京)科技有限公司 | MCU software agent mode development method for heterogeneous platform |
CN112685066B (en) * | 2020-12-25 | 2023-07-07 | 英博超算(南京)科技有限公司 | MCU software agent mode development method of heterogeneous platform |
CN113297217A (en) * | 2021-05-20 | 2021-08-24 | 广州光点信息科技有限公司 | Data transmission method, device and system |
CN113297217B (en) * | 2021-05-20 | 2021-12-17 | 广州光点信息科技有限公司 | Data transmission method, device and system |
Also Published As
Publication number | Publication date |
---|---|
CN110457215B (en) | 2023-01-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110457215A (en) | A kind of cross-platform MCU adjustment method | |
CN110457217A (en) | A kind of cross-platform MCU debugging apparatus | |
CN108227675B (en) | Vehicle diagnosis method, device, terminal and computer-readable storage medium | |
ES2773490T3 (en) | Software-defined implementation method based on protection and control system for smart substation | |
CN105068927A (en) | Keyword drive-based automatic test method of urban rail drive control units | |
CN104050080B (en) | User space debugs the method and system of linux kernel | |
CN108132663A (en) | The analytic method of vehicle trouble messages, device and system | |
CN108304175B (en) | Code file isolation packaging method and device | |
CN106598650A (en) | Device and method for online upgrade of FPGA program based on fiber communication | |
CN107135210A (en) | A kind of simulative automobile communications protocol resolver and its analytic method | |
CN106341294A (en) | Portable MVB (Multifunction Vehicle Bus) protocol analysis apparatus and MVB (Multifunction Vehicle Bus) data processing method | |
CN103514072B (en) | The adjustment method and device of a kind of graphical service for visual programming | |
CN104038262A (en) | Mobile terminal commercial vehicle monitoring system for realizing diagnosis technology and Bluetooth communication under Android platform | |
CN105550118B (en) | debugging system and debugging method | |
CN105491038A (en) | Intelligent device protocol analysis method | |
KR20240047468A (en) | ECU upgrade method and device, and readable storage medium | |
CN110119282A (en) | A kind of internet-of-things terminal and system based on general-purpose built-in type computer | |
CN109901554A (en) | A kind of host computer execution method based on UDS diagnosis | |
CN102063367B (en) | Off-line analysis method and device aiming at computer crash program | |
CN103905233B (en) | Realize method, system and the access network device of analog sensor plug and play | |
CN105847091A (en) | Method, device and system for monitoring network traffic in real time of android system | |
CN107329427A (en) | A kind of M П И bus marcos and information recording method and system | |
CN112506871B (en) | Automated task management and log management method, system, electronic device and medium | |
CN206237428U (en) | A kind of TCN packet captures interface, TCN network test systems | |
CN108196853A (en) | For disposing the method for Android system SDK, storage medium, equipment and 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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |