Wykres commitów

1114 Commity (95c614e2b60b5c1c83c85aefe88a2aadbf43b9ed)

Autor SHA1 Wiadomość Data
Damien George d7919ea71e all: Bump version to 1.19.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-16 15:11:02 +10:00
Andrew Scheller cedb93c179 docs: Update Raspberry Pi URLs from .org to .com. 2022-06-14 11:41:13 +10:00
Damien George cf7d962cf3 docs/reference/mpyfiles: Update .mpy description to match latest format.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-10 16:42:43 +10:00
Damien George 9670a156da all: Rename MICROPY_PY_WIZNET5K to MICROPY_PY_NETWORK_WIZNET5K.
To match MICROPY_PY_NETWORK_CYW43 and MICROPY_PY_NETWORK_NINAW10.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 16:55:18 +10:00
Damien George efe23aca71 all: Remove third argument to MP_REGISTER_MODULE.
It's no longer needed because this macro is now processed after
preprocessing the source code via cpp (in the qstr extraction stage), which
means unused MP_REGISTER_MODULE's are filtered out by the preprocessor.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 16:31:37 +10:00
Andrew Leech ea9a904b72 docs/reference/manifest: Add link to details about opt-level for freeze. 2022-05-27 14:45:46 +10:00
robert-hh f795d5bc38 docs/mimxrt: Move the pinout tables to a separate document.
This shortens the quickref.  Also change the note about the hardware SPI
frequeny limits.
2022-05-27 12:48:16 +10:00
robert-hh eda52e4d73 docs/mimxrt: Add i.MX RT1015 to general.rst, and a few clarifications. 2022-05-27 12:47:54 +10:00
David Lechner c012318d74 unix: Implement `-X realtime` command-line option on macOS.
This adds a new command line option to the unix port `-X realtime` to
enable realtime priority on threads.  This enables high precision timers
for applications that need more accurate timers.

Related docs:
https://developer.apple.com/library/archive/technotes/tn2169/_index.html

Fixes issue #8621.

Signed-off-by: David Lechner <david@pybricks.com>
2022-05-24 00:51:47 +10:00
Damien George c1b9d2259e py/dynruntime.mk: Add basic support for armv6m architecture.
The examples/natmod features0 and features1 examples now build and run on
ARMv6-M platforms.  More complicated examples are not yet supported because
the compiler emits references to built-in functions like __aeabi_uidiv.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-23 23:01:25 +10:00
Damien George 079f3e5e5b py/parse: Allow all constant objects to be used in "X = const(o)".
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-18 16:18:35 +10:00
Damien George 2a366e183e docs/reference/mpyfiles: Remove docs about mpy flags and qstr win size.
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17 12:51:54 +10:00
Takeo Takahashi a21fd7cc21 docs/renesas-ra: Remove unused image files.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-05-03 13:22:01 +10:00
Takeo Takahashi 52add7b45c docs: Update files for renesas-ra port.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29 12:29:08 +09:00
Takeo Takahashi 1b61800530 docs/renesas-ra: Add renesas-ra docs files.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29 12:29:08 +09:00
Damien George 402df833fe py/modsys: Introduce sys.implementation._machine constant.
This contains a string useful for identifying the underlying machine.  This
string is kept consistent with the second part of the REPL banner via the
new config option MICROPY_BANNER_MACHINE.

This makes os.uname() more or less redundant, as all the information in
os.uname() is now available in the sys module.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-28 17:23:03 +10:00
Damien George 59c5d41611 py/modsys: Rename sys.implementation.mpy to sys.implementation._mpy.
Per CPython docs, non-standard attributes must begin with an underscore.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-28 17:23:03 +10:00
Damien George 2a08e38c60 docs/library/network.WLAN: Add "txpower" to list of known WLAN configs.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-22 21:51:29 +10:00
Damien George 9ab66b50cb docs/reference: Update constrained docs now that tuples can be const.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-15 00:17:08 +10:00
Damien George 1daeeb2430 docs/differences: Update Python 3.5 diff, with optional listen backlog.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-11 15:28:56 +10:00
Rob Knegjens d3d862769a tools/mpremote: Add option to mount cmd to allow "unsafe" symlinks.
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-11 15:15:04 +10:00
Andrew Leech 3b99b4d675 docs/reference/mpremote: Add details about mount usage over soft reboot. 2022-04-04 16:50:07 +10:00
robert-hh 56b331ace6 drivers/codec: Add driver for the WM8960 codec.
This codec is assembled for the MIMXRT1xxx_DEV boards and available for
WM8960 breakout boards as well.

