CN113342322A - Fast embedded programming method and device using Python - Google Patents

Fast embedded programming method and device using Python Download PDF

Info

Publication number
CN113342322A
CN113342322A CN202110717903.1A CN202110717903A CN113342322A CN 113342322 A CN113342322 A CN 113342322A CN 202110717903 A CN202110717903 A CN 202110717903A CN 113342322 A CN113342322 A CN 113342322A
Authority
CN
China
Prior art keywords
python
library
control program
programming
editor
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
Application number
CN202110717903.1A
Other languages
Chinese (zh)
Other versions
CN113342322B (en
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.)
Sichuan Moentropy Information Technology Co ltd
Original Assignee
Sichuan Moentropy Information Technology 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 Sichuan Moentropy Information Technology Co ltd filed Critical Sichuan Moentropy Information Technology Co ltd
Priority to CN202110717903.1A priority Critical patent/CN113342322B/en
Publication of CN113342322A publication Critical patent/CN113342322A/en
Application granted granted Critical
Publication of CN113342322B publication Critical patent/CN113342322B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • 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

Abstract

The invention provides a fast embedded programming method and device using Python, and relates to the field of programming learning. According to the invention, the miniature rectangular PCB board is adopted, so that the occupied space of equipment is reduced, the cost is saved, the four corners are passivated to avoid acute angles from scratching a user, the standard happy hole is formed to match with happy high equipment for learning, the device can be conveniently placed on a happy high toy, and the learning interest is increased by matching with the happy high toy; the wiring process is reduced through the board-to-board connector, and the situation of reverse connection of the lines is avoided; python is used as a language for compiling a control program, and the compiled control program is converted into a C/C + + based control program, so that the size of the program carried by hardware facilities is small, and the reaction rate is high; the invention also has the function of error prompt, the programming Editor checks the Python grammar through the error checking library and prompts, and when the operation error occurs, the programming Editor records the code with the error as a new error correction item in the error checking library and updates the library.

Description

