Commit Graph

12662 Commits

Author SHA1 Message Date
Damien George
f28e8b9073 stm32/usbd_desc: Rename USBD_xxx descriptor opts to MICROPY_HW_USB_xxx.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:13:58 +10:00
Damien George
96c6b8cae3 ports: Rename USBD_VID/PID config macros to MICROPY_HW_USB_VID/PID.
For consistency with other board-level config macros that begin with
MICROPY_HW_USB.

Also allow boards in the mimxrt, nrf and samd ports to configure these
values.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:13:55 +10:00
Damien George
45f9a38451 docs/library/machine.I2S.rst: Fix use of sd pin in examples.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 20:40:54 +10:00
Damien George
78718fffb1 py/mkrules: Automatically build mpy-cross if it doesn't exist.
Commit 4173950658 removed automatic building
of mpy-cross, which rebuilt it whenever any of its dependent source files
changed.

But needing to build mpy-cross, and not knowing how, is a frequent issue.
This commit aims to help by automatically building mpy-cross only if it
doesn't exist.  For Makefiles it uses an order-only prerequisite, while
for CMake it uses a custom command.

If MICROPY_MPYCROSS (which is what makemanifest.py uses to locate the
mpy-cross executable) is defined in the environment then automatic build
will not be attempted, allowing a way to prevent this auto-build if needed.

Thanks to Trammell Hudson aka @osresearch for the original idea; see #5760.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 20:25:32 +10:00
Peter Züger
d290f369d0 tests/extmod/ujson: Add tests for dump/dumps separators argument.
Basically just copied ujson_dump(s).py and added various valid/invalid
separator tests.

Signed-off-by: Peter Züger <zueger.peter@icloud.com>
2021-08-07 13:52:16 +10:00
Peter Züger
ffc854f17f extmod/modujson: Add support for dump/dumps separators keyword-argument.
Optionally enabled via MICROPY_PY_UJSON_SEPARATORS.  Enabled by default.

For dump, make sure mp_get_stream_raise is called after
mod_ujson_separators since CPython does it in this order (if both
separators and stream are invalid, separators will raise an exception
first).

Add separators argument in the docs as well.

Signed-off-by: Peter Züger <zueger.peter@icloud.com>
Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 13:52:16 +10:00
Damien George
8616129f2e esp8266,esp32: Include hidden networks in WLAN.scan results.
Addresses issues #2697 and #5329.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 13:28:34 +10:00
Jim Mussared
bfc8e88ce1 esp32/mpconfigport.h: Enable reverse and inplace special methods.
Reverse operations are supported on stm32 and rp2, and esp32 has enough
space to also enable inplace operations, to make it complete.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-07 13:27:09 +10:00
Patrick Van Oosterwijck
028fc815cd esp32/boards: Add Silicognition wESP32 board configuration.
For rev 7+ boards with 16MB of flash.  Partition table allocates 2.4 MiB
for MicroPython, 11 MiB for the filesystem.
2021-08-07 12:50:13 +10:00
Will Sowerbutts
a3675294ae esp32/machine_uart: Add flow kw-arg to enable hardware flow control.
This enables optional support for the hardware UART to use the RTS and/or
CTS pins for flow control.

The new "flow" constructor keyword specifies a bitmask of RTS and/or CTS.
This matches the interface used by machine.UART on stm32 and rp2.

Previously on ESP32 it was possible to specify which pins to use for the
RTS and CTS signals, but hardware flow control was never functional: CTS
was not checked before transmitting bytes, and RTS was always driven high
(signalling no buffer space available).  With this patch, CTS and RTS both
operate as expected.

This also includes an update to the machine.UART documentation.

