Commit Graph

13702 Commits

Author SHA1 Message Date
Damien George
f4e69ab103 lib/cyw43-driver: Update cyw43-driver to fix ap_auth mode setting.
Signed-off-by: Damien George <damien@micropython.org>
2022-07-05 11:04:20 +10:00
Damien George
3d76292f37 rp2/boards/GARATRONIC_PYBSTICK26_RP2040: Change pico-sdk board name.
This follows a similar renaming in pico-sdk.

Signed-off-by: Damien George <damien@micropython.org>
2022-07-05 09:45:44 +10:00
Jim Mussared
6519b1b95e stm32/Makefile: Fix setting of define that enables WIZNET5K driver.
Commit 9670a156da missed one renaming of
MICROPY_PY_WIZNET5K to MICROPY_PY_NETWORK_WIZNET5K which prevented the
Wiznet interface from being enabled.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-02 00:21:36 +10:00
Damien George
99c2589778 rp2/boards/PICO_W: Add new Pico W board, an RP2040 with WiFi.
Work done in collaboration with Graham Sanderson and Peter Harper.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 17:03:51 +10:00
Damien George
50e46552c0 rp2: Integrate CYW43xx WiFi driver.
This includes:
- Configuration file for the cyw43-driver.
- Integration of cyw43-driver into the build, using lwIP.
- Enhancements to machine.Pin to support extension IO pins provided by the
  CYW43xx.
- More mp-hal pin helper functions.
- mp_hal_get_mac_ascii MAC address helper function.
- Addition of rp2.country() function to set the country code.

A board can enable this driver by setting MICROPY_PY_NETWORK_CYW43 in their
cmake snippet.

Work done in collaboration with Graham Sanderson and Peter Harper.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 17:03:51 +10:00
Damien George
c001cfa603 rp2/mpnetworkport: Convert network task scheduling to use PendSV IRQ.
It is more reliable and scales better when more components need it.

Work done in collaboration with Graham Sanderson and Peter Harper.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 17:03:47 +10:00
Damien George
7cdad05e54 rp2/rp2_flash: Add asserts for size of flash filesystem partition.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 16:03:21 +10:00
Damien George
c95f99105a rp2/lwip_inc: Enable lwIP status callback.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 16:03:21 +10:00
Damien George
11f920f8ad rp2/mbedtls: Enable some more mbedtls options.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 16:03:21 +10:00
Damien George
f525e17793 lib/pico-sdk: Update to version 1.4.0.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 16:03:21 +10:00
Damien George
18a010b5b1 lib/cyw43-driver: Add new submodule for CYW43xx WiFi driver.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 16:03:21 +10:00
Damien George
4f30c60dcb extmod/modnetwork: Include cyw43-driver header if it's enabled.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 16:03:21 +10:00
Damien George
7dd818052e extmod/network_cyw43: Support new cyw43-driver.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 14:10:58 +10:00
Damien George
f75e611054 extmod/vfs: Prevent uninitialized variable warning for path_out.
The warning can appear when building in Release mode on the rp2 port.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 13:54:50 +10:00
Damien George
f1b5761ced py/mkrules.cmake: Improve printing of git-submodules error.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 13:49:47 +10:00
Jim Mussared
797a83ac3e rp2/mpthreadport: Ensure core1 doesn't hold gc lock in deinit.
Prior to this commit the following code would lock up the device when
Ctrl-D is entered at the REPL:

    import gc, _thread

    def collect_thread():
        while True:
            gc.collect()

    _thread.start_new_thread(collect_thread, [])

Fixes part of #8494.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-06-30 11:53:25 +10:00
Damien George
b004e7e397 rp2/modmachine: Implement lightsleep() with optional sleep period.
This gets basic machine.lightsleep([n]) behaviour working on the rp2 port.
It supports:

- Calling lightsleep without a specified period, in which case it uses xosc
  dormant mode.  There's currently no way to wake it up from this state,
  unless you write to raw registers to enable a GPIO wake up source.

- Calling lightsleep with a period n in milliseconds.  This period must be
  less than about 72 minutes and uses timer alarm3 to wake it up.

The RTC continues to run during lightsleep, but other peripherals have
their clock turned off during the sleep.

It doesn't yet support longer periods than 72 minutes, or waking up from
GPIO IRQ.

Measured current consumption from the USB port on a PICO board is about
1.5mA when doing machine.lightsleep(5000), and about 0.9mA when doing
machine.lightsleep().