Fast embedded programming method and device using Python
Technical Field
The invention relates to the field of programming learning, in particular to a fast embedded programming method and device using Python.
Background
With the continuous development of internet technology and the continuous prosperity of the internet field, more and more people choose to learn computer languages, and the learning enthusiasm is also continuously increased. Among them, as a very strong programming language in the application field, the number of learners is increasing.
Almost all programming studies currently refer to Python learning, such as training institutions, primary and secondary schools, advanced education, adult skill training, corporate training, etc., while Python learning is currently performed in a web class format, and the practice part is usually performed on a personal computer, which rarely involves learning by controlling external devices through Python.
As is known, new knowledge can be mastered more completely only by combining theory and practice, the existing learning mode lacks a link for realization, and the reason for the new knowledge is mainly that special equipment for learning and practicing Python is also lacked; as Python is a high-level language, it is inherently short in hardware control.
Python is a relatively easy-to-use scripting language with strong community support, and some people in non-computer-professional fields choose it as an entry language. Unfortunately, it does not enable some very low-level manipulations, and is therefore unobtrusive in the hardware domain. If Python is used for hardware development, firstly, the hardware equipment is required to support the Linux operating system, which greatly increases the learning cost for purchasing hardware.
In addition, since the beginner often does not know the hardware, if there is no learning hardware specially aiming at the beginner, the beginner is greatly disturbed by the complicated wiring, the selection and installation of the driving chip, the construction of the network protocol and other steps, thereby influencing the learning progress and learning enthusiasm.
For this purpose, the application numbers are: the invention application of CN201910454130.5 discloses a Python programming creation platform, which comprises the following steps: the Python authoring center firstly registers and logs in the system and has a password forgetting reminding function, password modification can be carried out after the password is forgotten, the work is newly built, the checking and running result can be run after the work is stored, and then the work can be released for browsing and sharing; the Python code is converted into a javascript code through a converter, and the javascript code is run and output in a browser. The Python programming creation platform breaks through the limitation that the traditional Python learning can only run under client software, the writing and running of Python codes become simple and interesting, and the problem that students are not easy to get up and further lose interest in further understanding Python language is solved.
However, the application also does not combine learning Python with hardware, and lacks the function of building a learner thinking system in multiple dimensions.
Therefore, there is a need to provide a fast embedded programming method and apparatus using Python to solve the above-mentioned problems.
Disclosure of Invention
In order to solve the technical problem, the invention provides a fast embedded programming device using Python, which comprises a PCB board, and an MCU main control chip, a power module group, a communication module group, a driving module group and a control module group which are arranged on the PCB board; the MCU main control chip is electrically connected with the power module group, the communication module group, the driving module group and the control module group through PCB wiring respectively;
the PCB is a miniature rectangular PCB, and four corners of the rectangle are passivated; the PCB is also subjected to size compression through double-sided wiring, and standard Legao holes are formed in the four corners of the rectangle respectively;
the power supply module group comprises three paths of voltage-stabilized power supply modules, a MicroUSB power supply interface and an external lithium battery interface, wherein the MicroUSB power supply interface and the external lithium battery interface are respectively electrically connected with the three paths of voltage-stabilized power supply modules; the three paths of voltage stabilizing power supply modules are electrically connected with the MCU main control chip and provide stable working electric energy for the whole fast embedded programming device;
the driving module group comprises a motor driving module, a steering engine driving module, a sensor access module and a user-defined pin arranging group; the motor driving module, the steering engine driving module, the sensor access module and the user-defined pin arranging group are respectively and electrically connected with the MCU main control chip;
the communication module group comprises a WIFI communication module, a Bluetooth communication module and a MicroUSB serial port communication module; the WIFI communication module, the Bluetooth communication module and the MicroUSB serial port communication module are electrically connected with the MCU main control chip respectively;
the control module group includes programmable button group and full-color LED lamp, programmable button group and full-color LED lamp all with MCU main control chip electric connection.
As a more specific solution, the MCU master control chip establishes a connection with a corresponding external hardware device through a driver module group; a board-to-board connector electrically connected with the driving module corresponding to the driving module group is arranged on the PCB; the board-to-board connector is PH2.03Pin and/or PH2.04Pin; the external hardware equipment is connected with the driving module group through the corresponding wire-to-board connector, and when the board-to-board connector is connected with the wire-to-board connector in a matched mode, the circuit is prevented from being reversely connected through the buckle structure.
As a more specific solution, a user of the fast embedded programming device writes a control program for the fast embedded programming device through Python, and the writing of the control program is performed in a Python embedded programming system; the Python embedded programming system maps a control program written based on Python into a control program based on C/C + + and recompiles the control program; the recompiled control program is burnt into the MCU main control chip of the fast embedded programming device through the communication module group; and the MCU main control chip controls and operates each module on the PCB and the external hardware equipment for establishing connection by executing a control program.
As a more specific solution, the Python embedded programming system includes a programming Editor, a mapping table and a mapping library; the programming Editor is a programming Editor of a Python language, and a user writes a control program aiming at the fast embedded programming device in the programming Editor by using the Python language; converting a control program written based on Python into a control program based on C/C + + through a mapping table and a mapping library and recompiling; the mapping library stores library files of function modules and function functions used by the control program, and the library files are written in C/C + +; the mapping table stores the mapping relation between the function module and function called by Python and the library file stored in the mapping library, and when the control program written by Python calls the function module or function, the address of the corresponding library file is found through the mapping table; and during paraphrasing, paraphrasing the calling function module or function through the corresponding library file, and obtaining the control program based on C/C + +.
As a more specific solution, the mapping library is a static library, the library file includes a Binary interface and a mapping structure, and the Binary interface internally realizes correspondence after receiving corresponding interface information; the mapping structure comprises a corresponding relation between python dit and c map, class and a parameter set, wherein the mapping structure is realized by string encoded by utf 8.
As a more specific solution, the programming Editor can also automatically recycle the memory; the programming Editor triggers an automatic memory recovery function when a control program written based on Python is explained; the reclaimed memory objects are memory in the mapping library that is unused, not declared, and not used beyond a threshold time.
As a more specific solution, in the process of converting a control program written based on Python into a control program based on C/C + + through a mapping table and a mapping library, a mixed intermediate file is constructed, the mixed intermediate file is a binary code file, the Python file is converted into a mixed intermediate file through a conversion engine, and a corresponding relationship between each byte code and a Python source code is recorded in the mixed intermediate file; and at the time of compiling, performing mixed compiling on the mixed intermediate file and the C/C + + language so as to hide the codes.
As a more specific solution, the programming Editor also has automatic connection and burning of the MCU device, and when the fast embedded programming device is scanned by the programming Editor, the programming Editor automatically sends handshake information to the fast embedded programming device, i.e., requests to access the fast embedded programming device; after the link is established, the programming Editor can continuously transmit heartbeat information to check whether the short line condition occurs or not;
when heartbeat information is continuously transmitted to the fast embedded programming device, the programming Editor continuously scans Flash in the MCU main control chip and records and backups the Flash;
when a control program written by Python needs to be burned into the fast embedded programming device, the programming Editor automatically compiles the codes into a mixed intermediate file and adds a library file used by the codes into an operating environment, and the codes can be operated quickly when the fast embedded programming device is restarted.
As a more specific solution, when a Python-based control program is written, the programming Editor also has an error prompt function, the programming Editor checks Python syntax through an error check library and prompts the Python syntax, and when an operation error occurs, the programming Editor records a code with the error as a new error correction item in the error check library and updates the library.
As a more specific solution, the programming Editor also accesses a pip library, and expands a hardware and/or software interface through the pip library.
Compared with the related art, the fast embedded programming method and device using Python provided by the invention have the following beneficial effects:
1. the quick embedded programming device adopts the miniature rectangular PCB to occupy less space and save cost, the four corners are passivated to avoid acute angles from scratching a user, the standard happy high holes are formed at the four corners of the rectangle to match with happy high equipment for learning, the device can be conveniently placed on a happy high toy, and the learning interest is increased by matching with the happy high toy;
2. compared with most of the conventional interfaces which adopt needle type interfaces, the YH line and the PH2.0 line with the buckle are easy to reversely connect, and reverse connection can be prevented through the PH2.0 interface, but the PH2.0 interface is not easy to pull out, so that the risk of equipment damage is increased, and the structure of the invention is convenient to lock when being inserted on one hand and pull out on the other hand;
3. the quick embedded programming method takes Python as a language for writing a control program, and the written control program is converted into a control program based on C/C + +, so that hardware is better controlled, the size of the program carried by hardware facilities is small, and the reaction rate is high;
4. the invention also has the function of error prompt, the programming Editor checks the Python grammar through the error checking library and prompts, and when the operation error occurs, the programming Editor records the code with the error as a new error correction item in the error checking library and updates the library.
Drawings
FIG. 1 is a block diagram of a fast embedded programming device using Python according to a preferred embodiment of the present invention;
FIG. 2 is a flowchart of a fast embedded programming method using Python according to a preferred embodiment of the present invention.
Detailed Description
The invention is further described with reference to the following figures and embodiments.
As shown in fig. 1 to 2, the fast embedded programming device using Python of the present invention includes a PCB board, and an MCU main control chip, a power module group, a communication module group, a driving module group, and a control module group mounted on the PCB board; the MCU main control chip is electrically connected with the power module group, the communication module group, the driving module group and the control module group through PCB wiring respectively.
Specifically, a programming language learner usually does not have enough knowledge about hardware devices, so that it is extremely unrealistic to set up a hardware learning environment by himself at the beginning, necessary hardware modules are combined together to facilitate the learner to use directly, and through learning a programming process, the learner learns the hardware structure and an interaction mode between the hardware structure and the hardware device, and thus, the learner can learn step by step.
The PCB is a miniature rectangular PCB, and four corners of the rectangle are passivated; the PCB is further subjected to size compression through double-sided wiring, and standard Happy and tall holes are further formed in the four corners of the rectangle respectively.
Furthermore, the miniature rectangular PCB board is adopted to occupy less space of equipment and save cost, the four corners are passivated to avoid acute angles from scratching a user, the standard happy high holes are formed in the four corners of the rectangle to match with happy high equipment for learning, the device can be conveniently placed on a happy high toy, and the learning interest is increased by matching with the happy high toy.
The power supply module group comprises three paths of voltage-stabilized power supply modules, a MicroUSB power supply interface and an external lithium battery interface, wherein the MicroUSB power supply interface and the external lithium battery interface are respectively electrically connected with the three paths of voltage-stabilized power supply modules; and the three paths of voltage stabilizing power supply modules are electrically connected with the MCU main control chip and provide stable working electric energy for the whole fast embedded programming device.
Specifically, adopt different power to provide the form in order to match different use scenes, the micro USB power is used for connecting the computer and provides stable power when debugging, and external lithium cell interface enables equipment to break away from hardware connection's constraint, settles on happy high toy etc..
The driving module group comprises a motor driving module, a steering engine driving module, a sensor access module and a user-defined pin arranging group; and the motor driving module, the steering engine driving module, the sensor access module and the user-defined pin arranging group are respectively and electrically connected with the MCU main control chip.
It should be noted that: the driver module group is mainly used for matching with each external device, when the external devices are matched, a beginner often cannot master correct matching driver, circuit layout and the like, and the most frequently-used module for controlling hardware devices is integrated on the PCB
The communication module group comprises a WIFI communication module, a Bluetooth communication module and a MicroUSB serial port communication module; and the WIFI communication module, the Bluetooth communication module and the MicroUSB serial port communication module are electrically connected with the MCU main control chip respectively.
The common communication module is integrated on the PCB, so that a user can directly use the PCB, and the PCB is convenient and quick.
The control module group includes programmable button group and full-color LED lamp, programmable button group and full-color LED lamp all with MCU main control chip electric connection.
The control module group that this implementation was added can come the running state of controlling means through the button, and full-color LED lamp can real-time display device's running state etc..
As a more specific solution, the MCU master control chip establishes a connection with a corresponding external hardware device through a driver module group; a board-to-board connector electrically connected with the driving module corresponding to the driving module group is arranged on the PCB; the board-to-board connector is PH2.03Pin and/or PH2.04Pin; the external hardware equipment is connected with the driving module group through the corresponding wire-to-board connector, and when the board-to-board connector is connected with the wire-to-board connector in a matched mode, the circuit is prevented from being reversely connected through the buckle structure.
It should be noted that: most of interfaces at present adopt the easy transposition of needle type interface, and can prevent the transposition through PH2.0 interface, but PH 2.0's design can not pull out easily, has increased the risk of equipment damage, and we have used the YH line here, and the PH2.0 line of taking the buckle conveniently locks when inserting on the one hand, and on the other hand is conveniently pulled out. The user can start to link peripheral equipment by using only one 3PIN or 4PIN line when the external hardware equipment is connected through the board-to-board connector, so that a large amount of wiring is saved. If the ultrasonic sensor is used for controlling the 2-path motor, at least 4 lines of ultrasonic GND, ECHO, Trig and VCC4 +2 lines of positive and negative motor poles are 8 lines, while in the invention, only 3 lines are needed, meanwhile, since a beginner is not aware of hardware equipment, the hardware equipment is easily damaged due to reverse connection of lines and the like, unnecessary economic loss and time loss are caused, and the reverse connection of the lines is avoided through a buckle structure, thereby enhancing the practicability of the device.
As a more specific solution, a user of the fast embedded programming device writes a control program for the fast embedded programming device through Python, and the writing of the control program is performed in a Python embedded programming system; the Python embedded programming system maps a control program written based on Python into a control program based on C/C + + and recompiles the control program; the recompiled control program is burnt into the MCU main control chip of the fast embedded programming device through the communication module group; and the MCU main control chip controls and operates each module on the PCB and the external hardware equipment for establishing connection by executing a control program.
Specifically, the method comprises the following steps: the Python is a beginner-friendly language which is very convenient for beginners to understand, but the learning of the Python is usually carried out through a pure software platform, learners lack contact with hardware interaction and the like, but the operation capability of the Python as a high-level language on a hardware bottom layer is very limited, so that embedded equipment of the Python can be carried, the performance requirement is high, and the control reaction speed is not ideal.
In order to solve the above problem, in this embodiment, a Python embedded programming system maps a control program written based on Python into a control program based on C/C + + and recompils the control program; the C/C + + is a language close to the bottom layer of the hardware, but the learning difficulty is large, and a beginner often difficultly learns the control program quickly.
As a more specific solution, the Python embedded programming system includes a programming Editor, a mapping table and a mapping library; the programming Editor is a programming Editor of a Python language, and a user writes a control program aiming at the fast embedded programming device in the programming Editor by using the Python language; converting a control program written based on Python into a control program based on C/C + + through a mapping table and a mapping library and recompiling; the mapping library stores library files of function modules and function functions used by the control program, and the library files are written in C/C + +; the mapping table stores the mapping relation between the function module and function called by Python and the library file stored in the mapping library, and when the control process written by Python calls the function module or function, the address of the corresponding library file is found through the mapping table; and during paraphrasing, paraphrasing the calling function module or function through the corresponding library file, and obtaining the control program based on C/C + +.
Further, in this embodiment, the conversion is achieved by mapping the calling function module or function used by Python writing to the calling function module or function based on C/C + +, the conversion process is performed automatically in the background, and the foreground user cannot feel the conversion process, so that the control program is written by Python.
As a more specific solution, the mapping library is a static library, the library file includes a Binary interface and a mapping structure, and the Binary interface internally realizes correspondence after receiving corresponding interface information; the mapping structure comprises a corresponding relation between python dit and c map, class and a parameter set, wherein the mapping structure is realized by string encoded by utf 8.
As a more specific solution, the programming Editor can also automatically recycle the memory; the programming Editor triggers an automatic memory recovery function when a control program written based on Python is explained; the reclaimed memory objects are memory in the mapping library that is unused, not declared, and not used beyond a threshold time.
In particular, for high-speed operation of the MCU, a mode of asynchronous operation is usually used, i.e. instruction interpretation gives that C + + is running at high speed (nm level), and the state information obtained by python is delayed. The python itself is used as an explanatory language, the memory recovery is weak, the automatic memory recovery function is designed and realized in C + +, and the recovered memory object is the memory which is not used, not declared and not used after exceeding the threshold time in the mapping library. When python is used, the use condition of the memory is not necessary to be concerned, and other modules can be realized by using the transmission mode of the lower-layer implementation through the interface, even the function bottom layer binary of the lower-layer implementation in StringIO direct mapping C + +.
As a more specific solution, in the process of converting a control program written based on Python into a control program based on C/C + + through a mapping table and a mapping library, a mixed intermediate file is constructed, the mixed intermediate file is a binary code file, the Python file is converted into a mixed intermediate file through a conversion engine, and a corresponding relationship between each byte code and a Python source code is recorded in the mixed intermediate file; and at the time of compiling, performing mixed compiling on the mixed intermediate file and the C/C + + language so as to hide the codes.
Specifically, the implementation provides a python intermediate file (xpy file), wherein xpy is a binary code file, the python executes the binary code file, 126 byte codes are defined in a conversion engine together, so that the py is compiled into xpy codes, and the corresponding relation between each byte code and a python source code is recorded in a xpy file, and the file is compiled in a mixed manner with C during compilation, so that more upper-layer implementation modules can be conveniently integrated in a system, and the file can be implemented by compiling hidden codes, and subsequent commercial secondary development is facilitated.
The reason that more upper-layer codes can be realized is that all added python files are scanned during compiling and are realized through the mapping relation, and the modules called by the bottom layer are almost completely realized up and down, so that the python files are more functional logic files, and only the same name class can be generated at the bottom layer.
As a more specific solution, the programming Editor also has automatic connection and burning of the MCU device, and when the fast embedded programming device is scanned by the programming Editor, the programming Editor automatically sends handshake information to the fast embedded programming device, i.e., requests to access the fast embedded programming device; after the link is established, the programming Editor can continuously transmit heartbeat information to check whether the short line condition occurs or not;
when heartbeat information is continuously transmitted to the fast embedded programming device, the programming Editor continuously scans Flash in the MCU main control chip and records and backups the Flash;
when a control program written by Python needs to be burned into the fast embedded programming device, the programming Editor automatically compiles the codes into a mixed intermediate file and adds a library file used by the codes into an operating environment, and the codes can be operated quickly when the fast embedded programming device is restarted.
As a more specific solution, when a Python-based control program is written, the programming Editor also has an error prompt function, the programming Editor checks Python syntax through an error check library and prompts the Python syntax, and when an operation error occurs, the programming Editor records a code with the error as a new error correction item in the error check library and updates the library.
As a more specific solution, the programming Editor also accesses a pip library, and expands a hardware and/or software interface through the pip library.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A fast embedded programming device using Python is characterized by comprising a PCB, and an MCU main control chip, a power module group, a communication module group, a driving module group and a control module group which are arranged on the PCB; the MCU main control chip is electrically connected with the power module group, the communication module group, the driving module group and the control module group through PCB wiring respectively;
the PCB is a miniature rectangular PCB, and four corners of the rectangle are passivated; the PCB is also subjected to size compression through double-sided wiring, and standard Legao holes are formed in the four corners of the rectangle respectively;
the power supply module group comprises three paths of voltage-stabilized power supply modules, a MicroUSB power supply interface and an external lithium battery interface, wherein the MicroUSB power supply interface and the external lithium battery interface are respectively electrically connected with the three paths of voltage-stabilized power supply modules; the three paths of voltage stabilizing power supply modules are electrically connected with the MCU main control chip and provide stable working electric energy for the whole fast embedded programming device;
the driving module group comprises a motor driving module, a steering engine driving module, a sensor access module and a user-defined pin arranging group; the motor driving module, the steering engine driving module, the sensor access module and the user-defined pin arranging group are respectively and electrically connected with the MCU main control chip;
the communication module group comprises a WIFI communication module, a Bluetooth communication module and a MicroUSB serial port communication module; the WIFI communication module, the Bluetooth communication module and the MicroUSB serial port communication module are electrically connected with the MCU main control chip respectively;
the control module group includes programmable button group and full-color LED lamp, programmable button group and full-color LED lamp all with MCU main control chip electric connection.
2. The fast embedded programming device using Python according to claim 1, wherein the MCU master control chip establishes a connection with a corresponding external hardware device through a driver module group; a board-to-board connector electrically connected with the driving module corresponding to the driving module group is arranged on the PCB; the board-to-board connector is PH2.03Pin and/or PH2.04Pin; the external hardware equipment is connected with the driving module group through the corresponding wire-to-board connector, and when the board-to-board connector is connected with the wire-to-board connector in a matched mode, the circuit is prevented from being reversely connected through the buckle structure.
3. A fast embedded programming method using Python, which is applied to the fast embedded programming device using Python according to any one of claims 1 to 2, wherein a user of the fast embedded programming device writes a control program for the fast embedded programming device by Python, and the writing of the control program is performed in the Python embedded programming system; the Python embedded programming system maps a control program written based on Python into a control program based on C/C + + and recompiles the control program; the recompiled control program is burnt into the MCU main control chip of the fast embedded programming device through the communication module group; and the MCU main control chip controls and operates each module on the PCB and the external hardware equipment for establishing connection by executing a control program.
4. The fast embedded programming method using Python according to claim 3, wherein the Python embedded programming system comprises a programming Editor, a mapping table and a mapping library; the programming Editor is a programming Editor of a Python language, and a user writes a control program aiming at the fast embedded programming device in the programming Editor by using the Python language; converting a control program written based on Python into a control program based on C/C + + through a mapping table and a mapping library and recompiling; the mapping library stores library files of function modules and function functions used by the control program, and the library files are written in C/C + +; the mapping table stores the mapping relation between the function module and function called by Python and the library file stored in the mapping library, and when the control program written by Python calls the function module or function, the address of the corresponding library file is found through the mapping table; and during paraphrasing, paraphrasing the calling function module or function through the corresponding library file, and obtaining the control program based on C/C + +.
5. The fast embedded programming method using Python according to claim 4, wherein the mapping library is a static library, the library file includes a Binary interface and a mapping structure, and the Binary interface internally realizes correspondence after receiving corresponding interface information; the mapping structure comprises a corresponding relation between python dit and c map, class and a parameter set, wherein the mapping structure is realized by string encoded by utf 8.
6. The fast embedded programming method using Python according to claim 4, wherein the programming Editor can also automatically recycle the memory; the programming Editor triggers an automatic memory recovery function when a control program written based on Python is explained; the reclaimed memory objects are memory in the mapping library that is unused, not declared, and not used beyond a threshold time.
7. The method according to claim 4, wherein in the process of converting a Python-based written control program into a C/C + + based control program through the mapping table and the mapping library, a mixed intermediate file is constructed, the mixed intermediate file is a binary code file, the Python file is converted into the mixed intermediate file through the conversion engine, and the corresponding relationship between each byte code and the Python source code is recorded in the mixed intermediate file; and at the time of compiling, performing mixed compiling on the mixed intermediate file and the C/C + + language so as to hide the codes.
8. The fast embedded programming method using Python according to claim 7, wherein the programming Editor further has an automatic connection and burning of the MCU device, and when the fast embedded programming device is scanned by the programming Editor, the programming Editor automatically sends handshake information to the fast embedded programming device, that is, requests to access the fast embedded programming device; after the link is established, the programming Editor continuously transmits heartbeat information to the fast embedded programming device to check whether the short line condition occurs;
when heartbeat information is continuously transmitted to the fast embedded programming device, the programming Editor continuously scans Flash in the MCU main control chip and records and backups the Flash;
when a control program written by Python needs to be burned into the fast embedded programming device, the programming Editor automatically compiles the codes into a mixed intermediate file and adds a library file used by the codes into an operating environment, and the codes can be operated quickly when the fast embedded programming device is restarted.
9. The fast embedded programming method using Python according to claim 4, wherein when writing the Python-based control program, the programming Editor has an error prompt function, the programming Editor checks the Python syntax through the error checking library and prompts, and when an operation error occurs, the programming Editor records the code with the error as a new error correction item in the error checking library and updates the library.
10. The fast embedded programming method using Python according to claim 4, wherein the programming Editor accesses the pip library and extends the hardware and/or software interface through the pip library.
CN202110717903.1A 2021-06-28 2021-06-28 Quick embedded programming method and device using Python Active CN113342322B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110717903.1A CN113342322B (en) 2021-06-28 2021-06-28 Quick embedded programming method and device using Python

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110717903.1A CN113342322B (en) 2021-06-28 2021-06-28 Quick embedded programming method and device using Python

