summaryrefslogtreecommitdiff
path: root/docs/reference
AgeCommit message (Collapse)Author
2022-08-18tools/mpremote: Allow + terminator for fs commands.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-06-10docs/reference/mpyfiles: Update .mpy description to match latest format.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-27docs/reference/manifest: Add link to details about opt-level for freeze.Andrew Leech
2022-05-18py/parse: Allow all constant objects to be used in "X = const(o)".Damien George
Now that constant tuples are supported in the parser, eg (1, True, "str"), it's a small step to allow anything that is a constant to be used with the pattern: from micropython import const X = const(obj) This commit makes the required changes to allow the following types of constants: from micropython import const _INT = const(123) _FLOAT = const(1.2) _COMPLEX = const(3.4j) _STR = const("str") _BYTES = const(b"bytes") _TUPLE = const((_INT, _STR, _BYTES)) _TUPLE2 = const((None, False, True, ..., (), _TUPLE)) Prior to this, only integers could be used in const(...). Signed-off-by: Damien George <damien@micropython.org>
2022-05-17docs/reference/mpyfiles: Remove docs about mpy flags and qstr win size.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-28py/modsys: Rename sys.implementation.mpy to sys.implementation._mpy.Damien George
Per CPython docs, non-standard attributes must begin with an underscore. Signed-off-by: Damien George <damien@micropython.org>
2022-04-15docs/reference: Update constrained docs now that tuples can be const.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-11tools/mpremote: Add option to mount cmd to allow "unsafe" symlinks.Rob Knegjens
Specifying the option `--unsafe-links` (or `-l`) to `mpremote mount` will allow symlinks to be followed in the local directory that point outside of the base directory path. For the unsafe case the `path_check()` method of `PyboardCommand` still checks for a common path but without expanding symlinks. While this check is currently redundant, it makes the purpose of the method clearer for possible future uses or extensions.
2022-04-04docs/reference/mpremote: Add details about mount usage over soft reboot.Andrew Leech
2022-02-25tools/mpremote: Add "umount" command.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-02-25tools/mpremote: Add "resume" and "soft-reset" commands.Damien George
This makes the auto soft-reset behaviour of mpremote more logical, and now configurable via these new commands. Signed-off-by: Damien George <damien@micropython.org>
2022-02-04docs/reference/isr_rules.rst: Describe uasyncio-IRQ interface.Peter Hinch
2022-02-04docs/reference/isr_rules.rst: Fix inconsistent variable name in example.Luiz Brandao
Fixed to be conistent with the code example above it.
2021-12-15docs: Remove trailing spaces and convert tabs to spaces.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-11-19docs/reference/filesystem.rst: Add detail on how to use littlefs fuse.Damien George
Without the --block_count option the fuse will fail. Signed-off-by: Damien George <damien@micropython.org>
2021-10-14docs/reference/manifest.rst: Add docs for manifest.py files.NitiKaur
2021-10-14docs/reference/mpremote.rst: Add docs for mpremote.NitiKaur
2021-09-16all: Remove MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE.Jim Mussared
This commit removes all parts of code associated with the existing MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE optimisation option, including the -mcache-lookup-bc option to mpy-cross. This feature originally provided a significant performance boost for Unix, but wasn't able to be enabled for MCU targets (due to frozen bytecode), and added significant extra complexity to generating and distributing .mpy files. The equivalent performance gain is now provided by the combination of MICROPY_OPT_LOAD_ATTR_FAST_PATH and MICROPY_OPT_MAP_LOOKUP_CACHE (which has been enabled on the unix port in the previous commit). It's hard to provide precise performance numbers, but tests have been run on a wide variety of architectures (x86-64, ARM Cortex, Aarch64, RISC-V, xtensa) and they all generally agree on the qualitative improvements seen by the combination of MICROPY_OPT_LOAD_ATTR_FAST_PATH and MICROPY_OPT_MAP_LOOKUP_CACHE. For example, on a "quiet" Linux x64 environment (i3-5010U @ 2.10GHz) the change from CACHE_MAP_LOOKUP_IN_BYTECODE, to LOAD_ATTR_FAST_PATH combined with MAP_LOOKUP_CACHE is: diff of scores (higher is better) N=2000 M=2000 bccache -> attrmapcache diff diff% (error%) bm_chaos.py 13742.56 -> 13905.67 : +163.11 = +1.187% (+/-3.75%) bm_fannkuch.py 60.13 -> 61.34 : +1.21 = +2.012% (+/-2.11%) bm_fft.py 113083.20 -> 114793.68 : +1710.48 = +1.513% (+/-1.57%) bm_float.py 256552.80 -> 243908.29 : -12644.51 = -4.929% (+/-1.90%) bm_hexiom.py 521.93 -> 625.41 : +103.48 = +19.826% (+/-0.40%) bm_nqueens.py 197544.25 -> 217713.12 : +20168.87 = +10.210% (+/-3.01%) bm_pidigits.py 8072.98 -> 8198.75 : +125.77 = +1.558% (+/-3.22%) misc_aes.py 17283.45 -> 16480.52 : -802.93 = -4.646% (+/-0.82%) misc_mandel.py 99083.99 -> 128939.84 : +29855.85 = +30.132% (+/-5.88%) misc_pystone.py 83860.10 -> 82592.56 : -1267.54 = -1.511% (+/-2.27%) misc_raytrace.py 21490.40 -> 22227.23 : +736.83 = +3.429% (+/-1.88%) This shows that the new optimisations are at least as good as the existing inline-bytecode-caching, and are sometimes much better (because the new ones apply caching to a wider variety of map lookups). The new optimisations can also benefit code generated by the native emitter, because they apply to the runtime rather than the generated code. The improvement for the native emitter when LOAD_ATTR_FAST_PATH and MAP_LOOKUP_CACHE are enabled is (same Linux environment as above): diff of scores (higher is better) N=2000 M=2000 native -> nat-attrmapcache diff diff% (error%) bm_chaos.py 14130.62 -> 15464.68 : +1334.06 = +9.441% (+/-7.11%) bm_fannkuch.py 74.96 -> 76.16 : +1.20 = +1.601% (+/-1.80%) bm_fft.py 166682.99 -> 168221.86 : +1538.87 = +0.923% (+/-4.20%) bm_float.py 233415.23 -> 265524.90 : +32109.67 = +13.756% (+/-2.57%) bm_hexiom.py 628.59 -> 734.17 : +105.58 = +16.796% (+/-1.39%) bm_nqueens.py 225418.44 -> 232926.45 : +7508.01 = +3.331% (+/-3.10%) bm_pidigits.py 6322.00 -> 6379.52 : +57.52 = +0.910% (+/-5.62%) misc_aes.py 20670.10 -> 27223.18 : +6553.08 = +31.703% (+/-1.56%) misc_mandel.py 138221.11 -> 152014.01 : +13792.90 = +9.979% (+/-2.46%) misc_pystone.py 85032.14 -> 105681.44 : +20649.30 = +24.284% (+/-2.25%) misc_raytrace.py 19800.01 -> 23350.73 : +3550.72 = +17.933% (+/-2.79%) In summary, compared to MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE, the new MICROPY_OPT_LOAD_ATTR_FAST_PATH and MICROPY_OPT_MAP_LOOKUP_CACHE options: - are simpler; - take less code size; - are faster (generally); - work with code generated by the native emitter; - can be used on embedded targets with a small and constant RAM overhead; - allow the same .mpy bytecode to run on all targets. See #7680 for further discussion. And see also #7653 for a discussion about simplifying mpy-cross options. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-30docs/reference: Mention that slicing a memoryview causes allocation.Peter Hinch
2021-08-13docs/library/index.rst: Clarify module naming and purpose.Jim Mussared
Adds section about extending built-in modules from Python. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13docs: Replace ufoo with foo in all docs.Jim Mussared
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-02-13tools: Add filesystem action examples to pyboard.py help.Brianna Laugher
Signed-off-by: Brianna Laugher <brianna.laugher@gmail.com>
2020-12-01docs/reference/repl.rst: Add information about new raw-paste mode.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-10-22docs/reference/glossary.rst: Fix minor grammar error, An -> A.Kevin Thomas
2020-09-30docs/reference/packages.rst: Fix typo, remove duplicate "port".David Lechner
Fixes #6485.
2020-06-05docs: Fix Sphinx 3.x warnings, and enable warnings-as-errors on build.David Lechner
This enables warnings as errors and fixes all current errors, namely: - reference to terms in the glossary must now be explicit (:term:) - method overloads must not be declared as a separate method or must use :noindex: - 2 cases where `` should have been used instead of `
2020-06-02docs/reference: Add note about multiple exceptions when heap is locked.Andrew Leech
2020-04-04esp8266: Change from FAT to littlefs v2 as default filesystem.Damien George
This commit changes the esp8266 boards to use littlefs v2 as the filesystem, rather than FAT. Since the esp8266 doesn't expose the filesystem to the PC over USB there's no strong reason to keep it as FAT. Littlefs is smaller in code size, is more efficient in use of flash to store data, is resilient over power failure, and using it saves about 4k of heap RAM, which can now be used for other things. This is a backwards incompatible change because all existing esp8266 boards will need to update their filesystem after installing new firmware (eg backup old files, install firmware, restore files to new filesystem). As part of this commit the memory layout of the default board (GENERIC) has changed. It now allocates all 1M of memory-mapped flash to the firmware, so the filesystem area starts at the 2M point. This is done to allow more frozen bytecode to be stored in the 1M of memory-mapped flash. This requires an esp8266 module with 2M or more of flash to work, so a new board called GENERIC_1M is added which has the old memory-mapping (but still changed to use littlefs for the filesystem). In summary there are now 3 esp8266 board definitions: - GENERIC_512K: for 512k modules, doesn't have a filesystem. - GENERIC_1M: for 1M modules, 572k for firmware+frozen code, 396k for filesystem (littlefs). - GENERIC: for 2M (or greater) modules, 968k for firmware+frozen code, 1M+ for filesystem (littlefs), FAT driver also included in firmware for use on, eg, external SD cards.
2020-03-30tools/pyboard.py: Add -d as an alias for --device.Lars Kellogg-Stedman
2020-03-30tools/pyboard.py: Support setting device/baudrate from shell env vars.Lars Kellogg-Stedman
Allow defaults for --device and --baudrate to be set in the environment using PYBOARD_DEVICE and PYBOARD_BAUDRATE.
2020-01-06docs: More consistent capitalization and use of articles in headings.Jason Neal
See issue #3188.
2019-12-19docs/reference: Add documentation describing use of .mpy files.Damien George
Including information about .mpy versioning and how to debug failed imports of .mpy files.
2019-12-10docs/library/uos: Add notes and links about littlefs failures.Damien George
2019-12-09docs/reference/filesystem: Add note and example about using filesystem.Damien George
2019-12-09docs/reference/filesystem: Fix typo in block device code example.Daniel Mizyrycki
2019-12-04docs: Add littlefs docs and a filesystem tutorial.Jim Mussared
2019-12-04docs/reference: Add docs describing use of pyboard.py.Jim Mussared
2019-12-04docs: Remove spaces on lines that are empty.Damien George
2019-10-16docs: Fix spelling in various parts of the docs.Mike Causer
2019-10-15docs/reference/glossary.rst: Add new terms and reduce complexity of old.Jim Mussared
2019-08-28docs/reference/speed_python: Add missing self to var caching example.Paul m. p. P
2019-08-19docs/reference/speed_python: Update that read-only buffers are accepted.Peter Hinch
As allowed by recent cd35dd9d9a29836906acdce60c931f6352b536d0
2019-03-08py: Update and rework build system for including external C modules.Andrew Leech
How to use this feature is documented in docs/develop/cmodules.rst.
2019-03-08py: Implement a module system for external, user C modules.Ayke van Laethem
This system makes it a lot easier to include external libraries as static, native modules in MicroPython. Simply pass USER_C_MODULES (like FROZEN_MPY_DIR) as a make parameter.
2019-02-12all: Change PYB message prefix to MPY.Mike Causer
Replaces "PYB: soft reboot" with "MPY: soft reboot", etc. Having a consistent prefix across ports reduces the difference between ports, which is a general goal. And this change won't break pyboard.py because that tool only looks for "soft reboot".
2018-07-20docs/reference/index: Remove conditional for inline asm docs.Damien George
The heading of this section makes it clear it is for Thumb-2 architectures only.
2018-03-15docs: Fix some references and RST markup to eliminate Sphinx warnings.Damien George
2018-03-09docs/reference/repl.rst: Fix some minor errors in the REPL tutorial.Damien George
2017-12-16docs/packages: Explicitly recommend usage of setuptools instead of distutils.Paul Sokolovsky
2017-12-16docs/packages: Use "install_dir/" in examples.Paul Sokolovsky