Signed-off-by: Will Sowerbutts <will@sowerbutts.com>
2021-08-04 13:52:15 +10:00
Mike Causer
71722c84ca rp2/boards: Add Pimoroni Tiny 2040. 2021-08-01 23:07:57 +10:00
Mike Causer
042a4bebc3 rp2/boards: Add Pimoroni Pico LiPo 16MB. 2021-08-01 23:07:05 +10:00
Mike Causer
95eff8d96a rp2/boards: Add Pimoroni Pico LiPo 4MB. 2021-08-01 23:06:06 +10:00
Mike Causer
02cbe018a5 rp2/boards: Add Adafruit QT Py RP2040. 2021-08-01 23:04:59 +10:00
Mike Causer
043848158d rp2/boards: Add Adafruit ItsyBitsy RP2040. 2021-08-01 23:03:30 +10:00
Mike Causer
e7a3e6ee6a rp2/boards/SPARKFUN_THINGPLUS: Configure I2C/SPI default pins. 2021-08-01 23:02:30 +10:00
Mike Causer
6986a8d680 rp2/boards/SPARKFUN_PROMICRO: Configure UART/I2C/SPI default pins. 2021-08-01 23:01:36 +10:00
Mike Causer
49497084f1 rp2/boards/ADAFRUIT_FEATHER_RP2040: Configure I2C/SPI default pins. 2021-08-01 17:15:18 +10:00
iabdalkader
23e2e00779 rp2/boards/ADAFRUIT_FEATHER_RP2040: Configure custom VID/PID. 2021-08-01 10:51:50 +10:00
iabdalkader
7ae9e6ef69 rp2/tusb_port: Allow boards to configure USB VID and PID.
By defining MICROPY_HW_USB_VID and MICROPY_HW_USB_PID.
2021-08-01 10:51:24 +10:00
David Lechner
afcc77cebc py/builtinimport: Fix condition for including do_execute_raw_code().
Commit e33bc597 ("py: Remove calls to file reader functions when these
are disabled.") changed the condition for one caller of
do_execute_raw_code() from

    MICROPY_PERSISTENT_CODE_LOAD

to

    MICROPY_HAS_FILE_READER && MICROPY_PERSISTENT_CODE_LOAD

The condition that enables compiling the function itself needs to be
changed to match.

Signed-off-by: David Lechner <david@pybricks.com>
2021-07-31 16:51:58 +10:00
robert-hh
4445c73b11 tools/autobuild: Add the MIMXRT1050_EVKB board to the daily builds. 2021-07-31 16:27:47 +10:00
robert-hh
b2533fe479 mimxrt/boards: Add support for the MIMXRT1050_EVKB board. 2021-07-31 16:26:39 +10:00
robert-hh
1074c784b0 mimxrt: Add support for Hyperflash chips.
Hyperflash is used by the MIMXRT1050_EVKB, MIMXRT1060_EVK and
MIMXRT1064_EVK boards.

This commit includes:
- add support for Hyperflash
- modify MIMXRT1060_EVK and MIMXRT1064_EVK to change from QSPI to
  hyperflash.
- minor incidental changes to other boards so they still build

Note: Erasing a sector on the hyperflash is slow. It takes about a second,
which seems too long, but matches the data sheet.
2021-07-31 16:25:40 +10:00
oclyke
e29259d171 extmod/uasyncio: In open_connection use address info in socket creation.
Rudimentary support for various address families.

Signed-off-by: oclyke <oclyke@gmail.com>
2021-07-31 15:33:48 +10:00
Damien George
40b8ff0a6f stm32/README.md: Update supported MCUs, and submodule and mboot use.
Also mention mpremote as a way to access the REPL.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-31 15:12:13 +10:00
Tobias Thyrrestrup
60e3e51753 stm32/Makefile: Update to only pull in used Bluetooth library. 2021-07-31 15:11:46 +10:00
Tobias Thyrrestrup
7a1edb91cb stm32/boards/LEGO_HUB_NO6: Add board definition for LEGO_HUB_NO6.
Add basic support for LEGO HUB NO.6 (e.g. LEGO SPIKE Prime, LEGO MINDSTORMS
Robot Inventor).

See README.md for details.

Thanks to @dpgeorge for helping put this together.

Signed-off-by: Tobias Thyrrestrup <tt@LEGO.com>
2021-07-31 10:25:18 +10:00
Damien George
224ac355cd stm32/boards/NUCLEO_F439ZI: Add board definition for NUCLEO_F439ZI.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-27 16:46:10 +10:00
Matúš Olekšák
0f0006f4e1 stm32/boards/STM32F429DISC: Set correct UART2 pins and add UART3/6. 2021-07-26 14:38:39 +10:00
Damien George
aa0cf873bf stm32/uart: Support low baudrates on LPUART1.
By selecting a larger prescaler when needed.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-26 13:53:50 +10:00
Damien George
fef2114404 stm32/uart: Fix LPUART1 baudrate set/get.
It needs to use a different function because the formula to compute the
baudrate on LPUART1 is different to a normal UART.

Fixes issue #7466.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-26 13:53:50 +10:00
robert-hh
ee49ae8f82 rp2/machine_uart: Fix read when FIFO has chars but ringbuf doesn't.
Prior to this fix, if the UART hardware FIFO had a few chars but still
below the FIFO trigger threshold, and the ringbuf was empty, the read
function would timeout if timeout==0 (the default timeout).

This fix follows the suggestion of @iabdalkader.
2021-07-25 17:48:50 +10:00
iabdalkader
2e62e13455 rp2/machine_uart: Fix poll ioctl to also check hardware FIFO.
The RX IRQ does not trigger if the FIFO is less than the trigger level, in
which case characters may be available in the FIFO, yet not in the ringbuf,
and the ioctl returns false.
2021-07-25 17:11:03 +10:00
Chris Wilson
aecb697c72 stm32/boards: Add support for SparkFun STM32 MicroMod Processor board.
Signed-off-by: Chris Wilson <christopher.david.wilson@gmail.com>
2021-07-23 22:03:16 +10:00
Jim Mussared
341158c251 extmod/nimble: Add "memory stalling" mechanism for l2cap_send.
When l2cap_send detects that the sys mempool is running low (used to store
the outgoing HCI payloads), it will report stalled back to the application,
and then only unstall once these HCI payloads have been sent.

This prevents a situation where a remote receiver with very large MTU can
cause NimBLE to queue up more than MYNEWT_VAL_MSYS_1_BLOCK_COUNT (i.e. 12)
payloads, causing further attempts to send to fail with ENOMEM (even though
the channel is not stalled and we have room in the channel mbufs). The
regular credit/stall flow control is not effective here because the
receiver's MTU is large enough that it will not activate (i.e. there are
lots of credits available).

