Wykres commitów

1442 Commity (7c645b52e315fa3d63bb95bb42ccf2a9c15fe21d)

Autor SHA1 Wiadomość Data
Christian Clauss 2a1db770ce all: Fix cases of Python variable assigned but never used.
This fixes ruff rule F841.
2023-05-02 16:36:05 +10:00
Christian Clauss 79e57473b2 all: Fix various Python coding inconsistencies found by ruff.
This fixes:
- type-comparison (E721): do not compare types, use isinstance().
- string-dot-format-missing-arguments (F524): .format call is missing
  argument(s) for placeholder(s): {message}.
- f-string-missing-placeholders (F541).
- is-literal (F632): Use != to compare constant literals.

The last one is fixed by just comparing for truthfulness of `state`.
2023-05-02 16:14:45 +10:00
Damien George b1229efbd1 all: Fix spelling mistakes based on codespell check.
Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 18:03:06 +10:00
Damien George 996a1f911b stm32/modutime: Use extmod version of time module.
No API or functional change.

Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 15:11:52 +10:00
Damien George 9955553001 extmod/modutime: Provide a generic time module.
Based on extmod/utime_mphal.c, with:
- a globals dict added
- time.localtime wrapper added
- time.time wrapper added
- time.time_ns function added

New configuration options are added for this module:
- MICROPY_PY_UTIME (enabled at basic features level)
- MICROPY_PY_UTIME_GMTIME_LOCALTIME_MKTIME
- MICROPY_PY_UTIME_TIME_TIME_NS

Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 15:09:56 +10:00
Damien George 083dc1f082 ports: Use extmod version of mktime instead of port-specific one.
Apart from slight differences in the error message, the functionality of
all ports is unchanged.

Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 14:55:07 +10:00
Damien George a14e79bcfb stm32/cyw43_configport: Provide cyw43_hal_pin_config_irq_falling func.
Signed-off-by: Damien George <damien@micropython.org>
2023-04-26 12:57:35 +10:00
Jim Mussared 256f47e2f8 extmod/btstack: Fix indicate/notify queuing.
This adds a mechanism to track a pending notify/indicate operation that
is deferred due to the send buffer being full. This uses a tracked alloc
that is passed as the content arg to the callback.

This replaces the previous mechanism that did this via the global pending
op queue, shared with client read/write ops.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-04-26 11:37:20 +10:00
Damien George 9e6885ad82 extmod/btstack: Switch to use hci_dump_init instead of hci_dump_open.
The latter is no longer available in the version of BTstack now in use by
this repository.

Signed-off-by: Damien George <damien@micropython.org>
2023-04-22 00:39:31 +10:00
David Grayson c046b23ea2 shared/runtime/pyexec: Don't allow Ctrl+C to interrupt frozen boot code.
Helps prevent the filesystem from getting formatted by mistake, among other
things.  For example, on a Pico board, entering Ctrl+D and Ctrl+C fast many
times will eventually wipe the filesystem (without warning or notice).

Further rationale: Ctrl+C is used a lot by automation scripts (eg mpremote)
and UI's (eg Mu, Thonny) to get the board into a known state.  If the board
is not responding for a short time then it's not possible to know if it's
just a slow start up (eg in _boot.py), or an infinite loop in the main
application.  The former should not be interrupted, but the latter should.
The only way to distinguish these two cases would be to wait "long enough",
and if there's nothing on the serial after "long enough" then assume it's
running the application and Ctrl+C should break out of it.  But defining
"long enough" is impossible for all the different boards and their possible
behaviour.  The solution in this commit is to make it so that frozen
start-up code cannot be interrupted by Ctrl+C.  That code then effectively
acts like normal C start-up code, which also cannot be interrupted.

Note: on the stm32 port this was never seen as an issue because all
start-up code is in C.  But now other ports start to put more things in
_boot.py and so this problem crops up.

Signed-off-by: David Grayson <davidegrayson@gmail.com>
2023-04-05 10:38:50 +10:00
Jan Hrudka 5652f1f661 stm32/flash: Fix get_bank function for STM32H750.
STM32H750 has only 1 flash bank so function get_bank should always return
FLASH_BANK_1.
2023-04-04 14:58:54 +10:00
Sebastian Romero 0a3600a9ad stm32/boards/ARDUINO_NICLA_VISION: Fix incorrect bootloader PID. 2023-03-31 17:11:14 +11:00
Damien George 31e7a0587d stm32/boards/NUCLEO_G0B1RE: Add config for USB and mboot.
But leave these disabled.

Signed-off-by: Damien George <damien@micropython.org>
2023-03-22 16:38:03 +11:00
Damien George 31638473b7 stm32/mboot: Add support for G0 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-22 16:38:03 +11:00
Damien George c7923b1139 stm32: Add support for USB on G0 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-22 16:38:03 +11:00
Damien George 051e2900d9 stm32/boards/NUCLEO_H723ZG: Add new H723 board.
The following have been tested and are working:
- 550MHz CPU frequency
- UART REPL via ST-Link
- USB REPL and mass storage
- 3x LEDs and 1x user button
- Ethernet

Signed-off-by: Damien George <damien@micropython.org>
2023-03-21 14:05:59 +11:00
Damien George d995c01042 stm32/boards: Add ld and af.csv for H723.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-21 14:02:49 +11:00
Damien George 13fcd8440e stm32: Add support for STM32H723 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-21 14:02:49 +11:00
Damien George 3187e4c7e7 stm32/mphalport: Update HAL version to 1.11.0 to match stm32lib.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-21 14:02:49 +11:00
Damien George 42511b5291 stm32/boards/NUCLEO_H743ZI2: Fix MCU tag in board.json file.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-20 15:24:45 +11:00
iabdalkader a197823eb7 ports: Fix MCU tags in Arduino board.json files. 2023-03-20 15:22:24 +11:00
Christian Clauss 4376c969f6 all: Fix Python comparison to None and True, and use "not in".
These are basic PEP8 recommendations.
2023-03-10 13:32:24 +11:00
Damien George b3c8ab37ec py/gc: Make gc_dump_info/gc_dump_alloc_table take a printer as argument.
So that callers can redirect the output if needed.