The driver itself has been tested as working with the MIMXRT boards and a
Sparkfun WM6890 breakout board.  It implements the initialization, basic
methods and some enhanced methods like 3D, ALC, soft-mute and deemphasis.
2022-04-04 16:31:17 +10:00
robert-hh 7a447e08b2 docs: Add quickref and docs for mimxrt, including network.LAN docs. 2022-04-04 14:11:31 +10:00
iabdalkader 5cdf964571 docs/library/pyb.CAN: Update CAN docs to match revised API. 2022-04-02 22:46:07 +11:00
David Lechner 783b1a868f py/runtime: Allow multiple *args in a function call.
This is a partial implementation of PEP 448 to allow unpacking multiple
star args in a function or method call.

This is implemented by changing the emitted bytecodes so that both
positional args and star args are stored as positional args.  A bitmap is
added to indicate if an argument at a given position is a positional
argument or a star arg.

In the generated code, this new bitmap takes the place of the old star arg.
It is stored as a small int, so this means only the first N arguments can
be star args where N is the number of bits in a small int.

The runtime is modified to interpret this new bytecode format while still
trying to perform as few memory reallocations as possible.

Signed-off-by: David Lechner <david@pybricks.com>
2022-03-31 16:59:30 +11:00
MikeTeachman 1f6cb8f047 mixmrt/machine_i2s: Add I2S protocol support.
This commit adds support for machine.I2S on the mimxrt port.  The I2S API
is consistent with the existing stm32, esp32, and rp2 implementations.

I2S features:
- controller transmit and controller receive
- 16-bit and 32-bit sample sizes
- mono and stereo formats
- sampling frequencies from 8kHz to 48kHz
- 3 modes of operation:
  - blocking
  - non-blocking with callback
  - uasyncio
- configurable internal buffer
- optional MCK

Tested with the following development boards:
- MIMXRT1010_EVK, MIMXRT1015_EVK, MIMXRT1020_EVK, MIMXRT1050_EVK
- Teensy 4.0, Teensy 4.1
- Olimex RT1010
- Seeed ARCH MIX

Tested with the following I2S hardware peripherals:
- UDA1334
- GY-SPH0645LM4H
- WM8960 codec on board the MIMXRT boards and separate breakout board
- INMP441
- PCM5102
- SGTL5000 on the Teensy audio shield

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2022-03-30 14:12:40 +11:00
Damien George 5e685a9c6f docs/library/machine.I2S: Clarify what rate refers to.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-29 11:44:08 +11:00
Jonathan Hogg 21d0599bd1 esp32/modesp32: Add new gpio_deep_sleep_hold function.
Add a new function to control whether held pins will retain their function
through deep-sleep.

Also document this function and explain how to use this in quickref to
retain pin configuration during deep-sleep.
2022-03-21 23:59:07 +11:00
Jonathan Hogg 7684c996bc esp32/machine_pin: Add new hold keyword argument and remove PULL_HOLD.
The current pull=Pin.PULL_HOLD argument doesn't make a lot of sense in the
context of what it actually does vs what the ESP32 quickref document says
it does.

This commit removes PULL_HOLD and adds a new hold=True|False keyword
argument to Pin()/Pin.init().  Setting this to True will cause the ESP32 to
lock the configuration of the pin – including direction, output value,
drive strength, pull-up/-down – such that it can't be accidentally changed
and will be retained through a watchdog or internal reset.

Fixes issue #8283, and see also #8284.
2022-03-21 23:55:02 +11:00
Jonathan Hogg 5887dfeea6 docs/esp32/quickref: Refine deep-sleep power-saving notes.
This attempts to better explain how pull-ups and pull-downs operate in
deep-sleep mode.
2022-03-21 23:54:41 +11:00
Damien George ac2293161e py/modsys: Add optional mutable attributes sys.ps1/ps2 and use them.
This allows customising the REPL prompt strings.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-10 10:58:33 +11:00
Damien George cac939ddc3 py/modsys: Add optional sys.tracebacklimit attribute.
With behaviour as per CPython.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-10 10:43:21 +11:00
Jonathan Hogg 3ebc370344 docs/library/machine.Pin: Update to use preferred DRIVE_x constants.
Update documents with new common names for the drive strength constants.
2022-03-07 23:47:45 +11:00
Jonathan Hogg 4c7c80d626 docs/esp32/quickref: Document GPIO drive strength.
Add brief documentation of the new `drive` keyword argument.
2022-03-07 23:41:29 +11:00
Maureen Helm 474d288e55 zephyr: Upgrade to Zephyr v3.0.0.
Updates the Zephyr port build instructions and CI to use the latest
Zephyr release tag.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-03-07 16:48:35 +11:00
Damien George bb2bd071f7 docs/library/esp32.rst: Mark esp32.Partition as not taking kw args.
Fixes issue #8380.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-07 15:15:45 +11:00
David Lechner eadc927baf docs/differences/python_35: Mark PEP 486 as not applicable.
This adds the "Not relevant" designation to PEP 486 since it has to do with
the Python Launcher for Windows and not the Python language itself.

