Wykres commitów

2927 Commity (ec24cd1d25a322192be93dc54a02ca4564fc9e7b)

Autor SHA1 Wiadomość Data
IhorNehrutsa 1ea82b6dcc esp32,esp8266: Rename WLAN dhcp_hostname config to hostname.
But retain old name for backwards compatibility.
2022-07-05 23:40:32 +10:00
Jim Mussared 2efaebc899 rp2/boards/ARDUINO_NANO_RP2040_CONNECT: Add urequests module.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-05 23:03:02 +10:00
Jim Mussared 11ef618bbc rp2/CMakeLists: Don't override cyw43-driver unless necessary.
This supresses a warning from pico-sdk when the board isn't using this
driver.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-05 23:00:43 +10:00
Jim Mussared 5f4143dd40 rp2/CMakeLists: Give error if required submodules are missing.
Ensure that nimble and cyw43-driver are initialised when the board requires
it.  Also make these work with `make submodules`.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-05 23:00:36 +10:00
Jim Mussared 651b370484 rp2/Makefile: Regenerate cmake if generated Makefile missing.
`CMakeCache.txt` can exist even if cmake failed. Use `Makefile` instead.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-05 22:47:06 +10:00
Damien George 85be3d3da8 rp2/mpconfigport: Factor core event handling to EVENT_POLL_HOOK_FAST.
Signed-off-by: Damien George <damien@micropython.org>
2022-07-05 16:11:42 +10:00
Damien George 4b9a2abbde rp2/main: Set default AP auth mode to WPA2_AES_PSK.
Signed-off-by: Damien George <damien@micropython.org>
2022-07-05 11:07:16 +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
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 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 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 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
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
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
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
iabdalkader de823e7741 rp2/boards/ARDUINO_NANO_RP2040_CONNECT: Enable Arduino 1200bps touch. 2022-06-23 14:32:56 +10:00
iabdalkader 6c1495b5fe stm32/usbd_cdc_interface: Add support for Arduino 1200bps touch.
If the serial port is closed with baudrate at 1200 then the board will
enter its bootloader.
2022-06-23 14:30:07 +10:00
Damien George 226b2d77ee esp8266/mpconfigport: Disable MICROPY_PY_UTIMEQ.
This is no longer needed with new uasyncio v3, and disabling it saves 900
bytes.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-23 13:07:54 +10:00
Damien George ad7b98c829 esp8266/mpconfigport: Switch to ROM feature level configuration.
This is a no-op in terms of board configuration.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-23 13:07:39 +10:00
David Lechner c118b5d0e4 extmod/extmod.mk: Separate out extmod file list from py.mk to extmod.mk.
This separates extmod source files from `py.mk`.  Previously, `py.mk`
assumed that every consumer of the py/ directory also wanted to include
extmod/.  However, this is not the case.  For example, building mpy-cross
uses py/ but doesn't need extmod/.

This commit moves all extmod-specific items from `py.mk` to `extmod.mk` and
explicitly includes `extmod.mk` in ports that use it.

Signed-off-by: David Lechner <david@pybricks.com>
2022-06-21 00:14:34 +10:00
Damien George f5769698e5 extmod/modlwip: Clean up inclusion of modlwip in build process.
The following changes are made:

- Guard entire file with MICROPY_PY_LWIP, so it can be included in the
  build while still being disabled (for consistency with other extmod
  modules).

- Add modlwip.c to list of all extmod source in py/py.mk and
  extmod/extmod.cmake so all ports can easily use it.

- Move generic modlwip GIT_SUBMODULES build configuration code from
  ports/rp2/CMakeLists.txt to extmod/extmod.cmake, so it can be reused by
  other ports.

- Remove now unnecessary inclusion of modlwip.c in EXTMOD_SRC_C in esp8266
  port, and in SRC_QSTR in mimxrt port.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-20 23:37:38 +10:00
Damien George 1842efbdd9 stm32/Makefile: Set CSUPEROPT to -Os for F0 and G0 MCUs to save space.
Saves 1804 bytes on NUCLEO_F091RC, and 1080 bytes on NUCLEO_G0B1RE.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-20 23:37:38 +10:00
iabdalkader 82b8a2d193 esp8266/modnetwork: Rename WLAN keyword args to ssid/security/key.
The WLAN.config() method now supports "ssid", "security" and "key" as
aliases to the existing "essid", "authmode" and "password", which are now
deprecated.  The help text and setup helper are also updated.

Addresses issue #8083.
2022-06-17 21:43:44 +10:00
iabdalkader a7c7febe0b esp32/network_wlan: Rename WLAN keyword args to ssid/security/key.
The WLAN.config() method now supports "ssid", "security" and "key" as
aliases to the existing "essid", "authmode" and "password", which are now
deprecated.

Addresses issue #8083.
2022-06-17 21:43:44 +10:00
chrismas9 868f23b362 stm32/boards/NUCLEO_F091RC: Enable LFS1 filesystem.
And disable some less common features to make space for it.

Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2022-06-17 21:27:41 +10:00
chrismas9 fdbca3c143 stm32/boards/stm32f091xc.ld: Allocate space for a small filesystem.
Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2022-06-17 21:27:32 +10:00
Maureen Helm bada8b3cad zephyr: Upgrade to Zephyr v3.1.0.
Updates the Zephyr port build instructions and CI to use the latest Zephyr
release tag.

Tested on frdm_k64f.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-06-17 16:51:34 +10:00
Maureen Helm 4fd54a4756 zephyr: Update include paths to use the zephyr namespace.
Zephyr v3.1.0 moved all public headers to include/zephyr.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-06-17 16:44:30 +10:00
Damien George 49c23ac08f renesas-ra/machine_i2c: Remove unnecessary start/stop dummy functions.
The code in extmod/machine_i2c.c will check for NULL slots and raise an
appropriate exception.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-17 14:58:42 +10:00
Damien George d8e7ecd231 stm32/modmachine: Factor out mboot enter code to a function.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-17 13:57:47 +10:00
iabdalkader c5d26ee5e7 renesas-ra/modmachine: Allow boards to provide custom bootloader code.
And expose the machine_bootloader() C function so it can be used elsewhere.
2022-06-17 13:38:55 +10:00
iabdalkader f522aabab2 rp2/modmachine: Allow boards to provide custom bootloader code.
And expose the machine_bootloader() C function so it can be used elsewhere.
2022-06-17 13:38:21 +10:00
iabdalkader d8f5669532 nrf/modmachine: Add machine.bootloader() and make it customisable. 2022-06-17 13:37:44 +10:00
iabdalkader 0adf0dd3d7 stm32/modmachine: Allow boards to provide custom bootloader code.
And expose the machine_bootloader() C function so it can be used elsewhere.
2022-06-17 13:36:55 +10:00
iabdalkader 921dd94676 nrf/main: Add startup and early-init board hook macros.
Following stm32 for naming and location of the hooks.  Also allow a board
to provide custom .c files to implement code for these hooks.
2022-06-17 13:23:45 +10:00
Damien George 5233fb3a3d extmod/machine_i2c: Only use WRITE1 option if transfer supports it.
When MICROPY_PY_MACHINE_I2C_TRANSFER_WRITE1 is enabled the port's hardware
I2C transfer functions should support the MP_MACHINE_I2C_FLAG_WRITE1
option, but software I2C will not.  So add a flag to the I2C protocol
struct so each individual protocol can indicate whether it supports this
option or not.

Fixes issue #8765.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-17 11:57:57 +10:00
Damien George 096954337f stm32/mboot: Only include UI code if at least one board LED is defined.
Otherwise the board must provide dummy definitions of MBOOT_LED1.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-16 14:31:09 +10:00
Damien George d75892c0b0 zephyr/modusocket: Fix function object wrapper for listen method.
This was missed by 919f696ad2

