Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
eb101a27
Commit
eb101a27
authored
8 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
examples/embedding/README: Convert to markdown, grammar and clarity fixes.
parent
e5cc681c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/embedding/README.md
+17
-16
17 additions, 16 deletions
examples/embedding/README.md
with
17 additions
and
16 deletions
examples/embedding/README
→
examples/embedding/README
.md
+
17
−
16
View file @
eb101a27
...
@@ -11,7 +11,7 @@ Python statement which prints to the standard output.
...
@@ -11,7 +11,7 @@ Python statement which prints to the standard output.
Building the example
Building the example
--------------------
--------------------
Build the example is as simple as running:
Build
ing
the example is as simple as running:
make
make
...
@@ -20,37 +20,38 @@ It's worth to trace what's happening behind the scenes though:
...
@@ -20,37 +20,38 @@ It's worth to trace what's happening behind the scenes though:
1.
As a first step, a MicroPython library is built. This is handled by a
1.
As a first step, a MicroPython library is built. This is handled by a
seperate makefile, Makefile.upylib. It is more or less complex, but the
seperate makefile, Makefile.upylib. It is more or less complex, but the
good news is that you won't need to change anything in it, just use it
good news is that you won't need to change anything in it, just use it
as is, the main Makefile shows how. What may
need
editing though is
as is, the main Makefile shows how. What may
require
editing though is
MicroPython configuration file. MicroPython is highly configurable, so
a
MicroPython configuration file. MicroPython is highly configurable, so
you would need to build a library suiting your application well, while
you would need to build a library suiting your application well, while
not bloating its size. Check the options in the file "mpconfigport.h".
not bloating its size. Check the options in the file "mpconfigport.h".
Included is a copy of "minimal" Unix port, which should be good start
Included is a copy of the "minimal" Unix port, which should be a good start
for minimal embedding. For list of all available options, see py/mpconfig.h.
for minimal embedding. For the list of all available options, see
py/mpconfig.h.
2. Once the library is built, your application is compiled
and linked with
2.
Once the
MicroPython
library is built, your application is compiled
the MicroPython library produced in the previous step. The main Makefile
and linked it. The main Makefile is very simple and shows that the changes
is very simple and shows that changes you would need to do to your
you would need to do to your application's Makefile (or other build
application's Makefile (or other build
configuration) are also simple:
configuration) are also simple:
a) You would need to use C99 standard (you're using 15+ years old
standard
a) You would need to use C99 standard (you're using
this
15+ years old
already, not a 25+ years old one, right?).
standard
already, not a 25+ years old one, right?).
b) You need to provide path to MicroPython's top-level dir, for includes.
b) You need to provide
a
path to MicroPython's top-level dir, for includes.
c) You need to include -DNO_QSTR compile-time flag.
c) You need to include -DNO_QSTR compile-time flag.
d) Otherwise, just link with
m
icro
p
ython library produced in step 1.
d) Otherwise, just link with
the M
icro
P
ython library produced in step 1.
Out of tree build
Out of tree build
-----------------
-----------------
This example set up to work out of the box, being part of the MicroPython
This example
is
set up to work out of the box, being part of the MicroPython
tree. Your application of course will be outside of its tree, but the
tree. Your application of course will be outside of its tree, but the
only thing you need to do is to pass MPTOP variable pointing to
only thing you need to do is to pass MPTOP variable pointing to
MicroPython directory to both Makefiles (in this example, the main Makefile
MicroPython directory to both Makefiles (in this example, the main Makefile
automatically pass it to Makefile.upylib; in your own Makefile, don't forget
automatically pass
es
it to Makefile.upylib; in your own Makefile, don't forget
to use suitable value).
to use
a
suitable value).
A practical way to embed MicroPython in your application is to include it
A practical way to embed MicroPython in your application is to include it
as a git submodule. Suppose you included it as libs/micropython. Then in
as a git submodule. Suppose you included it as libs/micropython. Then in
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment