Commit Graph

28 Commits

Author SHA1 Message Date
Cem Eliguzel 5943a2ec79 docs/develop/porting.rst: Fix build and import problems in the example. 2022-02-04 11:15:46 +11:00
Damien George de43b500bd py/runtime: Allow initialising sys.path/argv with defaults.
If MICROPY_PY_SYS_PATH_ARGV_DEFAULTS is enabled (which it is by default)
then sys.path and sys.argv will be initialised and populated with default
values.  This keeps all bare-metal ports aligned.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-18 00:08:07 +11:00
Damien George d9d67adef1 docs: Remove trailing spaces and convert tabs to spaces.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-15 11:49:22 +11:00
Jim Mussared c737cde947 docs: Replace ufoo with foo in all docs.
Anywhere a module is mentioned, use its "non-u" name for consistency.

The "import module" vs "import umodule" is something of a FAQ, and this
commit intends to help clear that up.  As a first approximation MicroPython
is Python, and so imports should work the same as Python and use the same
name, to a first approximation.  The u-version of a module is a detail that
can be learned later on, when the user wants to understand more and have
finer control over importing.

Existing Python code should just work, as much as it is possible to do that
within the constraints of embedded systems, and the MicroPython
documentation should match the idiomatic way to write Python code.

With universal weak links for modules (via MICROPY_MODULE_WEAK_LINKS) users
can consistently use "import foo" across all ports (with the exception of
the minimal ports).  And the ability to override/extend via "foo.py"
continues to work well.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13 22:53:29 +10:00
Damien George 136369d72f all: Update to point to files in new shared/ directory.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-12 17:08:10 +10:00
Mike Causer 31ac410a4f docs: Fix some spelling mistakes. 2021-05-04 22:58:00 +10:00
Damien George f541b3673d docs/develop: Improve user C modules to properly describe how to build.
Make and CMake builds are slightly different and these changes help make it
clear what to do in each case.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-02 17:07:20 +11:00
Damien George d87f42b0e5 examples/usercmodules: Simplify user C module enabling.
It's a bit of a pitfall with user C modules that including them in the
build does not automatically enable them.  This commit changes the docs and
examples for user C modules to encourage writers of user C modules to
enable them unconditionally.  This makes things simpler and covers most use
cases.

See discussion in issue #6960, and also #7086.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-01 16:27:38 +11:00
Phil Howard 8e5756e2b6 docs/develop/cmodules.rst: Document C-modules and micropython.cmake.
Documents the micropython.cmake file required to make user C modules
compatible with the CMake build system.

Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-31 00:28:21 +11:00
stijn 914380cb89 all: Add .git-blame-ignore-revs for fixing up git blame output.
Add most formatting-only commits to this file so that when used with
git blame, these commits are excluded and the output shows only the
interesting bits.
2021-03-15 11:07:29 +01:00
Damien George 6129b8e401 tests: Rename run-tests to run-tests.py for consistency.
Signed-off-by: Damien George <damien@micropython.org>
2021-03-12 19:56:09 +11:00
Samuelson 407df82f81 docs/develop/natmod: Fix a small typo, con->can. 2021-01-30 15:20:44 +11:00
nanjekyejoannah 4eaebc1988 docs/develop: Add MicroPython Internals chapter.
This commit adds many new sections to the existing "Developing and building
MicroPython" chapter to make it all about the internals of MicroPython.

This work was done as part of Google's Season of Docs 2020.
2021-01-27 16:59:58 +11:00
Damien George dbb13104ca docs/develop/cmodules.rst: Add link to source code for user C example.
Signed-off-by: Damien George <damien@micropython.org>
2020-10-29 23:10:43 +11:00
stijn 25c4563f26 examples: Add example code for user C modules, both C and C++.
Add working example code to provide a starting point for users with files
that they can just copy, and include the modules in the coverage test to
verify the complete user C module build functionality.  The cexample module
uses the code originally found in cmodules.rst, which has been updated to
reflect this and partially rewritten with more complete information.
2020-10-29 15:30:42 +11:00
stijn 0153148fd2 py/py.mk: Support C++ code for user C modules.
Support C++ code in .cpp files by providing CXX counterparts of the
_USERMOD_ flags we have for C already.  This merely enables the Makefile of
user C modules to use variables specific to C++ compilation, it is still up
to each port's main Makefile to also include these in the build.
2020-10-29 15:29:20 +11:00
stijn 78c8b55067 docs: Fix reference to QSTR_GEN_CFLAGS Makefile flag. 2020-10-29 15:28:18 +11:00
Damien George c8ade2bd7f docs/develop: Add notes on prerequisite tools for building native .mpy.
Signed-off-by: Damien George <damien@micropython.org>
2020-09-25 12:25:29 +10:00
Damien George cae77daf00 docs/develop: Fix module/source name in Makefile of native example. 2020-05-16 15:00:46 +10:00
Thorsten von Eicken be92aacba3 docs/develop: Detail how to add symbols to mp_fun_table for native mods. 2020-02-16 00:04:25 +11:00
Jason Neal aec88ddf03 docs: More consistent capitalization and use of articles in headings.
See issue #3188.
2020-01-06 22:17:29 +11:00
Damien George 8449e41818 docs/develop: Add documentation on how to build native .mpy modules. 2019-12-19 17:07:53 +11:00
Jim Mussared 4ddd46e6cf docs/develop/qstr.rst: Add documentation for string interning. 2019-10-04 17:13:13 +10:00
Daniel O'Connor d4e182039f docs/cmodules: Note the various ways MODULE_EXAMPLE_ENABLED can be set. 2019-04-18 11:59:43 +10:00
Daniel O'Connor fd58136d6b docs/cmodules: Fix example to globally define MODULE_EXAMPLE_ENABLED.
MODULE_EXAMPLE_ENABLED must be globally defined for the module to be seen
and referenced by all parts of the code.
2019-04-15 11:56:22 +10:00
Damien George 0fb15fc3f4 docs/develop: Remove paragraph that was copied in error from other doc. 2019-03-29 11:50:39 +11:00
Martin Fischer 912e957512 docs/develop: Fix typos in C-module example for example_add_ints. 2019-03-13 12:54:01 +11:00
Andrew Leech 89ff506513 py: Update and rework build system for including external C modules.
How to use this feature is documented in docs/develop/cmodules.rst.
2019-03-08 22:58:42 +11:00