Signed-off-by: Damien George <damien@micropython.org>
2022-06-15 11:38:09 +10:00
Andrew Scheller cedb93c179 docs: Update Raspberry Pi URLs from .org to .com. 2022-06-14 11:41:13 +10:00
iabdalkader 99d3a73d59 nrf/modules/uos/microbitfs: Fix MICROPY_MBFS build to use mp_obj_malloc.
Changes introduced in 0e7bfc88c6 missed
changing this call to mp_obj_malloc.
2022-06-11 21:09:58 +10:00
Damien George f63b4f85aa py/parse: Work around xtensa esp-2020r3 compiler bug.
This commit works around a bug in xtensa-esp32-elf-gcc version esp-2020r3.

The bug is in generation of loop constructs.  The below code is generated
by the xtensa-esp32 compiler.  The first extract is the buggy machine code
and the second extract is the corrected machine code.  The test
`basics/logic_constfolding.py` fails with the first code and succeeds with
the second.

Disassembly of section .text.push_result_rule:

00000000 <push_result_rule>:
  ...
  d6:   209770       or      a9, a7, a7
  d9:   178976       loop    a9, f4 <push_result_rule+0xf4>
                     d9: R_XTENSA_SLOT0_OP   .text.push_result_rule+0xf4
  dc:   030190       rsr.lend        a9
  df:   130090       wsr.lbeg        a9
  e2:   a8c992       addi    a9, a9, -88
  e5:   06d992       addmi   a9, a9, 0x600
  e8:   130190       wsr.lend        a9
  eb:   002000       isync
  ee:   030290       rsr.lcount      a9
  f1:   01c992       addi    a9, a9, 1
  f4:   1494e7       bne     a4, a14, 10c <push_result_rule+0x10c>
                     f4: R_XTENSA_SLOT0_OP   .text.push_result_rule+0x10c

Disassembly of section .text.push_result_rule:

00000000 <push_result_rule>:
  ...
  d6:   209770       or      a9, a7, a7
  d9:   178976       loop    a9, f4 <push_result_rule+0xf4>
                     d9: R_XTENSA_SLOT0_OP   .text.push_result_rule+0xf4
  dc:   030190       rsr.lend        a9
  df:   130090       wsr.lbeg        a9
  e2:   000091       l32r    a9, fffc00e4 <push_result_rule+0xfffc00e4>
                     e2: R_XTENSA_SLOT0_OP   .literal.push_result_rule+0x18
  e5:   0020f0       nop
  e8:   130190       wsr.lend        a9
  eb:   002000       isync
  ee:   030290       rsr.lcount      a9
  f1:   01c992       addi    a9, a9, 1
  f4:   1494e7       bne     a4, a14, 10c <push_result_rule+0x10c>
                     f4: R_XTENSA_SLOT0_OP   .text.push_result_rule+0x10c

Work done in collaboration with @jimmo.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-09 13:56:30 +10:00
Damien George 3452ee58d3 stm32/boards/LEGO_HUB_NO6: Add comment to readme about powering off.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-09 13:24:08 +10:00
Damien George 45a0c6da5b stm32/mboot: Remove MP_WEAK on led funcs and make some of them static.
Both led_init and led_state are configurable via MBOOT_BOARD_LED_INIT and
MBOOT_BOARD_LED_STATE respectively, so don't need to be MP_WEAK.

Furthermore, led_state and led0_state are private to ui.c so can be made
static.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-09 13:24:08 +10:00
Damien George bd5152c928 stm32/mboot: Add board-configurable SysTick hook.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-09 13:24:08 +10:00
Damien George 85597aa68e esp32/machine_pin: Only expose IO20 on esp32 for IDF 4.3.2 and above.
This IO was enabled in IDF commit 68f8b999bb69563f2f3d1d897bc073968f41f3bf,
which is available in IDF release v4.3.2 and above.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-08 18:29:01 +10:00
Damien George bd375df02c extmod/extmod.cmake: Require components to be explicitly enabled.
Otherwise include directories are added unconditionally to the build
variables if the component (submodule) is checked out.  This can lead to,
eg, the esp32 build using lib/lwip header files, instead of lwip header
files from the IDF.