Publications (2)

Publication Number Publication Date
CN113342322A true CN113342322A (en) 2021-09-03
CN113342322B CN113342322B (en) 2023-06-23

Family

ID=77479198

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110717903.1A Active CN113342322B (en) 2021-06-28 2021-06-28 Quick embedded programming method and device using Python

Country Status (1)

Country Link
CN (1) CN113342322B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113939062A (en) * 2021-10-11 2022-01-14 上海海迅机电工程有限公司 Chip control method of intelligent LED lamp strip controller

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180285241A1 (en) * 2017-03-28 2018-10-04 Carnegie Mellon University Energy-interference-free debugger for intermittent energy-harvesting systems
US20180364991A1 (en) * 2015-06-24 2018-12-20 Toi Srl Method and system for preparing code to be executed by programmable control devices
US10831456B1 (en) * 2019-05-31 2020-11-10 The Mathworks, Inc. External code integrations within a computing environment
US20210103418A1 (en) * 2019-08-16 2021-04-08 Argineering, Inc. System And Method For Transforming Static Displays To Interactive Spaces

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180364991A1 (en) * 2015-06-24 2018-12-20 Toi Srl Method and system for preparing code to be executed by programmable control devices
US20180285241A1 (en) * 2017-03-28 2018-10-04 Carnegie Mellon University Energy-interference-free debugger for intermittent energy-harvesting systems
US10831456B1 (en) * 2019-05-31 2020-11-10 The Mathworks, Inc. External code integrations within a computing environment
US20210103418A1 (en) * 2019-08-16 2021-04-08 Argineering, Inc. System And Method For Transforming Static Displays To Interactive Spaces

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113939062A (en) * 2021-10-11 2022-01-14 上海海迅机电工程有限公司 Chip control method of intelligent LED lamp strip controller

