CN113342322B - Quick embedded programming method and device using Python - Google Patents

Quick embedded programming method and device using Python Download PDF

Info

Publication number
CN113342322B
CN113342322B CN202110717903.1A CN202110717903A CN113342322B CN 113342322 B CN113342322 B CN 113342322B CN 202110717903 A CN202110717903 A CN 202110717903A CN 113342322 B CN113342322 B CN 113342322B
Authority
CN
China
Prior art keywords
python
programming
library
control program
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.)
Active
Application number
CN202110717903.1A
Other languages
Chinese (zh)
Other versions
CN113342322A (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

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a quick embedded programming method and device using Python, and relates to the field of programming learning. The miniature rectangular PCB board is adopted, so that the occupied space of equipment is reduced, the cost is saved, the passivation of four corners is used for avoiding acute angles from scratching a user, the standard music instrument holes are formed for matching the music instrument for learning, the device can be conveniently placed on the music instrument, and the learning pleasure is increased by matching the music instrument; the wiring flow is reduced through the board-to-wire connector, and meanwhile, the situation of reverse connection of the circuit is avoided; python is used as a language for programming a control program, the programmed control program is converted into a control program based on C/C++, so that the volume of a program carried by a hardware facility is small, and the reaction rate is high; the invention also has the function of error prompt, the programming Editor checks and prompts the Python grammar through the error checking library, when the operation error occurs, the programming Editor records the misplaced code as a new error correction item in the error checking library, and updates the library.

Description

Quick embedded programming method and device using Python
Technical Field
The invention relates to the field of programming learning, in particular to a method and a device for quickly embedding programming by using Python.
Background
With the continuous development of internet technology and continuous prosperity of the internet field, more and more people choose to learn computer languages, and the enthusiasm of learning is also continuously increased. Among them, python is used as a programming language with a strong application field, and learners thereof are increasing.
While almost all programming learning currently involves Python learning, like training institutions, middle and primary schools, higher education, adult skill training, corporate training, etc., python is currently usually done in the form of net lessons, and practice is usually done on personal computers, rarely involving learning by Python controlling external devices.
As is well known, the theory and practice are combined to master new knowledge more completely, the existing learning mode lacks an implementation link, and the reason is mainly that special equipment for learning practice Python is lacking; since Python is a high-level language, a short board is naturally involved in hardware control.
Python is a scripting language that is relatively easy to handle, and has strong community support, and some people in non-computer-specialized fields choose it as a entry language. Unfortunately, it does not enable some very underlying manipulations, so it is not attractive in the hardware domain. If Python is used for hardware development, the hardware device is required to support the Linux operating system first, which greatly increases the learning cost of purchasing hardware.
In addition, since the beginner does not know the hardware, if the beginner does not learn the hardware specifically, the beginner is very likely to be complicated in wiring, the steps of selecting and installing a driving chip, constructing a network protocol and the like are blocked, so that the learning progress and the learning enthusiasm of the beginner are affected.
For this purpose, the application number is: the invention application of CN201910454130.5 discloses a Python programming authoring platform, comprising the following steps: the Python creation center registers the login system, has the function of reminding the forgotten password, can modify the password after forgetting the password, creates a new work, can run and check and run results after being stored, and can issue for browsing and sharing; the Python code is converted into a javascript code through a converter, and the javascript code is output in a browser. The Python programming creation platform breaks through the limitation that the traditional Python learning can only be operated under client software, and the Python code is simple and interesting to write and operate, so that the problem that students are not easy to get on hand and further lose interest in further learning the Python language is solved.
However, the application also does not combine learning Python with hardware, and lacks the effect of building a learner's thinking system in multiple dimensions.
Therefore, there is a need to provide a method and apparatus for fast embedded programming using Python to solve the above-mentioned problems.
Disclosure of Invention
In order to solve the technical problems, the invention provides a quick embedded programming device using Python, which comprises 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 respectively and electrically connected with the power module group, the communication module group, the driving module group and the control module group through PCB wiring;
the PCB is a miniature rectangular PCB, and four corners of the rectangle are all subjected to passivation treatment; the PCB board is also subjected to size compression through double-sided wiring, and standard Happy holes are respectively formed at four corners of the rectangle;
the power module group comprises three paths of voltage-stabilizing power modules, a micro USB power interface and an external lithium battery interface, and the micro USB power interface and the external lithium battery interface are respectively and electrically connected with the three paths of voltage-stabilizing power modules; the three-way voltage-stabilizing power supply module is electrically connected with the MCU main control chip and provides stable working electric energy for the whole rapid embedded programming device;
the driving module group comprises a motor driving module, a steering engine driving module, a sensor access module and a self-defined pin arranging group; the motor driving module, the steering engine driving module, the sensor access module and the custom pin array 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 respectively and electrically connected with the MCU main control chip;
the control module group comprises a programmable button group and a full-color LED lamp, and the programmable button group and the full-color LED lamp are electrically connected with the MCU main control chip.
As a more specific solution, the MCU main control chip establishes connection with corresponding external hardware equipment through a driving module group; a board-to-wire connector which is electrically connected with the driving module corresponding to the driving module group is arranged on the PCB; the board-to-wire connector is of the model PH2.0 Pin and/or PH2.0 Pin; the external hardware equipment establishes connection with the driving module group through the corresponding wire-to-board connector, and when the board-to-wire connector is connected with the wire-to-board connector in a matching way, the circuit reverse connection is avoided through the buckle structure.
As a more specific solution, the user of the fast embedded programming device writes a control program for the fast embedded programming device through Python, wherein 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 recompilation; the recompiled control program is burnt into an MCU main control chip of the rapid embedded programming device through a communication module group; and the MCU main control chip performs control operation on 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 Python language programming Editor, and a user writes a control program for 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 functional modules and functional functions used by the control program, and the library files are written in C/C++; the mapping table stores the mapping relation between the Python called function module and function and the library file stored in the mapping library, and when the Python written control program calls the function module or function, the mapping table finds the address of the corresponding library file; and when the definition is released, the definition of the calling function module or the function is released through the corresponding library file, and a control program based on C/C++ is obtained.
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 the correspondence after receiving the corresponding interface information; the mapping structure comprises a corresponding relation between python direct and c map, class and parameter set, wherein the mapping structure is realized through utf8 coding string.
As a more specific solution, the programming Editor can also automatically recycle the memory; the programming Editor triggers the function of automatically recovering the memory when interpreting a control program written based on Python; the reclaimed memory object is the unused, non-declared and unused memory beyond the threshold time in the mapping library.
As a more specific solution, in the process that a control program written based on Python is converted into a control program based on C/C++ through a mapping table and a mapping library, the control program is carried out by constructing a mixed intermediate file, wherein the mixed intermediate file is a binary code file, the Python file is converted into a mixed intermediate file through a conversion engine, and the corresponding relation between each byte code and Python source code is recorded in the mixed intermediate file; at compile time, the hybrid intermediate file is hybrid compiled with the C/C++ language to hide code.
As a more specific solution, the programming Editor is further provided with automatic connection and burning of the MCU device, and after the fast embedded programming device is scanned by the programming Editor, the programming Editor automatically sends handshake information to the fast embedded programming device, namely requests to access the fast embedded programming device; after the link is established, programming the Editor to continuously transmit heartbeat information to check whether a short line appears;
when heartbeat information is continuously transmitted to the rapid embedded programming device, the programming Editor can continuously scan Flash in the MCU main control chip and record and backup;
when the control program written by Python is required to be burnt into the quick embedded programming device, the programming Editor can automatically compile the code into a mixed intermediate file, and the library file used by the code is added into the running environment, so that the code can be quickly run when the quick embedded programming device is restarted.
As a more specific solution, when programming a Python-based control program, the programming Editor also has an error prompting function, and the programming Editor checks and prompts Python grammar through an error checking library, and when an operation error occurs, the programming Editor records the code with dislocation in the error checking library as a new error correcting item and updates the library.
As a more specific solution, the programming Editor also accesses the pip library, and extends the hardware and/or software interfaces through the pip library.
Compared with the related art, the quick embedded programming method and device using the Python have the following beneficial effects:
1. the quick embedded programming device of the invention occupies less space and saves cost by adopting the miniature rectangular PCB board, the passivation of four corners is used for avoiding acute angle scratch to a user, the standard music instrument holes are arranged at the four corners of the rectangle for matching the music instrument to learn, the device can be conveniently placed on the music instrument, and the learning pleasure is increased by matching the music instrument;
2. compared with most of the existing interfaces which adopt needle interfaces, the PH2.0 line with 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 line is not easy to pull out, so that the risk of equipment damage is increased;
3. according to the quick embedded programming method, python is used as a language for programming a control program, the programmed control program is converted into a control program based on C/C++, so that hardware is better controlled, the volume of a program carried by a hardware facility is small, and the reaction rate is high;
4. the invention also has the function of error prompt, the programming Editor checks and prompts the Python grammar through the error checking library, when the operation error occurs, the programming Editor records the misplaced code 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 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 will be further described with reference to the drawings 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, the learner of the programming language generally has insufficient knowledge about the hardware equipment, so that it is extremely unrealistic to construct the hardware learning environment by himself at first, and the embodiment combines necessary hardware modules together to facilitate the learner to directly use, and learn the hardware structure and the interaction mode between them in the process of learning programming, so as to learn gradually.
The PCB is a miniature rectangular PCB, and four corners of the rectangle are all subjected to passivation treatment; the PCB board is also subjected to size compression through double-sided wiring, and standard Happy holes are also respectively formed in four corners of the rectangle.
Furthermore, the miniature rectangular PCB is used for reducing the occupied space of equipment and saving the cost, four corners are passivated for avoiding acute angle scratch of a user, and standard music high holes are formed in the four corners of the rectangle for matching music high equipment to learn, so that the device can be conveniently placed on music high toys, and the learning pleasure is increased by matching the music high toys.
The power module group comprises three paths of voltage-stabilizing power modules, a micro USB power interface and an external lithium battery interface, and the micro USB power interface and the external lithium battery interface are respectively and electrically connected with the three paths of voltage-stabilizing power modules; the three-way voltage-stabilizing power supply module is electrically connected with the MCU main control chip and provides stable working electric energy for the whole rapid embedded programming device.
Specifically, the adoption of different power supply modes is for matching different use scenes, and the MicroUSB power supply is used for providing a stable power supply when being connected with a computer for debugging, and the external lithium battery interface enables equipment to be free from the constraint of hardware connection and is arranged on a music toy and the like.
The driving module group comprises a motor driving module, a steering engine driving module, a sensor access module and a self-defined pin arranging group; the motor driving module, the steering engine driving module, the sensor access module and the custom pin array are respectively and electrically connected with the MCU main control chip.
It should be noted that: the driving module group is mainly used for matching each external device, when matching the external device, beginners often cannot grasp correct matching driving, circuit layout and the like, and the most common modules of the control hardware device are assembled on the PCB board
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 respectively and electrically connected with the MCU main control chip.
The common communication module is integrated on the PCB, so that a user can directly use the communication module, and the communication module is convenient and quick.
The control module group comprises a programmable button group and a full-color LED lamp, and the programmable button group and the full-color LED lamp are electrically connected with the MCU main control chip.
The added control module group can control the running state of the device through the buttons, and the full-color LED lamp can display the running state of the device in real time.
As a more specific solution, the MCU main control chip establishes connection with corresponding external hardware equipment through a driving module group; a board-to-wire connector which is electrically connected with the driving module corresponding to the driving module group is arranged on the PCB; the board-to-wire connector is of the model PH2.0 Pin and/or PH2.0 Pin; the external hardware equipment establishes connection with the driving module group through the corresponding wire-to-board connector, and when the board-to-wire connector is connected with the wire-to-board connector in a matching way, the circuit reverse connection is avoided through the buckle structure.
It should be noted that: at present, most interfaces are easy to reversely connect by adopting a needle type interface, and reverse connection can be prevented by adopting a PH2.0 interface, but the PH2.0 interface is not easy to pull out, so that the risk of equipment damage is increased, the YH wire and the PH2.0 wire with a buckle are applied here, on one hand, the locking is convenient to insert, and on the other hand, the pulling out is convenient. The external hardware equipment user can start to link the peripheral equipment by using only one 3PIN or 4PIN wire through the board to wire 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 ultrasonic GND, ECHO, trig and VCC4 wires are needed, and 2 positive and negative electrodes of the motor are needed=8 wires.
As a more specific solution, the user of the fast embedded programming device writes a control program for the fast embedded programming device through Python, wherein 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 recompilation; the recompiled control program is burnt into an MCU main control chip of the rapid embedded programming device through a communication module group; and the MCU main control chip performs control operation on each module on the PCB and the external hardware equipment for establishing connection by executing a control program.
Specific: python is used as a beginner friendly language to facilitate beginner understanding, but learning of Python is often performed through a pure software platform, and a learner lacks contact with hardware interaction and the like, but Python is used as a high-level language, has very limited operation capability on a hardware bottom layer, can be provided with an embedded device of Python, has high performance requirement, and is not ideal in control reaction speed.
In order to solve the above problems, 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 recompilates the control program; the C/C++ is a language close to the bottom layer of the hardware, but the learning difficulty is high, and beginners often have difficulty in quickly mastering the language, and in the embodiment, python is used as a language for writing a control program, the written control program is converted into a control program based on the C/C++, so that the hardware is better controlled, the program carried by a hardware facility is small in size, and the reaction rate is high.
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 Python language programming Editor, and a user writes a control program for 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 functional modules and functional functions used by the control program, and the library files are written in C/C++; the mapping table stores the mapping relation between the Python called function module and function and the library file stored in the mapping library, and when the Python written control process calls the function module or function, the address of the corresponding library file is found out through the mapping table; and when the definition is released, the definition of the calling function module or the function is released through the corresponding library file, and a control program based on C/C++ is obtained.
Furthermore, in this embodiment, the conversion is achieved by mapping the calling function module or function used in the Python writing into the calling function module or function based on C/c++, the conversion process is performed automatically through the background, and the foreground user cannot feel the conversion process, so that the purpose of writing the control program through Python is achieved.
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 the correspondence after receiving the corresponding interface information; the mapping structure comprises a corresponding relation between python direct and c map, class and parameter set, wherein the mapping structure is realized through utf8 coding string.
As a more specific solution, the programming Editor can also automatically recycle the memory; the programming Editor triggers the function of automatically recovering the memory when interpreting a control program written based on Python; the reclaimed memory object is the unused, non-declared and unused memory beyond the threshold time in the mapping library.
In particular, for high speed operation of the MCU, a mode of asynchronous operation is typically used, i.e. instruction interpretation to C++ is running at high speed (nm level), while the status information acquired by python is delayed. And python is used as an explanatory language, is weak in memory reclamation, and is designed in C++ to realize the function of automatically reclaiming the memory, and the reclaimed memory object is the memory which is not used in the mapping library, is not declared and is still not used beyond the threshold time. When using python, the use condition of the memory is not necessary to be concerned, and other modules can be realized by using the lower layer implementation through interfaces and even the transmission mode of the function bottom layer binary of the lower layer implementation in the StringIO direct mapping C++.
As a more specific solution, in the process that a control program written based on Python is converted into a control program based on C/C++ through a mapping table and a mapping library, the control program is carried out by constructing a mixed intermediate file, wherein the mixed intermediate file is a binary code file, the Python file is converted into a mixed intermediate file through a conversion engine, and the corresponding relation between each byte code and Python source code is recorded in the mixed intermediate file; at compile time, the hybrid intermediate file is hybrid compiled with the C/C++ language to hide code.
Specifically, this embodiment proposes a python intermediate file (xpy file), xpy is a binary code file, and python executes the binary code file, so that we define 126 byte codes in total in the conversion engine to compile py into xpy codes, and record the corresponding relation between each byte code and python source code in xpy file, and the file is compiled with C in a mixed manner during compiling, so that more upper-layer implementation modules can be conveniently integrated in the system, and can also be implemented by compiling hidden codes, thereby facilitating subsequent commercial secondary development.
The upper layer code can be realized more, because all added python files are scanned and realized through the mapping relation, and the modules called by the bottom layer are almost realized up and down, so that the python files are more functional logical files, and the same name class is only generated at the bottom layer.
As a more specific solution, the programming Editor is further provided with automatic connection and burning of the MCU device, and after the fast embedded programming device is scanned by the programming Editor, the programming Editor automatically sends handshake information to the fast embedded programming device, namely requests to access the fast embedded programming device; after the link is established, programming the Editor to continuously transmit heartbeat information to check whether a short line appears;
when heartbeat information is continuously transmitted to the rapid embedded programming device, the programming Editor can continuously scan Flash in the MCU main control chip and record and backup;
when the control program written by Python is required to be burnt into the quick embedded programming device, the programming Editor can automatically compile the code into a mixed intermediate file, and the library file used by the code is added into the running environment, so that the code can be quickly run when the quick embedded programming device is restarted.
As a more specific solution, when programming a Python-based control program, the programming Editor also has an error prompting function, and the programming Editor checks and prompts Python grammar through an error checking library, and when an operation error occurs, the programming Editor records the code with dislocation in the error checking library as a new error correcting item and updates the library.
As a more specific solution, the programming Editor also accesses the pip library, and extends the hardware and/or software interfaces through the pip library.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent structures or equivalent processes or direct or indirect application in other related technical fields are included in the scope of the present invention.

Claims (10)

1. The quick 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 respectively and electrically connected with the power module group, the communication module group, the driving module group and the control module group through PCB wiring;
the PCB is a miniature rectangular PCB, and four corners of the rectangle are all subjected to passivation treatment; the PCB board is also subjected to size compression through double-sided wiring, and standard Happy holes are respectively formed at four corners of the rectangle;
the power module group comprises three paths of voltage-stabilizing power modules, a micro USB power interface and an external lithium battery interface, and the micro USB power interface and the external lithium battery interface are respectively and electrically connected with the three paths of voltage-stabilizing power modules; the three-way voltage-stabilizing power supply module is electrically connected with the MCU main control chip and provides stable working electric energy for the whole rapid embedded programming device;
the driving module group comprises a motor driving module, a steering engine driving module, a sensor access module and a self-defined pin arranging group; the motor driving module, the steering engine driving module, the sensor access module and the custom pin array 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 respectively and electrically connected with the MCU main control chip;
the control module group comprises a programmable button group and a full-color LED lamp, and the programmable button group and the full-color LED lamp are electrically connected with the MCU main control chip.
2. The fast embedded programming device using Python according to claim 1, wherein the MCU main control chip establishes a connection with a corresponding external hardware device through a driving module group; a board-to-wire connector which is electrically connected with the driving module corresponding to the driving module group is arranged on the PCB; the board-to-wire connector is of the model PH2.03Pin and/or PH 2.0Pin; the external hardware equipment establishes connection with the driving module group through the corresponding wire-to-board connector, and when the board-to-wire connector is connected with the wire-to-board connector in a matching way, the circuit reverse connection is avoided through the buckle structure.
3. A fast embedded programming method using Python, applied to a fast embedded programming apparatus using Python according to any one of claims 1 to 2, wherein a user of the fast embedded programming apparatus writes a control program for the fast embedded programming apparatus through Python, the writing of the control program being 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 recompilation; the recompiled control program is burnt into an MCU main control chip of the rapid embedded programming device through a communication module group; and the MCU main control chip performs control operation on each module on the PCB and the external hardware equipment for establishing connection by executing a control program.
4. A method of fast embedded programming using Python according to claim 3, wherein said Python embedded programming system comprises a programming Editor, a mapping table and a mapping library; the programming Editor is a Python language programming Editor, and a user writes a control program for 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 functional modules and functional functions used by the control program, and the library files are written in C/C++; the mapping table stores the mapping relation between the Python called function module and function and the library file stored in the mapping library, and when the Python written control program calls the function module or function, the mapping table finds the address of the corresponding library file; and when the definition is released, the definition of the calling function module or the function is released through the corresponding library file, and a control program based on C/C++ is obtained.
5. The method for quickly programming a programmable logic device using Python according to claim 4, wherein said mapping library is a static library, said library file includes a Binary interface and a mapping structure, said Binary interface is internally implemented with correspondence after receiving corresponding interface information; the mapping structure comprises a corresponding relation between python direct and c map, class and parameter set, wherein the mapping structure is realized through utf8 coding string.
6. The method for quickly embedding programming using Python according to claim 4, wherein the programming Editor is further capable of automatically retrieving memory; the programming Editor triggers the function of automatically recovering the memory when interpreting a control program written based on Python; the reclaimed memory object is the unused, non-declared and unused memory beyond the threshold time in the mapping library.
7. The method for quickly embedding programming by using Python according to claim 4, wherein 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, the method is performed by constructing a mixed intermediate file, wherein the mixed intermediate file is a binary code file, and converting the Python file into a mixed intermediate file through a conversion engine, wherein the correspondence between each byte code and Python source code is recorded in the mixed intermediate file; at compile time, the hybrid intermediate file is hybrid compiled with the C/C++ language to hide code.
8. The method 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, i.e. requests access to the fast embedded programming device; after the link is established, the programming Editor continuously transmits heartbeat information to the quick embedded programming device to check whether a short line condition exists;
when heartbeat information is continuously transmitted to the rapid embedded programming device, the programming Editor can continuously scan Flash in the MCU main control chip and record and backup;
when the control program written by Python is required to be burnt into the quick embedded programming device, the programming Editor can automatically compile the code into a mixed intermediate file, and the library file used by the code is added into the running environment, so that the code can be quickly run when the quick embedded programming device is restarted.
9. The method according to claim 4, wherein the program Editor further has an error-prompting function when writing the Python-based control program, and the program Editor checks and prompts Python grammar through the error check library, and when an operation error occurs, the program Editor records the code with the dislocation in the error check library as a new error correction item and updates the library.
10. The method of claim 4, wherein the programming Editor further accesses a pip library to extend 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 CN113342322A (en) 2021-09-03
CN113342322B true 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)