Fixes issue #8727.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-08 13:03:34 +10:00
Damien George ac3fb974bc unix/variants: Enable seeding random module on import in dev, coverage.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 23:41:49 +10:00
Damien George d2f018bff1 unix,windows: Factor out code that generates random bytes to a new func.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 23:41:30 +10:00
stijn 5bb2a85d74 windows: Use BCryptGenRandom to implement os.urandom.
Fix urandom not working on windows (there's no /dev/urandom) by using
a proper cryptographic random function (same one as CPython >= 3.11).
2022-06-07 23:32:30 +10:00
robert-hh 5cc2dd4f5d mimxrt/machine_uart: Fix an inconsistency for UART.init() arg handling.
With keyword arguments only or just a single non-keyword argument,
UART.init() did not perform the settings.
2022-06-07 18:21:46 +10:00
Clayton Mills 767f2ce9a7 stm32/usbd_conf: Remove disable of SYSCFG clock.
System config block contains hardware unrelated to USB.  So calling
`__SYSCFG_CLK_DISABLE()` during `HAL_PCD_MspDeInit()` has an adverse effect
on other system functionality.

Removing call to `__SYSCFG_CLK_DISABLE()` to rectify this issue.

This call was there since the beginning of the USB CDC code, added in
b30c02afa0.
2022-06-07 18:09:58 +10:00
Clayton Mills 0d8d911950 stm32/powerctrl: Disable sys tick interrupt in stop mode on some STM32s.
According to ST Errata ES0206 Rev 18, Section 2.2.1, on STM32F427x,
STM32F437x, STM32F429x and STM32F439x.

If the system tick interrupt is enabled during stop mode while certain
bits are set in the DBGMCU_CR, then the system will immediately wake
from stop mode.

Suggested workaround is to disable system tick timer interrupt when
entering stop mode.

According to ST Errate ES0394 Rev 11, Section 2.2.17, on STM32WB55Cx and
STM32WB35Cx.

If the system tick interrupt is enabled during stop 0, stop 1 or stop 2
while certain bits are set in DBGMCU_CR, then system will immediately
wake from stop mode but the system remains in low power state. The CPU
therefore fetches incorrect data from inactive Flash, which can cause a
hard fault.

Suggested workaround is to disable system tick timer interrupt when
entering stop mode.
2022-06-07 18:08:02 +10:00
Damien George 14105ff5b1 stm32/machine_i2c: Enable timingr constructor keyword on H7 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 17:05:05 +10:00
Damien George a0dae1dda2 stm32/flash: Remove FLASH_OPTR_DBANK condition in L4, H7 get_bank func.
This was added by mistake in 8f68e26f79 when
adding support for G4 MCUs, which does not using this get_bank() function.

FLASH_OPTR_DBANK is only defined on G4 and L4 MCUs, so on H7 this
FLASH_BANK_2 code was being wrongly excluded.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 16:55:18 +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 66dfe17b18 rp2/CMakeLists: Simplify qstr sources when enabling extmod components.
Also remove redundant modusocket.c and modnetwork.c sources, they are
already added by extmod/extmod.cmake.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 16:55:18 +10:00
Damien George a446a7bdef rp2/mpnetworkport: Fix lwip alarm callback timing to use microseconds.
The callback passed to add_alarm_in_ms must return microseconds, even
though the initial delay is in milliseconds.  Fix this use, and to avoid
further confusion use the add_alarm_in_us function instead.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 16:55:18 +10:00
Damien George c58dc7f091 pic16bit: Use 1 byte for qstr hash len and include header to fix build.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 16:55:18 +10:00
iabdalkader 2111ca0b8f rp2/boards/ARDUINO_NANO_RP2040_CONNECT: Update USB PID.
This PID is allocated for the Arduino Nano RP2040 running MicroPython.
2022-06-03 16:12:44 +10:00
Andrew Leech ffe5f2efe2 rp2/Makefile: Build in debug mode with "make DEBUG=1".
Signed-off-by: Andrew Leech <andrew@alelec.net>
2022-06-03 14:34:29 +10:00
Andrew Leech 1b80aa9ce3 rp2/boards/W5100S_EVB_PICO: Add Wiznet W5100S-EVB-Pico board.
Signed-off-by: Andrew Leech <andrew@alelec.net>
2022-06-03 14:34:29 +10:00
Andrew Leech bca816f5ac rp2: Add support for using Wiznet hardware as an Ethernet NIC.
Uses the extmod/network_wiznet5k driver to provide network connectivity.

Signed-off-by: Andrew Leech <andrew@alelec.net>
2022-06-03 14:34:29 +10:00
Andrew Leech 15fea3a1ff rp2: Integrate lwIP network stack.
Signed-off-by: Andrew Leech <andrew@alelec.net>
2022-06-03 14:34:18 +10:00
Andrew Leech 7d9cc69645 rp2/Makefile: Use cmake for "make submodules" task when needed.
Because the submodule list can be updated by cmake files.

Signed-off-by: Andrew Leech <andrew@alelec.net>
2022-06-03 14:29:11 +10:00
Andrew Leech 05f927b624 rp2/machine_pin: Add mp_hal_pin_interrupt C interface.
So C can can easily configure a pin interrupt and callback.

Signed-off-by: Andrew Leech <andrew@alelec.net>
2022-06-03 14:29:11 +10:00
Andrew Leech 9bd6169b72 rp2/mbedtls: Add support for ssl module with MICROPY_SSL_MBEDTLS.
Signed-off-by: Andrew Leech <andrew@alelec.net>
2022-06-03 14:29:06 +10:00
Andrew Leech 494e8ba722 nrf/mpconfigport: Fix MICROPY_VFS IO build support. 2022-06-03 12:39:43 +10:00
Andrew Leech c5878dd1f9 nrf/mpconfigport: Enable extra features as defined by ROM levels.
This commit enables extra features from the ROM levels and further
simplifies mpconfigport.h.  The changes are:

- NRF51822 & BLUETOOTH_SD -> MICROPY_CONFIG_ROM_LEVEL_MINIMUM
    - no changes

- NRF51822 -> MICROPY_CONFIG_ROM_LEVEL_CORE_FEATURES
    - MICROPY_PY_IO = 1

- NRF52832 -> MICROPY_CONFIG_ROM_LEVEL_BASIC_FEATURES
    - MICROPY_PY_IO = 1

- NRF52840, NRF9160 -> MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES
    - MICROPY_COMP_MODULE_CONST = 1
    - MICROPY_COMP_TRIPLE_TUPLE_ASSIGN = 1
    - MICROPY_OPT_MPZ_BITWISE = 1
    - MICROPY_PY_ALL_SPECIAL_METHODS = 1
    - MICROPY_PY_BUILTINS_EXECFILE = 1
    - MICROPY_PY_BUILTINS_SLICE_ATTRS = 1
    - MICROPY_PY_BUILTINS_STR_CENTER = 1
    - MICROPY_PY_BUILTINS_STR_PARTITION = 1
    - MICROPY_PY_BUILTINS_STR_SPLITLINES = 1
    - MICROPY_PY_CMATH = 1
    - MICROPY_PY_COLLECTIONS_ORDEREDDICT = 1
    - MICROPY_PY_FRAMEBUF = 1
    - MICROPY_PY_IO = 1
    - MICROPY_PY_MATH_SPECIAL_FUNCTIONS = 1
    - MICROPY_PY_SYS_STDIO_BUFFER = 1
    - MICROPY_PY_UCTYPES = 1
    - MICROPY_PY_UHEAPQ = 1
    - MICROPY_PY_UJSON = 1
    - MICROPY_PY_URE = 1
    - MICROPY_PY_UZLIB = 1
    - MICROPY_REPL_EMACS_KEYS = 1
2022-06-03 12:37:12 +10:00
Andrew Leech 13f5d38f2e nrf/mpconfigport: Set MICROPY_CONFIG_ROM_LEVEL defines for each MCU.
This commit is a no-op change to simplify existing config.
2022-06-03 12:36:40 +10:00
Andrew Leech 8fb01be6cf stm32/rfcore: Remove extra layer of buffering on BLE IPCC.
Whole packets are now pushed up to the higher layer of the BLE stack,
instead of buffering the packets so individual bytes can be requested.
2022-06-03 11:58:43 +10:00
Takeo Takahashi dd83f48fb2 renesas-ra/machine_pin: Remove code for unsupported Pin features.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-06-03 10:57:48 +10:00
robert-hh a0432ed9cb mimxrt: Update port to work with new nxp_driver v2.10.
The nxp_driver v2.10 allows for/requires some changes to the code:

- Remove some part of pwm_backlog.*, which is provided by the lib now.
- Change eth.c: the newer versions have additional parameters of the
  library versions.
- Change sdcard.c: use TransferBlocking instead of TransferNonblocking.
- Add some support for the MIMXRT1176 device.
- Set the clocks for UART, I2C, Timer.
- Integrate the I2S module and fix a rebase error.
- Use blocking transfer only for SPI.  It's faster and interferes less with
  other modules.
- Use the clock_config.c files of library v2.8.5.  The mimxrt files keeps
  the clock_config.c files from Verson 2.8.5.  With clock_config.c from
  v2.10, the boards do not work.  Refactoring of the clock set-up is on the
  to-do list.
- Enable expiry timers for UART, I2C and SPI, avoiding a stall in library
  code.
- The clock_config.* files are moved from the board-specific directories to
  the boards directory and given a MCU related name.
2022-06-03 10:48:49 +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
Damien George 47f634300c py: Change makemoduledefs process so it uses output of qstr extraction.
This cleans up the parsing of MP_REGISTER_MODULE() and generation of
genhdr/moduledefs.h so that it uses the same process as compressed error
string messages, using the output of qstr extraction.

This makes sure all MP_REGISTER_MODULE()'s that are part of the build are
correctly picked up.  Previously the extraction would miss some (eg if you
had a mod.c file in the board directory for an stm32 board).

Build speed is more or less unchanged.

Thanks to @stinos for the ports/windows/msvc/genhdr.targets changes.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 16:29:53 +10:00
Damien George 340872cfdd stm32/boards/LEGO_HUB_NO6: Add helper scripts to update app firmware.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 15:22:16 +10:00
Damien George 87ca431f3f stm32/boards/LEGO_HUB_NO6: Implement robust filesystem-load updates.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George d84ebc31f7 stm32/boards/LEGO_HUB_NO6: Use multi-colour LED for mboot status.
This gives more information to the user when doing updates from SPI flash.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George fae9205594 stm32/boards/LEGO_HUB_NO6: Add support for mboot to access SPI flash.
The following changes are made:
- Use software SPI for external SPI flash access when building mboot.
- Enable the mboot filesystem-loading feature, with FAT FS support.
- Increase the frequency of the CPU when in mboot to 96MHz, to increase the
  speed of SPI flash accesses and programming.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George 36211baf0e stm32/boards/LEGO_HUB_NO6: Make all SPI flash transfers use 32-bit addr.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George 87fbceef26 stm32/mboot: Pass initial_r0 to early-init and get-reset-mode funcs.
This allows a board to modify initial_r0 if needed.

Also make default board behaviour functions always available, named as
mboot_get_reset_mode_default and mboot_state_change_default.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George e64947dc90 stm32/mboot: Make 0x70ad0000 values named constants with macros.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George 9246099935 stm32/mboot: Add update_app_elements to return mboot fsload elements.
In case the elements should not be passed directly to machine.bootloader.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George 1296a01f4c stm32/mboot: Move remaining led_state_all call into mboot_state_change.
This was missed in b2deea6762

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Damien George 54f1694ab6 drivers/bus: Rename MP_SPI_ADDR_IS_32B to MICROPY_HW_SPI_ADDR_IS_32BIT.
And allow it to be configured externally, if needed.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 14:30:51 +10:00
Jared Hancock 2f4aca0381 mimxrt/mphalport: Fix strict aliasing error with unique id. 2022-06-02 12:50:14 +10:00
Damien George 6bda80d811 esp32/machine_i2c: Implement write-then-read I2C transfers.
I2C transfers are much more efficient if they are combined, instead of
doing separate writes and reads.

Fixes issue #7134.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-01 13:20:30 +10:00
robert-hh 1df7678674 mimxrt/boards: Extend the deploy_teensy.md instructions. 2022-05-27 13:23:46 +10:00
robert-hh c7accf7666 mimxrt/boards/OLIMEX_RT1010: Document the initial deploy procedure.
The procedure given here will work whether or not the DevKit motherboard is
used and is equipped with the support MCU.  It is laborious but works.
2022-05-27 13:23:46 +10:00
Damien George cca08922d9 py/emitinlinethumb: Make ARMv7-M instruction use dynamically selectable.
This follows on from a5324a1074 and allows
mpy-cross to dynamically select whether ARMv7-M instructions are supported
in @micropython.asm_thumb functions.

The config option MICROPY_EMIT_INLINE_THUMB_ARMV7M is no longer needed, it
is now controlled by MICROPY_EMIT_THUMB_ARMV7M.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-26 11:54:48 +10:00
iabdalkader 4946dc5f8c teensy/mpconfigport.h: Remove obsolete macros. 2022-05-26 11:17:46 +10:00
iabdalkader 0bdfceacbe extmod/network_ninaw10: Add support for socket events callback. 2022-05-26 11:15:07 +10:00
iabdalkader 875caca504 rp2/boards/ARDUINO_NANO_RP2040_CONNECT: Enable webrepl. 2022-05-25 16:05:50 +02:00
iabdalkader a22d0bda52 rp2/boards/ARDUINO_NANO_RP2040_CONNECT: Disable internal errno.
* Internal errno can't be used with Nina module due to an issue
with esp-idf config.
2022-05-25 16:05:50 +02:00
iabdalkader 4bcffbd1c6 rp2/mpconfigport.h: Allow boards to override internal errno config. 2022-05-25 16:05:50 +02:00
iabdalkader d037e75991 rp2/mpconfigport.h: Enable static scheduler nodes. 2022-05-25 16:05:50 +02:00
Damien George 6e71cde6aa ports: Use default VFS config for import_stat and builtin_open.
For ports with MICROPY_VFS and MICROPY_PY_IO enabled their configuration
can now be simplified to use the defaults for mp_import_stat and
mp_builtin_open.

This commit makes no functional change, except for the following minor
points:
- the built-in "open" is removed from the minimal port (it previously did
  nothing)
- the duplicate built-in "input" is removed from the esp32 port
- qemu-arm now delegates to VFS import/open

Signed-off-by: Damien George <damien@micropython.org>
2022-05-25 13:04:45 +10:00
Damien George 5956466c0e py/builtin: Clean up and simplify import_stat and builtin_open config.
The following changes are made:

- If MICROPY_VFS is enabled then mp_vfs_import_stat and mp_vfs_open are
  automatically used for mp_import_stat and mp_builtin_open respectively.

- If MICROPY_PY_IO is enabled then "open" is automatically included in the
  set of builtins, and points to mp_builtin_open_obj.

This helps to clean up and simplify the most common port configuration.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-25 13:04:45 +10:00
Damien George 26b1d31eda Revert "stm32/rfcore: Intercept addr-resolution HCI cmd to work arou..."
This reverts commit 2668337f36.

The issue with potential breaking of the BLE RX path in the radio is fixed
since WS v1.12.0.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-25 11:02:35 +10:00
Takeo Takahashi 79f3b8731b renesas-ra/modmachine: Add missing MP_REGISTER_MODULE for umachine.
Fix the issue that umachine is not available.

Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-05-25 00:05:30 +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
David Lechner be5657b64f ports: Rename thread_t to mp_thread_t.
This adds the `mp_` prefix to the `thread_t` type.  The name `thread_t`
conflicts with the same in `mach/mach_types.h` on macOS.

Signed-off-by: David Lechner <david@lechnology.com>
2022-05-24 00:51:23 +10:00
Damien George c70f96f1c5 esp32: Track allocated iRAM and free it on soft reset.
This makes sure all iRAM allocated for native code is freed on soft reset.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-19 17:31:56 +10:00
Daniël van de Giessen ef16796f49 esp32/machine_pin: Fix ESP32C3 IDFv4.4.1 build.
Use new constants as seen in ESP-IDF commit b25fb1.

Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2022-05-19 16:47:13 +10:00
Algy Tynan 5dac142a1a esp32/boards/LILYGO_TTGO_LORA32: Remove ID from TTGO Lora32 board json.
Generic ID creates an incorrect link on the MicroPython download page.
Remove the ID to fix the link.

Signed-off-by: Algy Tynan <algy@tynan.io>
2022-05-19 16:45:18 +10:00
Michael Himing a1abf51a9d esp32/boards/UM_FEATHERS3: Use correct sdkconfig.board. 2022-05-19 16:43:59 +10:00
Christian Zietz e92c22a839 esp8266/etshal.h: Remove unneeded function declaration. 2022-05-19 16:40:39 +10:00
Christian Zietz ea1c0557e5 esp8266/machine_wdt: Remove deinit method for watchdog.
Reasons for removal:
- It did not work properly because it stopped the hardware watchdog
  timer while keeping the software watchdog running (issue #8597).
- There isn't a deinit method for the WDT in any other port.
- "The watchdog is not intended to be stopped. That is a feature."
  (See #8600.)
2022-05-19 16:40:39 +10:00
Jim Mussared c2d889fc1e renesas-ra: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared 1d33ceb0d0 cc3200: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared 9e4da2320a javascript: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared ec2fe5d6ca zephyr: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared 63431a5536 unix: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared d0307e79bb teensy: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared c3f7424a57 samd: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared 62f00a43d5 rp2: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared 60c5968f99 pic16bit: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared f67ac90fa9 nrf: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
Jim Mussared 7d79fd7e8b mimxrt: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:56:30 +10:00
Jim Mussared 4274b34d6b esp8266: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:56:30 +10:00
Jim Mussared 24127a4ac4 esp32: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:56:30 +10:00
Jim Mussared 0a92469c10 stm32: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:56:30 +10:00
Jim Mussared bb794f05b7 extmod: Make port-included extmod modules use MP_REGISTER_MODULES.
_onewire, socket, and network were previously added by the port rather
than objmodule.c.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:49:12 +10:00
Jim Mussared 4eab44a1ec extmod: Make extmod modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:49:12 +10:00
Damien George 5b700b0af9 all: Reformat remaining C code that doesn't have a space after a comma.
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05 13:30:40 +10:00
Damien George b0a1b60a9b extmod: Move font_petme128_8x8.h from ports/stm32 to extmod.
And add spaces after commas so it is consistently formatted.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-05 13:30:40 +10:00
Damien George da31ad7aad mimxrt/mbedtls: Use core-provided tracked alloc instead of custom funcs.
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05 10:31:50 +10:00
Damien George 39c96b543f stm32/mbedtls: Use core-provided tracked alloc instead of custom funcs.
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05 10:31:50 +10:00
Damien George fca5701f74 py/malloc: Introduce m_tracked_calloc, m_tracked_free functions.
Enabled by MICROPY_TRACKED_ALLOC.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-05 10:31:50 +10:00