Also fix a typo while we are touching this line.

Signed-off-by: David Lechner <david@pybricks.com>
2022-03-07 14:15:21 +11:00
Jan 5d9171b5cc docs/library/machine.UART.rst: Add details for `invert` parameter. 2022-03-07 14:12:50 +11:00
Damien George d6564a3159 tools/mpremote: Add "umount" command.
Signed-off-by: Damien George <damien@micropython.org>
2022-02-25 13:10:45 +11:00
Damien George ad1f523e7e tools/mpremote: Add "resume" and "soft-reset" commands.
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-25 13:09:28 +11:00
Damien George 106a83de22 esp32/esp32_partition: Add support for specifying block_size.
To support filesystems that use a block size different from the native
erase-page size.

Signed-off-by: Damien George <damien@micropython.org>
2022-02-22 00:37:25 +11:00
Lars Kellogg-Stedman 8f6924c9fb docs/library/uasyncio.rst: Fix description of ThreadSafeFlag.wait.
When a task waits on a ThreadSafeFlag (and the wait method returns), the
flag is immediately reset.  This was not clear in the documentation, which
appeared to copy the description of the wait method from the Event class.

Signed-off-by: Lars Kellogg-Stedman <lars@oddbit.com>
2022-02-09 16:09:48 +11:00
Jos Verlinde 6653856b87 docs/library/machine.Pin.rst: Document defaults for Pin.init. 2022-02-09 15:55:10 +11:00
Jos Verlinde 7f67524031 docs/library/pyb.SPI.rst: Document default for prescaler argument.
To prevent "non-default argument follows default argument" errors.
2022-02-09 15:06:34 +11:00
Jos Verlinde 58cd2a8b0a docs/library/esp.rst: Document the osdebug function. 2022-02-09 15:06:19 +11:00
Jos Verlinde f99b679916 docs/library/machine.WDT.rst: Use correct case for WDT.feed. 2022-02-09 15:05:49 +11:00
Jos Verlinde 7621b17636 docs/library/machine.SPI.rst: Add class constant SoftSPI.MSB and .LSB. 2022-02-09 15:05:38 +11:00
Jos Verlinde 8715ad9ccf docs/library/pyb.DAC.rst: Add DAC class constants. 2022-02-09 15:05:26 +11:00
Jos Verlinde ba4f6f5fdf docs/library/pyb.rst: Add pyb.hid_mouse and pyb.hid_keyboard constants. 2022-02-09 15:04:57 +11:00
Jos Verlinde 50b172023f docs/library/pyb.Timer.rst: Add pyb.Timer class constants. 2022-02-09 15:04:24 +11:00
Jos Verlinde 2c30ac7aeb docs/library/socket.rst: Document socket as a class.
Following CPython: https://bugs.python.org/issue45772
2022-02-09 15:03:26 +11:00
Jos Verlinde cd0531c533 docs: Use the correct * keyword-only notation. 2022-02-09 15:01:00 +11:00
Jos Verlinde a41abd94dc docs/library/collections.rst: Use class for deque and OrderedDict. 2022-02-09 15:00:00 +11:00
Peter Hinch 80b81acea5 docs/reference/isr_rules.rst: Describe uasyncio-IRQ interface. 2022-02-04 12:27:16 +11:00
Jonathan Hogg a43764e654 docs/esp32/quickref: Update ADC documentation.
Update ADC documentation now that the new API is described in the main
docs.
2022-02-04 12:05:15 +11:00
Luiz Brandao ddda959e57 docs/reference/isr_rules.rst: Fix inconsistent variable name in example.
Fixed to be conistent with the code example above it.
2022-02-04 11:20:15 +11:00
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 326b2c79df docs: Remove reference to obsolete neopixel_write function.
It has been replaced by machine.bitstream.

