summaryrefslogtreecommitdiff
path: root/docs/reference
AgeCommit message (Collapse)Author
14 dayspy/modsys: Add architecture flags to MicroPython metadata.Alessandro Gatti
This commit adds the currently supported architecture flags value as the upper part of "sys.implementation._mpy". This had the side effect of perturbing quite a bit of testing infrastructure and invalidating documentation related to MPY files. To make the test suite run successfully and keep the documentation in sync the following changes have been made: * The target info feature check file now isolates eventual architecture flags and adds them as a separate field * The test runner now picks up the new architecture flags field, reports it to STDOUT if needed and stores it for future uses * Relevant test files for MPY files import code had to be updated to mask out the architecture flags bits in order to perform correctly * MPY file format documentation was updated to show how to mask off and properly display the architecture flags information. This works out of the box if the flag bits can fit in a smallint value once merged with the MPY file header value. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
14 dayspy/persistentcode: Add architecture flags check for RV32 platforms.Alessandro Gatti
This commit introduces the MPY architecture flags checking code specific for the RV32 target, currently checking for the only additional extension that is supported by the runtime: Zba. The warnings inside "mpy-cross" have also been removed since now there is a way to reject incompatible MPY files at runtime. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
14 dayspy/persistentcode: Add architecture flags compatibility checks.Alessandro Gatti
This commit extends the MPY file format in a backwards-compatible way to store an encoded form of architecture-specific flags that have been specified in the "mpy-cross" command line, or that have been explicitly set as part of a native emitter configuration. The file format changes are as follows: * The features byte, previously containing the target native architecture and the minor file format version, now claims bit 6 as a flag indicating the presence of an encoded architecture flags integer * If architecture flags need to be stored, they are placed right after the MPY file header. This means that properly-written MPY parsers, if encountering a MPY file containing encoded architecture flags, should raise an error since no architecture identifiers have been defined that make use of bits 6 and 7 in the referenced header byte. This should give enough guarantees of backwards compatibility when this feature is used (improper parsers were subjected to breakage anyway). The encoded architecture flags could have been placed at the end, but: * Having them right after the header makes the architecture compatibility checks occur before having read the whole file in memory (which still happens on certain platforms as the reader may be backed by a memory buffer), and prevents eventual memory allocations that do not take place if the module is rejected early * Properly-written MPY file parsers should have checked the upper two bits of the flags byte to be actually zero according to the format specification available right before this change, so no assumptions should have been made on the exact order of the chunks for an unexpected format. The meaning of the architecture flags value is backend-specific, with the only common characteristic of being a variable-encoded unsigned integer for the time being. The changes made to the file format effectively limit the number of possible target architectures to 16, of which 13 are already claimed. There aren't that many new architectures planned to be supported for the lifetime of the current MPY file format, so this change still leaves space for architecture updates if needed. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-10-04all: Replace legacy name with MicroPython and MPy as applicable.Angus Gratton
With the aim of getting consistency, and removing the need to learn an additional term, replace uses of uPy/uPython with MPy/MicroPython. Rule of thumb was to use "MPy" abbreviation where "CPy" is used nearby, but the full word MicroPython otherwise. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-09-19mpy-cross: Add RISC-V RV64IMC support in MPY files.Alessandro Gatti
MPY files can now hold data to be run on RV64IMC. This can be accomplished by passing the `-march=rv64imc` flag to mpy-cross. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-08-02docs/reference/mpremote: Document location of config file.Jos Verlinde
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-08-02docs/library/machine: Add docs for Counter and Encoder.Jonathan Hogg
Add documentation for `machine.Counter` and `machine.Encoder` as currently implemented by the esp32 port, but intended to be implemented by other ports. Originally authored by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com> and Jonathan Hogg <me@jonathanhogg.com>. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2025-07-23docs/reference/speed_python: Document schedule/GIL limitation of native.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-05-18docs/reference/mpremote: Document the 'fs tree' command.Jos Verlinde
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-04-09docs/reference/mpremote: Update docs for mpremote rm -r.Jos Verlinde
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-03-06tools/mpremote: Add romfs query, build and deploy commands.Damien George
These commands use the `vfs.rom_ioctl()` function to manage the ROM partitions on a device, and create and deploy ROMFS images. Signed-off-by: Damien George <damien@micropython.org>
2025-02-25docs: Fix double 'the' in documentation.Ronald Weber
Signed-off-by: Ronald Weber <ronaldxweber@gmail.com>
2025-02-25all: Upgrade codespell to v2.4.1.Christian Clauss
This commit upgrades from codespell==2.2.6 to the current codespell==2.4.1, adding emac to the ignore-words-list. Signed-off-by: Christian Clauss <cclauss@me.com>
2025-02-24tools/mpremote: Add support for relative urls in package.json files.Glenn Moloney
URLs in `package.json` may now be specified relative to the base URL of the `package.json` file. Relative URLs wil work for `package.json` files installed from the web as well as local file paths. Docs: update `docs/reference/packages.rst` to add documentation for: - Installing packages from local filesystems (PR #12476); and - Using relative URLs in the `package.json` file (PR #12477); - Update the packaging example to encourage relative URLs as the default in `package.json`. Add `tools/mpremote/tests/test_mip_local_install.sh` to test the installation of a package from local files using relative URLs in the `package.json`. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
2025-02-11docs/reference: Add strings vs bytes to speed optimisation tips.Angus Gratton
Also add some additional context links, suggestions for alternative classes, etc. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-01-16docs/reference/isr_rules: Describe issue with hard ISRs and globals.peterhinch
Signed-off-by: Damien George <damien@micropython.org>
2024-11-30docs,ports: Fix some comments and error messages with doubled-up words.chuangjinglu
Signed-off-by: chuangjinglu <chuangjinglu@outlook.com>
2024-11-19docs/esp32: Add a factory reset page.Angus Gratton
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-19docs/rp2: Add a small factory reset page.Angus Gratton
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-19docs: Add a "Reset and Boot Sequence" reference page.Angus Gratton
Previously individual ports documented these aspects to varying degrees, but most of the information is common to all ports. In particular, this adds a canonical explanation of `boot.py` and `main.py`. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-08docs: Specify the recommended network.WLAN.IF_[AP|STA] constants.Angus Gratton
Removes the deprecated network.[AP|STA]_IF form from the docs. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-10-31docs/reference/packages: Fix description of --target option in mip.Jan Klusáček
Descripton of mip usage with micropython port suggest using it like this: ./micropython -m mip install --target=third-party pkgname But it should be called without equal sign: ./micropython -m mip install --target third-party pkgname Signed-off-by: honza.klu@gmail.com
2024-10-09docs/reference/mpremote: Update docs to mention new features.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-09-17docs/reference: Fix pyboard.py filesystem cp example with three files.Damien George
Fix documentation to match behaviour (directories are not preserved). Fixes issue #11101. Signed-off-by: Damien George <damien@micropython.org>
2024-07-05docs: Update docs to replace ifconfig with ipconfig.Felix Dörre
Follow up to 1c6012b0b5c62f18130217f30e73ad3ce4c8c9e6 Signed-off-by: Felix Dörre <felix@dogcraft.de>
2024-06-21mpy-cross: Add RISC-V RV32IMC support in MPY files.Alessandro Gatti
MPY files can now hold generated RV32IMC native code. This can be accomplished by passing the `-march=rv32imc` flag to mpy-cross. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-05-15docs/reference: Document how to mip install packages from GitLab.Olivier Lenoir
Signed-off-by: Olivier Lenoir <olivier.len02@gmail.com>
2024-03-28docs/reference/mpyfiles: Document change in .mpy sub-version.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-02-08tools/manifestfile.py: Change library search to use a list of paths.Damien George
This commit changes how library packages are searched for when a manifest file is loaded: there is now simply a list of library paths that is searched in order for the given package. This list defaults to the main directories in micropython-lib, but can be added to -- either appended or prepended -- by using `add_library()`. In particular the way unix-ffi library packages are searched has changed, because the `unix_ffi` argument to `require()` is now removed. Instead, if a build wants to include packages from micropython-lib/unix-ffi, then it must explicitly add this to the list of paths to search using: add_library("unix-ffi", "$(MPY_LIB_DIR)/unix-ffi") Work done in collaboration with Jim Mussared. Signed-off-by: Damien George <damien@micropython.org>
2024-02-07docs: Use vfs module instead of os.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-02-07docs/reference/micropython2_migration.rst: Add info about os and vfs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-02-07docs/library: Move vfs functions and classes from os to vfs module docs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-01-05all: Fix "reuse" and "overridden" spelling mistakes.Damien George
Codespell doesn't pick up "re-used" or "re-uses", and ignores the tests/ directory, so fix these manually. Signed-off-by: Damien George <damien@micropython.org>
2023-10-27docs/reference/micropython2_migration: Add migration guide.Jim Mussared
This is just scaffolding for now, but the idea is that there should be an addition to this file for every commit that uses the `MICROPY_PREVIEW_VERSION_2` macro. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-16docs/reference/mpyfiles: Document change in .mpy sub-version.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-10-03all: Fix various spelling mistakes found by codespell 2.2.6.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-09-29tools/mpremote: Add support for rfc2217, serial over TCP.Jos Verlinde
Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
2023-06-19docs: Rename uasyncio to asyncio.Jim Mussared
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-02docs/reference/mpremote.rst: Extend the mpremote guide.Jim Mussared
Changes in this commit: - Add a extra detail to each of the commands. - Add more about handling options and arguments. - Include shortcut commands that behave like real commands to the command list (e.g. bootloader, rtc). - Add extra information and reword to address common misconceptions, in particular how commands chain together. - Add additional examples showing some more interesting combinations. - Add descriptions to each of the examples. - Add pipx installation instructions. - Describe how user-configuration works. This work was sponsored by Google Season of Docs. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-02docs/reference/packages: Add GitHub repo to package example dependency.Jonas Scharpf
Signed-off-by: Jonas Scharpf <jonas@brainelectronics.de>
2023-05-23docs/reference/speed_python: Remove 4-arg limit for viper.Jim Mussared
This limit was removed in a676b5acf6ee9c17926cf9786370d30a077d99c0. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-05-22tools/mpremote: Add repl option to escape non-printable characters.Damien George
This commit adds the "--escape-non-printable" option to the repl command. When specified the REPL console will escape non-printable characters, printing them as their hex value in square brackets. This escaping behaviour was previously the default and only behaviour, but it is now opt-in. As part of this change, the speed of echoing device data to the console is improved by by reading and writing in chunks. Signed-off-by: Damien George <damien@micropython.org>
2023-05-11docs/reference/mpyfiles: Add release info on v6.1.David Lechner
This documents when MPY v6.1 was released. Also add some clarification on how the version is encoded in the header. Signed-off-by: David Lechner <david@pybricks.com>
2023-05-01docs/reference: Remove double 'are' in glossary.algonell
2023-04-27all: Fix spelling mistakes based on codespell check.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-01-19docs/reference/constrained: Add missing heap-dump symbols to mem_info().Chris Overgaauw
2022-12-07docs/library/neopixel: Update GitHub URL for neopixel.py link.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-25tools/mpremote: Only auto connect to serial device with USB VID/PID.Michael Mogenson
On MacOS and Windows there are a few default serial devices that are returned by `serial.tools.list_ports.comports()`. For example on MacOS: ``` {'description': 'n/a', 'device': '/dev/cu.Bluetooth-Incoming-Port', 'hwid': 'n/a', 'interface': None, 'location': None, 'manufacturer': None, 'name': 'cu.Bluetooth-Incoming-Port', 'pid': None, 'product': None, 'serial_number': None, 'vid': None} {'description': 'n/a', 'device': '/dev/cu.wlan-debug', 'hwid': 'n/a', 'interface': None, 'location': None, 'manufacturer': None, 'name': 'cu.wlan-debug', 'pid': None, 'product': None, 'serial_number': None, 'vid': None} ``` Users of mpremote most likely do not want to connect to these ports. It would be desirable if mpremote did not select this ports when using the auto connect behavior. These serial ports do not have USB VID or PID values and serial ports for Micropython boards with FTDI/serial-to-USB adapter or native USB CDC/ACM support do. Check for the presence of a USB VID / PID int value when selecting a serial port to auto connect to. All serial ports will still be listed by the `list` command and can still be selected by name when connecting. Signed-off-by: Michael Mogenson <michael.mogenson@gmail.com>
2022-10-01tools/mpremote: Add `mpremote mip install` to install packages.Jim Mussared
This supports the same package sources as the new `mip` tool. - micropython-lib (by name) - http(s) & github packages with json description - directly downloading a .py/.mpy file The version is specified with an optional `@version` on the end of the package name. The target dir, index, and mpy/no-mpy can be set through command line args. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-30top: Replace upip with mip everywhere.Jim Mussared
Updates all README.md and docs, and manifests to `require("mip")`. Also extend and improve the documentation on freezing and packaging. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>