Addresses issue #8770.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-30 11:40:17 +10:00
Damien George
932556d5fc tests/micropython: Add test for builtin execfile() function.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-29 12:48:42 +10:00
Damien George
afa4d0a4b7 unix/variants/dev: Allow all config options to be overridden.
They can be overridden on the make command line, for example.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-29 12:48:33 +10:00
Damien George
510bea9383 unix/variants/coverage: Change config to use ROM level everything.
This ROM level is not yet fully defined, but it at least enables
MICROPY_PY_SYS_TRACEBACKLIMIT.  The coverage build should have everything
enabled, so it makes sense to use this ROM level for it.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-29 12:48:33 +10:00
Damien George
fad978ae5f unix/variants: Enable remaining options on dev,coverage from ROM extra.
So that the default configuration for the dev and coverage variants
includes all options set by MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES.

Note that enabling MICROPY_PY_SYS_STDIO_BUFFER on unix doesn't do anything
because unix doesn't use shared/runtime/sys_stdio_mphal.c.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-29 12:23:11 +10:00
Damien George
fe55d3e016 unix/variants: Move setting of MICROPY_PY_USELECT to port config file.
The default is the same as before: MICROPY_PY_USELECT=0 and
MICROPY_PY_USELECT_POSIX=1.  But now this can be easily overridden at the
make command-line using, eg:

    make VARIANT=dev CFLAGS_EXTRA=-DMICROPY_PY_USELECT=1

Signed-off-by: Damien George <damien@micropython.org>
2022-06-29 12:22:56 +10:00
Damien George
6e83bb47eb py/builtinhelp: Don't show help for an MP_MODULE_ATTR_DELEGATION_ENTRY.
Otherwise it can lead to a crash.

Fixes issue #8816.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-28 16:35:01 +10:00
Angus Gratton
e024a4c59c tests: Fix run-perfbench parsing "no matching params" case.
Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28 14:22:06 +10:00
Angus Gratton
ad308bc322 tests: Add an explanation of run-perfbench.py.
Also changes this file to a Markdown file.

Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28 14:21:41 +10:00
Damien George
ccaf197807 esp32/network_wlan: Don't raise exception when scan returns no results.
Prior to this commit, running scan() without any APs available would give:

    >>> wl.scan()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    RuntimeError: Wifi Unknown Error 0x0102

Signed-off-by: Damien George <damien@micropython.org>
2022-06-28 13:18:07 +10:00
Angus Gratton
dd77dbd4f7 stm32/boards: Enable LTO by default on boards with smaller flash size.
Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28 10:32:39 +10:00
Angus Gratton
5568c324ba tests/perf_bench: Add some configurations for N=32, M=10.
For STM32L072 and similar, very low end targets.

The other perf_bench tests run out of memory, crash, or fail on
prerequisite features.

Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28 10:32:18 +10:00
Angus Gratton
e76d88b531 stm32/Makefile: Enable link-time-optimisation via LTO=1 make option.
When tested, this reduces default MP binary sizes by approx 2-2.5%, and
very marginally increases performance in benchmarks. Build times seem very
similar to non-LTO when using gcc 12.

See #8733 for further discussion.

Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28 10:31:32 +10:00
Angus Gratton
2c015375d1 stm32: Use a separate symbol name for the bootloader state pointer.
Prerequisite for enabling Link Time Optimisation.

The _bl_state address is the same as _estack, but _estack is referred to as
a uint32_t elsewhere in the code. LTO doesn't like it when the same symbol
has two different types.

Signed-off-by: Angus Gratton <gus@projectgus.com>
2022-06-28 10:25:08 +10:00
Damien George
5b66d08609 py/builtin: Remove unnecessary module declarations.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-27 22:17:13 +10:00
Damien George
e22b7fb4af py/objfun: Support function attributes on native functions.
Native functions can just reuse the bytecode function attribute code.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-25 00:22:15 +10:00
Damien George
268ec1e3eb tests/basics: Add tests for __name__ and __globals__ attrs on closures.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-24 23:55:13 +10:00
Michael Bentley
d68532558d py/objclosure: Forward function attributes for closures.
Add .attr attribute which forwards to self->fun.

A closure is intended to wrap around a function object, so forward any
requested attributes to the wrapped function object.

