CN112540765B - Embedded MCU program segmentation compiling method and system - Google Patents
Embedded MCU program segmentation compiling method and system Download PDFInfo
- Publication number
- CN112540765B CN112540765B CN202011439502.6A CN202011439502A CN112540765B CN 112540765 B CN112540765 B CN 112540765B CN 202011439502 A CN202011439502 A CN 202011439502A CN 112540765 B CN112540765 B CN 112540765B
- Authority
- CN
- China
- Prior art keywords
- protocol stack
- communication protocol
- user program
- program
- api
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 21
- 230000011218 segmentation Effects 0.000 title abstract description 8
- 238000004891 communication Methods 0.000 claims abstract description 79
- 230000003068 static effect Effects 0.000 claims abstract description 7
- 238000004806 packaging method and process Methods 0.000 claims abstract description 4
- 238000012544 monitoring process Methods 0.000 abstract description 4
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- QVFWZNCVPCJQOP-UHFFFAOYSA-N chloralodol Chemical compound CC(O)(C)CC(C)OC(O)C(Cl)(Cl)Cl QVFWZNCVPCJQOP-UHFFFAOYSA-N 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
Abstract
The invention discloses an embedded MCU program segmentation compiling method and system, comprising the following steps: distributing a communication protocol stack, wherein a user program occupies space; the communication protocol stack defines a user program entry function and designates the address of the function; writing a communication protocol stack and a link script file of a user program; compiling a communication protocol stack, generating a programming file, exporting an API in the communication protocol stack, and packaging the API as an API static library and a header file. According to the invention, a single MCU (microprogrammed control unit) contained in the communication module is used for running a communication protocol stack and a user program, the user program can be changed, the communication protocol stack and the user code are invisible, the communication protocol stack actively loads the user program and provides an API (application program interface) for the user program, the hardware cost of the Internet of things is saved under the simple program requirements of monitoring the switching value, the temperature and the like, a program architecture similar to a dynamic library is adopted for realizing program decoupling, ensuring that each program code is not leaked, effectively ensuring the confidentiality of the code, and embodying the cooperation concept of division of work.
Description
Technical Field
The invention relates to the technical field of internet of things systems, in particular to an embedded MCU program segmentation compiling method and system.
Background
The internet of things refers to the real-time collection of any object or process needing monitoring, connection and interaction through various devices and technologies such as various information sensors, radio frequency identification technologies, global positioning systems, infrared sensors and laser scanners, various required information such as sound, light, heat, electricity, mechanics, chemistry, biology and positions of the object or the process is collected, the ubiquitous connection of the object and people is realized through various possible network accesses, intelligent sensing, identification and management of the object and the process are realized, the known internet of things system is designed by a communication module and MCU, the communication module, the LORAWAN, the LORA and the like all comprise the MCU, a communication protocol stack is operated, and the MCU is designed by a professional manufacturer and mainly operates a user program, and the MCU in the communication module operates the communication protocol stack and provides a user interface.
If the Internet of things system is used for monitoring switching value, temperature and the like, the program is simple, RAM is consumed, and Flash resources are few, and the traditional communication module and MCU design is used in the mode, so that software and hardware resources are wasted, and the system cost is increased.
Disclosure of Invention
The invention aims to provide an embedded MCU program segmentation compiling method and system, which are used for solving the defects in the prior art.
In order to achieve the above purpose, the present invention adopts the following technical scheme: an embedded MCU program segment compiling method comprises the following steps:
s1: distributing a communication protocol stack, wherein a user program occupies space;
s2: the communication protocol stack defines a user program entry function and designates the address of the function;
s3: writing a communication protocol stack and a link script file of a user program;
s4: compiling a communication protocol stack, generating a programming file, exporting an API in the communication protocol stack, and packaging the API as an API static library and a header file;
s5: compiling a user program to generate a programming file.
As a further description of the above technical solution:
and the API in the communication protocol stack is a communication interface function in the communication protocol stack, so that engagement between the communication protocol stack and a user program is realized.
As a further description of the above technical solution:
the user program contains an API static library, header file.
As a further description of the above technical solution:
the user program entry function address is designated as the address designated by the user program space in step S1, and the function prototype of the user program entry function is the same as step S1.
As a further description of the above technical solution:
the link script file for writing the user program in the step S3 and the API in the exported communication protocol stack in the step S4 are automatically generated by software.
As a further description of the above technical solution:
the communication protocol stack is compiled by the user program through a C/C++ compiler.
As a further description of the above technical solution:
the communication protocol stack uses an embedded operating system.
An embedded MCU program segment compiling system comprises a sensor and a communication module;
the sensor is in communication connection with the communication module, so that data information acquired by the sensor is communicated and transmitted to the communication module;
the communication module comprises a single MCU, and a communication protocol stack and a user program are operated in the single MCU.
The invention provides an embedded MCU program segmentation compiling method and system. The beneficial effects are as follows:
the embedded MCU program sectionalized compiling method runs a communication protocol stack and a user program through a single MCU contained in a communication module, the user program can be changed, the communication protocol stack and the user code are invisible, the communication protocol stack actively loads the user program and provides an API (application program interface) for the user program, the hardware cost of the Internet of things is saved under the simple requirement of monitoring the programs such as the switching value, the temperature and the like, the program framework similar to a dynamic library is adopted, the program decoupling is realized, the confidentiality of the codes is ensured, and the cooperation concept of division of work is effectively ensured.
Because the embedded MCU program segment compiling method has the technical effects, the embedded MCU program segment compiling system should also have corresponding technical effects.
Drawings
FIG. 1 is a flowchart of an embedded MCU program segment compiling method according to the present invention;
fig. 2 is a schematic diagram of an embedded MCU program segment compiling system according to the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments.
Referring to fig. 1-2, an embedded MCU program segment compiling method includes the steps of:
s1: distributing a communication protocol stack, wherein a user program occupies space;
s2: the communication protocol stack defines a user program entry function and designates the address of the function;
s3: writing a communication protocol stack and a link script file of a user program;
s4: compiling a communication protocol stack, generating a programming file, exporting an API in the communication protocol stack, and packaging the API as an API static library and a header file;
s5: compiling a user program to generate a programming file.
The embedded MCU program segmentation compiling method realizes that a single MCU in the communication module runs a communication protocol stack, and a user program can be changed. The communication protocol stack and the user code are not visible to each other. The communication protocol stack actively loads the user program and provides an API for the user program, so that the hardware cost of the Internet of things is saved, the program is decoupled, and the program codes are ensured not to be leaked.
The API in the communication protocol stack is a communication interface function in the communication protocol stack, realizes engagement of the communication protocol stack and a user program, and is used for providing a group of routines which are accessed by an application program and a developer based on certain software or hardware without accessing source codes.
The user program contains an API static library, header file.
The user program entry function address is designated as the address designated by the user program space in step S1, and the function prototype of the user program entry function is the same as step S1.
In the step S3, the link script file of the user program is written, and the API in the exported communication protocol stack in the step S4 is automatically generated through software.
And the communication protocol stack, the user program is compiled by a C/C++ compiler, and the compilers are the same.
The communication protocol stack uses an embedded operating system, which is convenient for controlling the running time of the user program.
The embodiment of the invention also provides an embedded MCU program segmentation compiling system, which comprises a sensor and a communication module; the sensor is in communication connection with the communication module, so that data information acquired by the sensor is communicated and transmitted to the communication module; the communication module comprises a single MCU, and a communication protocol stack and a user program are operated in the single MCU.
In the description herein, reference to the terms "one embodiment," "example," "specific example," and the like, means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The foregoing is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art, who is within the scope of the present invention, should make equivalent substitutions or modifications according to the technical scheme of the present invention and the inventive concept thereof, and should be covered by the scope of the present invention.
Claims (6)
1. The embedded MCU program segment compiling method is characterized by comprising the following steps:
s1: distributing a communication protocol stack and occupying space by a user program;
s2: the communication protocol stack defines a user program entry function and designates the address of the function;
s3: writing a communication protocol stack and a link script file of a user program;
s4: compiling a communication protocol stack, generating a programming file, exporting an API in the communication protocol stack, and packaging the API as an API static library and a header file;
s5: compiling a user program, generating a programming file, and realizing that a single MCU in a communication module runs a communication protocol stack and the user program, wherein the user program can be changed;
the API in the communication protocol stack is a communication interface function in the communication protocol stack, so that engagement between the communication protocol stack and a user program is realized;
the user program includes an API static library and a header file.
2. An embedded MCU program segment compiling method according to claim 1, wherein the user program entry function address is designated as the address designated by the user program space in step S1, and the function prototype of the user program entry function is the same as in step S1.
3. The method for sectionally compiling an embedded MCU program according to claim 1, wherein the linking script file for writing the user program in step S3 and the API in the derived communication protocol stack in step S4 are both automatically generated by software.
4. An embedded MCU program segment compiling method according to claim 1, wherein the communication protocol stack and the user program are compiled by a C/c++ compiler.
5. The method of claim 1, wherein the communication protocol stack uses an embedded operating system.
6. An embedded MCU program segment compiling system for realizing the embedded MCU program segment compiling method of claim 1, which is characterized by comprising a sensor and a communication module; the sensor is in communication connection with the communication module, so that data information acquired by the sensor is communicated and transmitted to the communication module;
the communication module comprises a single MCU, and a communication protocol stack and a user program are operated in the single MCU.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011439502.6A CN112540765B (en) | 2020-12-10 | 2020-12-10 | Embedded MCU program segmentation compiling method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011439502.6A CN112540765B (en) | 2020-12-10 | 2020-12-10 | Embedded MCU program segmentation compiling method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112540765A CN112540765A (en) | 2021-03-23 |
CN112540765B true CN112540765B (en) | 2024-03-08 |
Family
ID=75019941
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011439502.6A Active CN112540765B (en) | 2020-12-10 | 2020-12-10 | Embedded MCU program segmentation compiling method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112540765B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107729090A (en) * | 2017-11-07 | 2018-02-23 | 福建北峰通信科技股份有限公司 | A kind of user program method for down loading based on Serial Port Transmission |
CN110569040A (en) * | 2019-09-17 | 2019-12-13 | 深圳市优创亿科技有限公司 | Method for installing and running application program in embedded system |
CN111417179A (en) * | 2020-03-17 | 2020-07-14 | 上海泰辑软件有限公司 | Embedded low-power-consumption dual-chip 4G Internet of things communication method and system |
CN111970264A (en) * | 2020-08-11 | 2020-11-20 | 苏州伯行科技有限公司 | SPI uses protocol stack |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105282207B (en) * | 2014-07-25 | 2019-01-22 | 中国科学院声学研究所 | It is a kind of based on can assembled communication protocol stack communication means and system |
-
2020
- 2020-12-10 CN CN202011439502.6A patent/CN112540765B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107729090A (en) * | 2017-11-07 | 2018-02-23 | 福建北峰通信科技股份有限公司 | A kind of user program method for down loading based on Serial Port Transmission |
CN110569040A (en) * | 2019-09-17 | 2019-12-13 | 深圳市优创亿科技有限公司 | Method for installing and running application program in embedded system |
CN111417179A (en) * | 2020-03-17 | 2020-07-14 | 上海泰辑软件有限公司 | Embedded low-power-consumption dual-chip 4G Internet of things communication method and system |
CN111970264A (en) * | 2020-08-11 | 2020-11-20 | 苏州伯行科技有限公司 | SPI uses protocol stack |
Non-Patent Citations (2)
Title |
---|
Mr.Wolf: An Energy-Precision Scalable Parallel Ultra Low Power SoC for IoT Edge Processing;Antonio Pullini等;《IEEE Journal of Solid-State Circuits》;20190515;1-12 * |
单微处理器实现双网口Open Powerlink从站通信解决方案;文长明等;《中国仪器仪表》;20180625;63-67 * |
Also Published As
Publication number | Publication date |
---|---|
CN112540765A (en) | 2021-03-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Ren et al. | Serving at the edge: A scalable IoT architecture based on transparent computing | |
US5778228A (en) | Method and system for transferring remote procedure calls and responses over a network | |
US7587712B2 (en) | End-to-end architecture for mobile client JIT processing on network infrastructure trusted servers | |
CN102129364B (en) | Method for embedding widget toolbar in application program and rapid widget accessing method | |
US6182155B1 (en) | Uniform access to and interchange between objects employing a plurality of access methods | |
EP1302867A2 (en) | Efficient web page localization | |
CN1313920C (en) | Member assembling method based on united member package structure | |
CN112087454A (en) | Communication method, device, equipment and storage medium of Internet of things gateway equipment | |
CN1669020A (en) | Component model for real time system control | |
CN110096278B (en) | Extensible embedded man-machine interface tool implementation method | |
CA2511912A1 (en) | System and method for building and execution of platform-neutral generic services' client applications | |
CN102594833A (en) | Communication protocol adapting method and system | |
CN113467972A (en) | Communication interface construction method, communication interface construction device, computer equipment and storage medium | |
Lee et al. | iedge: An iot-assisted edge computing framework | |
CN1255744C (en) | Universal high speed IC card issuing apparatus and method | |
CN112540765B (en) | Embedded MCU program segmentation compiling method and system | |
Son et al. | Offloading method for efficient use of local computational resources in mobile location-based services using clouds | |
US7343391B2 (en) | System and method for interprocess services client artifact download | |
Vachtsevanou et al. | Embedding autonomous agents into low-power wireless sensor networks | |
CN101246421A (en) | Universal frame work based on workflow engine | |
Navas et al. | A component-based run-time evolution infrastructure for resource-constrained embedded systems | |
Pfisterer et al. | Energy-optimized data serialization for heterogeneous WSNs using middleware synthesis | |
CN112650502A (en) | Batch processing task processing method and device, computer equipment and storage medium | |
CN112306539A (en) | Method, system, terminal and medium for developing application layer of single chip microcomputer | |
US6006280A (en) | Distributed instantiation system and method |
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 |