Also Published As

Publication number Publication date
CN113342322B (en) 2023-06-23

Similar Documents

Publication Publication Date Title
CN110362299B (en) Online graphical programming system based on block and raspberry pie and using method thereof
CN101630258A (en) Embedded Linux software integration development system on Windows platform and construction method thereof
CN109271144A (en) A kind of cloud the integration environment development approach for study
CN113342322A (en) Fast embedded programming method and device using Python
CN109523899A (en) A kind of open source robot
Wallace et al. Getting started with raspberry pi
Pi Camera module
Devine et al. Plug-and-play physical computing with Jacdac
Chedup et al. Performance comparison of arduino ide and runlinc ide for promotion of iot stem ai in education process
CN111367579B (en) Processor in-loop simulation method based on V-REP plug-in
CN111158648B (en) Interactive help system development method based on live-action semantic understanding and platform thereof
Blum et al. Python Programming for Raspberry Pi
CN208421812U (en) A kind of electronic interface modules
Bolanakis et al. Nowadays trends in microcontroller education: Do we educate engineers or electronic hobbyists? Recommendation on a multi-platform method and system for lab training activities
Richardson Getting Started with Intel Galileo: Electronic Projects with the Quark-Powered Arduino-Compatible Board
CN107491313B (en) Embedded teaching system control method and device
Delman et al. Development of a system for teaching CS1 in C/C++ with Lego NXT robots.
CN111489618A (en) Card-inserting type single-chip microcomputer suite for computer programming teaching
Blum et al. Python Programming for Raspberry Pi, Sams Teach Yourself in 24 Hourss
CN219039743U (en) AI core plate of 160Pin interface
Staub Logo Environments in the Focus of Time
CN209087224U (en) A kind of Electronic Process Practical Course external member
Fruett et al. Empowering STEAM Activities With Artificial Intelligence and Open Hardware: The BitDogLab
Yau Learning BeagleBone
Clark Practical Tinker Board: Getting Started and Building Projects with the ASUS Single-Board Computer

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