Signed-off-by: Michael Bentley <mikebentley15@gmail.com>
2022-06-24 23:46:59 +10:00
Koen De Vleeschauwer
432b65f178 stm32/usb: Expose USB HID device instance via usbd_hid_get().
This is needed to implement a HID device in user C modules.
2022-06-24 18:33:26 +10:00
Jim Mussared
3ce21945b1 docs/library/bluetooth: Add link to aioble.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-06-24 18:05:39 +10:00
Philipp Ebensberger
4ce1adab31 mimxrt/boards: Remove conditional assignment of flash type/size.
Removes conditional assignment because respective variables should only be
set in board makefile fragments.  Hence no conditional assignment needed.
2022-06-24 17:58:27 +10:00
Philipp Ebensberger
434974ec77 mimxrt/Makefile: Fix some minor formatting inconsistencies. 2022-06-24 17:58:27 +10:00
Philipp Ebensberger
c957c76f4d mimxrt/Makefile: Rework floating point config.
Reworks source file and compile flags selection for floating point support.
2022-06-24 17:58:27 +10:00
Philipp Ebensberger
bec0524dbf mimxrt/Makefile: Rework board flash type handling.
Reworks handling and configuration of different board flash types in the
Makefile, linker scripts and board makefile fragments.
2022-06-24 17:58:27 +10:00
Philipp Ebensberger
84339aa8ec mimxrt/Makefile: Modify handling of SDCARD option.
Removes separate `if` case in Makefile for setting SDCARD option define.
2022-06-24 17:58:27 +10:00
Philipp Ebensberger
b1aec393b1 mimxrt/Makefile: Modify handling of SDRAM option.
Replaces preprocessor macro for SDRAM option from #ifdef to #if in order to
allow always setting the define `MICROPY_HW_SDRAM_AVAIL` just with the
appropriate value 0/1.  This eliminates one `if` in the Makefile.
2022-06-24 17:58:27 +10:00
Philipp Ebensberger
fbc50196ad mimxrt/Makefile: Refactor Makefile and divide it into sections.
Reworks grouping of Makefile variables and reorders variable values in
alphabetic order.
2022-06-24 17:58:25 +10:00
Damien George
db7682e02d extmod/uasyncio: Implement stream read(-1) to read all data up to EOF.
Fixes issue #6355.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-24 17:04:57 +10:00
Damien George
2a2589738c tests/extmod: Add heap-lock test for stream writing.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-24 17:00:24 +10:00
Thorsten von Eicken
c21452a1d2 extmod/uasyncio: Attempt to write immediately in Stream.write method.
The main aim of this change is to reduce the number of heap allocations
when writing data to a stream.  This is done in two ways:

1. Eliminate appending of data when .write() is called multiple times
   before calling .drain().  With this commit, the data is written out
   immediately if the underlying stream is not blocked, so there is no
   accumulation of the data in a temporary buffer.

2. Eliminate copying of non-bytes objects passed to .write().  Prior to
   this commit, passing a bytearray or memoryview to .write() would always
   result in a copy of it being made and turned into a bytes object.  That
   won't happen now if the underlying stream is not blocked.

Also, this change makes .write () more closely implement the CPython
documented semantics: "The method attempts to write the data to the
underlying socket immediately.  If that fails, the data is queued in an
internal write buffer until it can be sent."
2022-06-24 17:00:24 +10:00
Christian Walther
ba21f76f89 esp32/modesp32: Add wake_on_ulp() so ULP can wake CPU from deepsleep.
Add esp32.wake_on_ulp() to give access to esp_sleep_enable_ulp_wakeup(),
which is needed to allow the ULP co-processor to wake the main CPU from
deep sleep.
2022-06-23 17:31:01 +10:00
Christian Walther
cf550ad9d1 esp32/boards: Increase 512 bytes limit on ULP programs to 2040.
Allow esp32.ULP.load_binary() to use the maximum amount of memory available
again, which is 2040 bytes unless MICROPY_HW_RTC_USER_MEM_MAX is
customized.

This value regressed in 3d49b157b8
2022-06-23 17:24:59 +10:00
robert-hh
5f4539b0ca esp32/machine_uart: Implement the functionality of timeout_char arg.
Using it for the rx-timeout.  The value is given as ms, which is then
converted to character times.  A value of less than a character time will
cause the rx call to return immediately after 1 character, which may be
inefficient at high transmission rates.

Addresses #8778.
2022-06-23 17:13:41 +10:00
iabdalkader
425d8fc0d6 nrf: Enable optional support for Arduino 1200bps touch.
Individual boards must enable it via MICROPY_HW_USB_CDC_1200BPS_TOUCH.
2022-06-23 14:33:40 +10:00