Commit Graph

2454 Commits

Author SHA1 Message Date
Damien George
5e506567a3 stm32/mbedtls: Enable MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE.
This adds MBEDTLS_MD_SHA1 to the list of default hashes for TLS 1.2
handshake signatures.  Although SHA-1 is weak, this option is turned on in
the default mbedtls configuration file, and allows better compatibility
with older servers.  In particular it allows an stm32-mbedtls-based client
to connect to an axtls-based client (eg default unix port and esp8266).

Signed-off-by: Damien George <damien@micropython.org>
2022-01-17 17:35:04 +11:00
stijn
cf258c898e windows/msvc: Run qstr preprocessing phase in parallel.
Supported from VS2017 and up, this roughly halves build time.
2022-01-14 17:05:55 +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
e754c2e84f esp32/esp32_rmt: Install RMT driver on core 1.
MicroPython currently runs on core 0 of the esp32.  Calling
rmt_driver_install will mean that the RMT interrupt handler is also
serviced on core 0.  This can lead to glitches in the RMT output if
WiFi is enabled (for esp32.RMT and machine.bitstream).

This patch calls rmt_driver_install on core 1, ensuring that the RMT
interrupt handler is serviced on core 1.  This prevents glitches.

Fixes issue #8161.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-14 15:41:59 +11:00
Damien George
a49b51b7db zephyr/modbluetooth_zephyr: Provide dummy connect_cancel function.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-13 13:45:55 +11:00
stijn
b47b245c2e windows/appveyor: Build mpy-cross only once for mingw-w64.
The main Makefile builds the mpy-cross executable automatically if
it doesn't exist since 78718fffb1,
so build it first to make sure it doesn't get needlessly rebuilt.
2022-01-10 15:01:03 +01:00
Damien George
ff0227fa0d esp32/boards/GENERIC_D2WD: Build with -Os optimisation.
This board has only 2MiB of flash so the build needs to be reduced in size
to fit.  Commit 549448e8bb made all boards
build with -O2 by default (for performance) so this overrides that default.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-09 11:25:37 +11:00
Damien George
1892d03740 mimxrt,stm32: Enable MICROPY_PY_USSL_FINALISER.
This is needed because these ports allocate mbedtls data on the MicroPython
heap, and SSL socket objects must be fully cleaned up when they are garbage
collected, to free this memory allocated by mbedtls.  As part of this,
gc_sweep_all() will now ensure that the MP_STATE_PORT(mbedtls_memory)
linked-list is fully deallocated on soft reset.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-08 00:02:04 +11:00
Damien George
df3f59ca4b ports: Update board.json files to link to new board images.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-07 11:33:28 +11:00
Damien George
b96318ab61 esp32: Enable platform module with IDF version.
Output looks like this:

    >>> import platform
    >>> platform.libc_ver()
    ('newlib', '3.0.0')
    >>> platform.platform()
    'MicroPython-1.17.0-xtensa-IDFv4.2.2-with-newlib3.0.0'
    >>> platform.python_compiler()
    'GCC 8.4.0'

Signed-off-by: Damien George <damien@micropython.org>
2022-01-06 18:25:48 +11:00
Damien George
000b001fc1 rp2/boards/GARATRONIC_PYBSTICK26_RP2040: Use correct pico-sdk board cfg.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-06 16:50:20 +11:00
Damien George
4693cf9081 rp2/CMakeLists.txt: Allow a board to override PICO_BOARD.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-06 16:49:57 +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
Maureen Helm
0cf03bd3b1 zephyr: Use CONFIG_USB_DEVICE_STACK for conditional USB device support.
CONFIG_USB was removed in Zephyr v2.7.0 after some Kconfig rework that
made it sufficient to use CONFIG_USB_DEVICE_STACK only.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-01-06 14:09:39 +11:00
Maureen Helm
1e5df0982a zephyr: Get UART console device from devicetree instead of Kconfig.
Updates the Zephyr port to get the UART console device from devicetree
instead of Kconfig. The Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME
was removed in Zephyr v2.7.0.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-01-06 14:09:39 +11:00
Maureen Helm
080a9e906d zephyr: Update include path to reboot.h.
The reboot header was moved to a different path in Zephyr v2.6.0. The
old path was deprecated for two releases (v2.6.0 and v2.7.0) and will no
longer be supported after Zephyr v2.7.0.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-01-06 14:09:39 +11:00
Maureen Helm
ddbbfbed75 zephyr: Increase minimum CMake version to 3.20.0.
As a prerequisite to upgrading to Zephyr v2.7.0, upgrade the minimum
CMake version required for the Zephyr port to 3.20.0.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-01-06 14:09:39 +11:00
iabdalkader
908e4cf5c3 rp2: Add support for DHT11 and DHT22 sensors. 2022-01-06 14:00:03 +11:00
robert-hh
01d9b7adde rp2/machine_pwm: Keep duty value when changing the frequency.
The duty is saved and set whenever the frequency is changed, unless the
duty rate was not set yet.
2022-01-06 13:52:45 +11:00
robert-hh
9e56e630ca rp2/machine_pwm: Fix PWM frequency setting.
The top value was off by 1: in order to count n ticks it has to be set to
n-1.