Signed-off-by: Damien George <damien@micropython.org>
2022-02-02 16:27:10 +11:00
Damien George 79a3158de6 stm32/pin: Change remaining uses of "af" to "alt".
The keyword "af" has been deprecated for some time and "alt" should be used
instead (but "af" still works).

Signed-off-by: Damien George <damien@micropython.org>
2022-01-27 16:44:13 +11:00
Damien George c153bfd311 docs/differences: Update python_36 now that b2a_base64 accepts newline.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-23 10:23:30 +11:00
Christian Decker 2e3a2785cd extmod/modubinascii: Add newline keyword to b2a_base64 function.
This allows encoding things (eg a Basic-Auth header for a request) without
slicing the \n from the string, which allocates additional memory.

Co-authored-by: David Lechner <david@lechnology.com>
2022-01-23 10:18:01 +11:00
Damien George aafd8859e9 docs/differences: Update differences now that math.tau/inf/nan exist.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-23 09:33:19 +11:00
Jonathan Hogg 3300d6d337 docs/esp32: Document expanded ADC API in quickref.
Document read_u16(), read_uv() and ADCBlock(). Mark old read(), atten() 
and width() methods as legacy.
2022-01-21 22:40:37 +11:00
Damien George 4d2f487ee1 docs/library: Specify additional ADC methods and new ADCBlock class.
The new ADC methods are: init(), read_uv() and block().

The new ADCBlock class has methods: init() and connect().

See related discussions in #3943, #4213.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-21 22:35:23 +11:00
Damien George 7d71ae25ed extmod/machine_i2c: Increase default SoftI2C timeout to 50ms.
Some devices, eg BNO055, can stretch SCL for a long time, so make the
default large to accommodate them.  50ms matches the current default for
stm32 hardware I2C .

Signed-off-by: Damien George <damien@micropython.org>
2022-01-21 15:10:30 +11:00
Damien George da4b38e756 all: Bump version to 1.18.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-17 09:50:31 +11:00
Damien George a3bbd5332b esp32/machine_bitstream: Reinstate bitstream bit-bang implementation.
The bit-bang implementation was replaced with the RMT implementation in
599b61c086.  This commit brings back that
bit-bang code, and allows it to be selected via the new static method:

    esp32.RMT.bitstream_channel(None)

The bit-bang implementation may be useful if the RMT needs to be used for
something else, or if bit-banging is more stable in certain applications.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-14 16:40:01 +11:00
Damien George 8957386250 docs/esp32: Update RMT quickref example to match latest code.
The start keyword was removed in 18e48a71ee

Signed-off-by: Damien George <damien@micropython.org>
2022-01-13 22:39:58 +11:00
Damien George 8ac5613419 LICENSE,docs: Update copyright year range to include 2022.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-06 15:50:14 +11:00
Maureen Helm c6d26bc524 zephyr: Upgrade to Zephyr v2.7.0.
Updates the Zephyr port build instructions and CI to use the latest
Zephyr release tag.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-01-06 14:09:39 +11:00
NitiKaur 01953f2964 docs/differences: Document details of new PEPs/features in Python 3.5+.
And how they relate to MicroPython.  As these features are implemented (or
the decision is made to not implement them) the tables can be updated to
document the differences between MicroPython and standard Python.
2022-01-05 22:49:20 +11:00
IhorNehrutsa 09fe80d091 esp32/machine_pwm: Keep duty constant when changing frequency.
Save and restore the same duty cycle when the frequency (or frequency
resolution) is changed.  This allows a smooth frequency change.

Also update the esp32 PWM quickref to be clearer.
2021-12-22 00:05:58 +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
Jim Mussared 86394f70fc docs/library/sys.rst: Add note about '.frozen' as an entry in sys.path.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
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
IhorNehrutsa b491967bbd esp32/machine_pwm: Implement duty_u16() and duty_ns() PWM methods.
The methods duty_u16() and duty_ns() are implemented to match the existing
docs.  The duty will remain the same when the frequency is changed.
Standard ESP32 as well as S2, S3 and C3 are supported.

Thanks to @kdschlosser for the fix for rounding in resolution calculation.