Signed-off-by: Damien George <damien@micropython.org>
2023-03-10 10:58:10 +11:00
Damien George b336b6bb74 stm32/pybthread: Make pyb_thread_dump take a printer as its argument.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-09 13:20:59 +11:00
Damien George 067c7cd9dc stm32/pin: Make pin_find debug output use mp_printf.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-09 13:20:59 +11:00
Damien George f43c4dfc68 stm32/extint: Make ExtInt.regs print using mp_printf.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-09 13:20:59 +11:00
Damien George f6a35f76af stm32/modmachine: Make machine.info print using mp_printf.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-09 13:20:59 +11:00
Damien George 6c8b19c7e2 stm32/spi: Return error code and raise exception if SPI init fails.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-09 12:47:45 +11:00
Damien George 98937dcfc2 stm32/i2c: Return error code and raise exception if I2C init fails.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-09 12:47:45 +11:00
Damien George b981e37ccd stm32/main: Use mp_printf instead of printf for MPY start-up messages.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-09 12:47:45 +11:00
Damien George b9dad0add2 stm32: Remove commented-out printf's and debugging code.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-09 12:47:45 +11:00
iabdalkader 8307046406 stm32/boards: Include "senml" in manifest for ARDUINO boards. 2023-03-09 10:37:06 +11:00
Damien George a234aa44f3 stm32/powerctrl: Don't compile WB helpers on WL MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-08 23:57:53 +11:00
Damien George 8b3f1d47a6 stm32/powerctrlboot: Provide custom SystemInit for WB55.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Signed-off-by: Damien George <damien@micropython.org>
2023-03-08 14:04:14 +11:00
Andrew Leech c551723914 stm32/powerctrl: Disable WB55 BLE before entering deepsleep.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-03-08 14:03:36 +11:00
Andrew Leech 2eca86e8fa stm32/powerctrl: Add sleep RCC semaphore management for WB55 MCUs.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-03-08 11:33:00 +11:00
iabdalkader e764bf0138 stm32/cyw43_configport: Add cyw43_sdio_enable_high_speed_4bit function.
Needed by the latest version of cyw43-driver.
2023-03-08 00:59:36 +11:00
iabdalkader 40a49f5a7a stm32/boards/ARDUINO_GIGA: Add support for Arduino Giga H7 board. 2023-03-08 00:55:51 +11:00
iabdalkader b6904cba76 stm32/boards/ARDUINO_NICLA_VISION: Add support for Arduino Nicla Vision. 2023-03-08 00:55:38 +11:00
iabdalkader 449be91e1a stm32/Makefile: Include HAL HSEM driver on H747 MCUs. 2023-03-08 00:55:01 +11:00
iabdalkader d18de7ec81 stm32/boards/ARDUINO_PORTENTA_H7: Update board config files.
Changes are:
- Freeze micropython-lib time module to get strftime.
- Reserve the last 1MB of QSPI flash for (optional) WiFi firmware storage.
- Disable SD card mount on boot.
- Enable high-speed BLE firmware download.
2023-03-08 00:51:33 +11:00
iabdalkader 0f92954eee stm32/cyw43_configport: Allow boards to override default resource files. 2023-03-02 22:44:29 +11:00
iabdalkader e98d7ec804 stm32/boards/PYBD_SF2: Set CYW43 Bluetooth fimrware download baudrate. 2023-03-02 22:30:31 +11:00
iabdalkader 4937174b43 stm32/cyw43_configport: Fix build for boards without an RF switch.
Check if an RF switch is enabled before defining the RF switch pin.
2023-03-01 10:05:04 +11:00
Jim Mussared 7d40317a4a stm32: Add a default implementation of pyb.country.
This is for boards without networking support so that the default boot.py
continues to work.

Also update boot.py to use network.country and network.hostname instead.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-03-01 01:28:12 +11:00
Damien George 593375aa5d stm32/boards: Update linker scripts now that big_const is gone.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-01 01:27:51 +11:00
Jim Mussared bad0098a49 stm32: Update to use the open-source lib version of cyw43-driver.
This removes the previous WiFi driver from drivers/cyw43 (but leaves behind
the BT driver), and makes the stm32 port (i.e. PYBD and Portenta) use the
new "lib/cyw43-driver" open-source driver already in use by the rp2 port.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-03-01 01:27:12 +11:00
Jim Mussared a377302623 extmod/modnetwork: Add network.hostname() and network.country().
This provides a standard interface to setting the global networking config
for all interfaces and interface types.

For ports that already use either a static hostname (mimxrt, rp2) they will
now use the configured value. The default is configured by the port
(or optionally the board).

For interfaces that previously supported .config(hostname), this is still
supported but now implemented using the global network.hostname.

Similarly, pyb.country and rp2.country are now deprecated, but the methods
still exist (and forward to network.hostname).

Because ESP32/ESP8266 do not use extmod/modnetwork.c they are not affected
by this commit.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-03-01 01:26:17 +11:00
Damien George 8d9a7fd228 stm32/Makefile: Clean up nested if-else to chained if-else-if.
Makefile's support "else ifdef", so use it to make the logic clearer.

Also dedent some associated lines for consistency.

Signed-off-by: Damien George <damien@micropython.org>
2023-02-23 10:14:04 +11:00
Jim Mussared 69b93527d5 ports: Make BOARD default from BOARD_DIR in Makefile's.
This allows:

    $ make BOARD_DIR=path/to/board

to infer BOARD=board, rather than the previous behavior that required
additionally setting BOARD explicitly.

Also makes the same change for VARIANT_DIR -> VARIANT on Unix.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
2023-02-23 09:47:08 +11:00