Fixes issue #8122.
2022-01-06 13:51:19 +11:00
iabdalkader
f4487a0049 rp2/boards/ARDUINO_NANO_RP2040_CONNECT: Set default I2C pins. 2022-01-06 13:35:20 +11:00
Simon Baatz
79ae7098ca esp32/machine_bitstream: Fix signal duplication on output pins.
After changing the bitstream implementation to use the RMT driver in
commit 72d86158121e32bbabaeade08f449d507bf40f9a
("esp32/machine_bitstream.c: Replace with RMT-based driver."), using
multiple `Neopixel` instances shows signal duplication between the
instances (i.e. a `write()` on one instance is written to all instances).

On invocation, the rmt driver configures the GPIO matrix to route the
output signal to the respective GPIO pin.  When called for a different
`NeoPixel` instance using a different pin, the new route is established,
but the old route still exists.  Now, the RMT output signal is sent to both
pins.

Fix this by setting the standard GPIO output function for the current pin
after uninstalling the RMT driver.

Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
2022-01-06 13:21:37 +11:00
MikeTeachman
49d8ae3ecc esp32/machine_i2s: Add support for ESP-IDF 4.4.
- Add default values for I2S features added in ESP-IDF 4.4.
- Add workaround for bug introduced in ESP-IDF 4.4
  (https://github.com/espressif/esp-idf/issues/8121).
2022-01-06 13:10:38 +11:00
Chris Boudacoff
802ef271b8 mimxrt/hal: Allow readSampleClkSrc to be configured by a board.
Via the MICROPY_HW_FLASH_DQS flag.
2022-01-04 15:42:12 +11:00
stijn
3f16719888 windows/appveyor: Build both standard and dev variants.
This makes sure changes from previous related commits actually work.
2022-01-04 15:07:45 +11:00
stijn
7955734aca windows: Run tests via Makefile.
The application isn't necessarily called 'micropython' especially
not When using variants, i.e. the tests need to be ran using $(PROG).
2022-01-04 15:07:45 +11:00
Andrew Leech
05ed19e73e windows: Add support for build variants to windows port.
Following the unix port.

Support for building variants with msvc was done by @stinos.
2022-01-04 15:06:26 +11:00
Damien George
a29c70c9b4 esp8266: Allow building a board to any dest directory.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-30 15:47:49 +11:00
iabdalkader
8af9dbbde1 stm32/network_wiznet5k: Fix build error with wiznet5k and lwip enabled.
Commit 4dba04a50f refactored the network code
but the combination of MICROPY_PY_WIZNET5K=5500 and MICROPY_PY_LWIP=1
broke.
2021-12-30 11:54:19 +11:00
Damien George
aac5a97d08 ports: Move '.frozen' to second entry in sys.path.
In commit 86ce442607 the '.frozen' entry was
added at the start of sys.path, to allow control over when frozen modules
are searched during import, and retain existing behaviour whereby frozen
was searched before the filesystem.

But Python semantics of sys.path require sys.path[0] to be the directory of
the currently executing script, or ''.

This commit moves the '.frozen' entry to second place in sys.path, so
sys.path[0] retains its correct value (described above).

Signed-off-by: Damien George <damien@micropython.org>
2021-12-29 23:55:36 +11:00
Jim Mussared
599b61c086 esp32/machine_bitstream: Replace bit-bang code with RMT-based driver.
This aims to solve glitching issues on long neopixel strips.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-22 12:04:13 +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
IhorNehrutsa
4189c64869 esp32/modnetwork: Synchronize WiFi AUTH_xxx constants with IDF values. 2021-12-21 23:56:23 +11:00
Damien George
05bea70979 esp8266/etshal.h: Remove unneeded function declarations.
These removed ones are either unused by MicroPython or provided by osapi.h
in the SDK.  In particular ets_delay_us() has different signatures for
different versions of the SDK, so best to let it provide the declaration.

Fixes issue #8095.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-21 14:37:16 +11:00
Matt Trentini
f2b5c99fde stm32/boards/OLIMEX_H407: Fix typo in OLIMEX H407 board.json.
Appears incorrectly as E407 in the download manager.
2021-12-20 12:32:46 +11:00
iabdalkader
bedd9c5463 stm32/boards/make-pins.py: Generate empty ADC table if needed.
If ADCx pins are hidden, print an empty table to prevent linker errors.
2021-12-20 09:41:46 +11:00
iabdalkader
1dc532019b stm32/qspi: Fix typo in address comment. 2021-12-19 17:48:00 +11:00
iabdalkader
f9e5b0d93d stm32/factoryreset: Init vfs flags before calling pyb_flash_init_vfs.
The vfs flags could have any random value from stack.  This bug was
introduced back in 7723dac337
2021-12-19 17:42:15 +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
86ce442607 ports: Add '.frozen' as the first entry in sys.path.
Frozen modules will be searched preferentially, but gives the user the
ability to override this behavior.

This matches the previous behavior where "" was implicitly the frozen
search path, but the frozen list was checked before the filesystem.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-18 00:08:07 +11:00
Jim Mussared
92353c2911 all: Remove support for FROZEN_DIR and FROZEN_MPY_DIR.
These have been deprecated for over two years in favour of FROZEN_MANIFEST
and manifest.py.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-17 23:54:05 +11:00
Jim Mussared
f241db7efe teensy: Switch to use manifest.py instead of FROZEN_DIR.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-17 23:54:05 +11:00
Jim Mussared
cc23e99f32 py/modio: Remove io.resource_stream function.
This feature is not enabled on any port, it's not in CPython's io module,
and functionality is better suited to the micropython-lib implementation of
pkg_resources.
2021-12-17 23:53:44 +11:00
Tomas Vanek
9aa151e3f3 esp32/boards: Remove SPI pin defaults from GENERIC S2/S3 boards.
Default SPI pins are now correctly assigned by machine_hw_spi.c even for S2
and S3.  mpconfigboard.h files define defaults with flipped SPI(1) and
SPI(2) to workaround a bug in machine_hw_spi.c - the bug is fixed.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
2021-12-15 15:53:17 +11:00
Tomas Vanek
e761152d72 esp32/machine_hw_spi: Set proper default SPI(id=2) pins on S2 and S3.
Use IO_MUX pins as defined by ESP IDF in soc/esp32/include/soc/spi_pins.h

ESP32S2 and S3 don't have IO_MUX pins for SPI3, GPIO matrix is always used.
Choose suitable defaults for S2 and S3.

ESP32C3 does not have SPI3 at all.  Don't define pin mappings for it.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
2021-12-15 15:53:17 +11:00
Tomas Vanek
d08886558b esp32/machine_hw_spi: Set proper default SPI(id=1) pins on S2,S3 and C3.
Use IO_MUX pins as defined by ESP IDF in soc/esp32*/include/soc/spi_pins.h
Alternatively use now deprecated HSPI_IOMUX_PIN_NUM_xxx
(or FSPI_IOMUX_PIN_NUM_xxx for ESP32S2) for compatibility with IDF 4.2
and older.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
2021-12-15 15:50:27 +11:00
Tomas Vanek
3305ec44a2 esp32/machine_hw_spi: Fix SPI default pins reordering on ESP32-S2/S3.
The index of machine_hw_spi_obj and machine_hw_spi_default_pins arrays is
assigned to 0 for ARG_id==HSPI_HOST and 1 for another SPI.  On ESP32S2 and
S3 HSPI_HOST=2 so the first set (idx=0) of default pins is used for
SPI(id=2) aka HSPI/SPI3 and the second set (idx=1) for SPI(id=1) aka
FSPI/SPI2.  This makes a misleading mess in MICROPY_HW_SPIxxxx definitions
and it is also in contradiction to the comments around the definitions.

Change the test of ARG_id to fix the order of machine_hw_spi_default_pins.

This change might require adjusting MICROPY_HW_SPIxxxx definitions in
mpconfigboard.h of S2/S3 based boards.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
2021-12-15 15:49:23 +11:00
Tomas Vanek
f9733705a9 esp32/machine_pin: Make GPIO 26 usable for S2,S3 if SPIRAM not config'd.
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
2021-12-15 15:48:46 +11:00
robert-hh
5ca56aaf16 mimxrt: Tidy up the board flash related files.
- Move the qspi_xxxx_flash_config.c files to hal.
  It turned out that they are less board than flash type specific.
- Change to a common flexspi_flash_config.h header file.
2021-12-14 20:31:20 +01:00
robert-hh
c5dbbf71c0 mimxrt: Use -Og instead of -O0 for DEBUG builds.
Thanks for the hint, Damien. The DEBUG build got very large recently.
The major difference is, that inline function are now inlined and
not included as a function. That's good and maybe bad. The good thing is,
that the code speed si now close to the final code. It could be worse
in single step debugging. I'll see.

Setting this option caused a new warning and a formatting error
to pop up at different places. Fixed as well.
2021-12-14 08:07:52 +01:00