Thresholds of 1/2 (stall) and 1/4 (unstall) chosen to allow headroom for
other payloads (e.g. notifications) and that when a regular stall occurs it
might keep sending (and creating more payloads) in the background.
2021-07-23 21:58:10 +10:00
Jim Mussared
edfb5d56c8 extmod/nimble: Allow modbluetooth binding to hook "sent HCI packet". 2021-07-23 21:58:04 +10:00
Jim Mussared
53dfb279da extmod/modbluetooth: Clamp MTU values to 32->UINT16_MAX. 2021-07-23 21:57:58 +10:00
Michel Bouwmans
92464f11b0 tools/mpremote: Raise OSError on unsupported RemoteFile.seek.
Signed-off-by: Michel Bouwmans <m.bouwmans@ep-games.eu>
2021-07-23 13:21:53 +10:00
Michel Bouwmans
7870ec0370 tools/mpremote: Add seek whence for mounted files.
Fixes issue #7534.

Signed-off-by: Michel Bouwmans <m.bouwmans@ep-games.eu>
2021-07-23 13:21:42 +10:00
Jim Mussared
4e39ff221a py/runtime: Fix bool unary op for subclasses of native types.
Previously a subclass of a type that didn't implement unary_op, or didn't
handle MP_UNARY_OP_BOOL, would raise TypeError on bool conversion.

Fixes #5677.
2021-07-23 12:40:00 +10:00
Damien George
14b853eae0 minimal/Makefile: Add support for building with user C modules.
Fixes issue #5750.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-23 12:02:03 +10:00
Sashkoiv
753b08cae6 stm32/boards/NUCLEO_F446RE: Enable CAN bus support. 2021-07-23 00:06:13 +10:00
Roberto Colistete Jr
b099db4426 esp8266/Makefile: Add more libm files to build.
Allows MICROPY_PY_MATH_SPECIAL_FUNCTIONS to be enabled, and for ulab to be
built as a user C module.
2021-07-22 23:55:31 +10:00
Seon Rozenblum
25159129dd tools/autobuild: Add FeatherS2 and TinyS2 to esp32 auto builds. 2021-07-22 22:42:37 +10:00
Damien George
0256e1ab8b tools/autobuild: Use separate IDF version to build newer esp32 SoCs.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-22 22:42:37 +10:00
Damien George
7f69246895 docs/library/uasyncio.rst: Document stream readexactly() method.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-22 22:39:04 +10:00
Damien George
a5ac3d5645 samd: Add support for building with user C modules.
Fixes issue #7545.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-22 22:22:03 +10:00
iabdalkader
7649f5fbd2 stm32/sdram: Make SDRAM test cache aware, and optional failure with msg.
* Make SDRAM test cache-aware for newer MCUs.
* Use the defined data bus width (instead of the fixed 8-bits).
* Allow optional failure on error with verbose error messages.
* Test speed is now inverted (test accepts exhaustive instead fast).
2021-07-22 16:47:49 +10:00
Damien George
6214fa3f9e esp32/mphalport: Always yield at least once in delay_ms.
This helps the OS switch to and give other threads processing time during
the sleep.  It also ensures that pending events are handled, even when
sleeping for 0ms.

Fixes issue #5344.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-22 00:20:53 +10:00