Documentation is updated and examples expanded for esp32, including the
quickref and tutorial.  Additional notes are added to the machine.PWM docs
regarding limitations of hardware PWM.
2021-12-03 23:58:52 +11:00
Jonathan Hogg 851ecb2da1 extmod/modbluetooth: Support gap_connect(None) to cancel a connection.
Allow cancellation of in-progress peripheral connections.
2021-12-01 11:56:37 +11:00
Scott Armitage de7e3cd792 docs/library/machine.Pin.rst: Add Pin.ANALOG mode constant. 2021-11-30 22:33:18 +11:00
Michael Buesch 68d1245f42 docs/library/machine.Timer.rst: Document `period` and `callback` args.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:29:03 +11:00
Michael Buesch 1e7c8f2b0b docs/library/machine.SPI.rst: Add example SPI usage.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:28:19 +11:00
Michael Buesch e7900351bf docs/library/machine.Timer.rst: Document 'id' as positional-only arg.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:27:58 +11:00
Peter Hinch d94ac4333f docs/library/uasyncio.rst: Detail exception behaviour in cancel/timeout. 2021-11-30 21:43:06 +11:00
gibbonsc de8dc4bad2 docs/esp8266/tutorial: Fix comments of FrameBuffer examples.
The third and fourth parameters in display.rect() and display.fill_rect()
are not x,y coordinates, but are instead width,height values.  Update the
comment after the example to show the correct x,y coordinates of the bottom
right corner of each rectangle, respectively.
2021-11-25 23:34:19 +11:00
NitiKaur b851950c26 docs/library/sys.rst: Add docs for sys.settrace. 2021-11-19 15:30:34 +11:00
NitiKaur e538d8a5a6 docs/rp2/quickref.rst: Add section on PIO. 2021-11-19 15:30:14 +11:00
Damien George 01f1c3aac2 docs/reference/filesystem.rst: Add detail on how to use littlefs fuse.
Without the --block_count option the fuse will fail.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-19 15:13:05 +11:00
oli f72b49756d docs/library/rp2.rst: Update function asm_pio_encode to add sideset_opt. 2021-11-19 13:38:56 +11:00
Sebastian Wicki 8f3510799d docs/library/framebuf.rst: Adjust dimensions in example.
This commit swaps the dimensions of the `framebuffer.FrameBuffer` in the
docs example from 10x100 to 100x10 pixels to avoid clipping.

This is done to better fit the subsequent example code, which writes
text of size 96x8 followed by a 96x1 horizontal line.

The y coordinate of the horizontal line is also adjusted such that it is
drawn inside of the new canvas bounds.
2021-11-17 14:36:33 +11:00
Mike Teachman b6dbbbe82f rp2/machine_i2s: Add I2S protocol support.
This commit adds I2S protocol support for the rp2 port:
- I2S API is consistent with STM32 and ESP32 ports
- I2S configurations supported:
  - master transmit and master receive
  - 16-bit and 32-bit sample sizes
  - mono and stereo formats
  - sampling frequency
  - 3 modes of operation:
    - blocking
    - non-blocking with callback
    - uasyncio
  - internal ring buffer size can be tuned
- DMA IRQs are managed on an I2S object basis, allowing other
  RP2 entities to use DMA IRQs when I2S is not being used
- MicroPython documentation
- tested on Raspberry Pi Pico development board
- build metric changes for this commit: text(+4552), data(0), bss(+8)

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2021-11-13 12:27:42 +11:00
Andrew Scheller 0adea40716 docs/rp2/general.rst: Fix typo with missing spaces. 2021-11-01 15:41:50 +11:00
Jim Mussared 43467b9c71 extmod/modbluetooth: Add connection interval to gap_connect.
This forwards through directly to the NimBLE and BTStack connect functions.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-26 00:16:53 +11:00
NitiKaur 4c9e17e0a1 docs/esp32/tutorial: Add an example of peripheral control via regs. 2021-10-14 23:31:45 +11:00
NitiKaur 763042a287 docs/library/stm.rst: Document the stm module. 2021-10-14 23:19:08 +11:00
NitiKaur e87b2e8bfa docs/reference/manifest.rst: Add docs for manifest.py files. 2021-10-14 14:03:03 +11:00
NitiKaur 135339ce3a docs/reference/mpremote.rst: Add docs for mpremote. 2021-10-14 13:09:51 +11:00
NitiKaur c42c1c8718 docs/library/random.rst: Document the random module. 2021-10-13 16:56:37 +11:00
NitiKaur baa5a76fc0 docs/rp2: Add reference for PIO assembly instructions, and PIO tutorial. 2021-10-13 15:54:49 +11:00
IhorNehrutsa 71111cffba docs/esp32: Explain ESP32 PWM modes, timers, and channels. 2021-09-21 23:28:16 +10:00
Jim Mussared b326edf68c all: Remove MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE.
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-09-16 16:04:03 +10:00