Families Citing this family (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 (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10831456B1 (en) * 2019-05-31 2020-11-10 The Mathworks, Inc. External code integrations within a computing environment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016206818A1 (en) * 2015-06-24 2016-12-29 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
US20210103418A1 (en) * 2019-08-16 2021-04-08 Argineering, Inc. System And Method For Transforming Static Displays To Interactive Spaces

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10831456B1 (en) * 2019-05-31 2020-11-10 The Mathworks, Inc. External code integrations within a computing environment

Also Published As

Publication number Publication date
CN113342322A (en) 2021-09-03

Similar Documents

Publication Publication Date Title
Flannery et al. Designing ScratchJr: Support for early childhood learning through computer programming
Kim et al. Introduction for freshmen to embedded systems using LEGO Mindstorms
Serrano Pérez et al. An ultra‐low cost line follower robot as educational tool for teaching programming and circuit's foundations
Hodges et al. . NET Gadgeteer: A new platform for K-12 computer science education
Khamphroo et al. MicroPython-based educational mobile robot for computer coding learning
CN113342322B (en) Quick embedded programming method and device using Python
CN109523899A (en) A kind of open source robot
Arakliotis et al. Lawris: A rule-based Arduino programming system for young students
Devine et al. Plug-and-play physical computing with Jacdac
Pi Camera module
TWI673691B (en) System for immersive programming language learning
Blum et al. Python Programming for Raspberry Pi
CN113442134A (en) Robot programming control system
CN110570727A (en) Screen-free programming learning system and programming method thereof
Winzker et al. Teaching embedded system concepts for technological literacy
CN207571945U (en) For the experimental box of hardware programming study
Noble Building a LEGO-based robotics platform for a 3rd grade classroom
CN212933911U (en) Learning experiment board of internet of things based on Esp8266
CN111489618A (en) Card-inserting type single-chip microcomputer suite for computer programming teaching
CN211827329U (en) Virtual-real combined teaching platform based on Arduino
Islam et al. EduBot: an educational robot for underprivileged children
CN211403648U (en) Novel programming learning machine for learning
Czakóová et al. Interactive Programming Tools for Beginners in Elementary School Informatics
Blum et al. Python Programming for Raspberry Pi, Sams Teach Yourself in 24 Hours
Richardson Getting Started with Intel Galileo: Electronic Projects with the Quark-Powered Arduino-Compatible Board

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