Wykres commitów

188 Commity (47c84286e8c8d9873e99f12711a683ecd6b9ca62)

Autor SHA1 Wiadomość Data
Damien George f72d3cec23 rp2/machine_spi: Add mp_hal_get_spi_obj helper function.
And remove the now-obsolete spi_from_mp_obj() function.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-10 14:05:02 +10:00
Ian Davies fbe9417b90 extmod/ntptime: Factor out ntptime module from esp8266 port.
The ntptime module was previously only included in the ESP8266 port.  This
commit factors that module out into the extmod directory, makes it support
different epochs, and includes it in the rp2 port.
2022-08-06 00:08:32 +10:00
Ian Davies b560b9fe71 rp2/mbedtls: Enable certificate validity time validation. 2022-08-06 00:08:01 +10:00
Jim Mussared 9a7ac41be6 rp2/Makefile: Always use cmake to discover submodules.
Used to be special-cased for Pico, but now everything depends on
micropython-lib if it's using a frozen manifest.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-03 00:05:54 +10:00
Peter Harper 45ab801c30 rp2/cyw43_configport: Add event hook into cyw43_delay_ms.
Still see some USB issues apparently caused by delays loading wifi
firmware.  cyw43_delay_ms is used to wait in the driver, so we should call
the event hook in there.

Fixes #8963.
2022-07-27 13:42:21 +10:00
Jim Mussared 092784da19 ports: Remove unused mp_type_{fileio/textio} macros in mpconfigport.h.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-26 18:07:22 +10:00
robert-hh 0c45a28d24 rp2/rp2_pio: Fix StateMachine.restart when PIO program is shared.
The state machines were not properly restarted in the case that the same
PIO program was shared among multiple StateMachine instances.  This is
because only the first StateMachine to use the program would set the
rp2_state_machine_initial_pc variable.

See https://forum.micropython.org/viewtopic.php?f=21&t=12776&p=69464#p69464
2022-07-26 02:00:01 +10:00
Damien George f64862a766 rp2/cyw43_configport: Set CYW43_WIFI_NVRAM_INCLUDE_FILE value.
Required for latest cyw43-driver.

Signed-off-by: Damien George <damien@micropython.org>
2022-07-26 01:39:30 +10:00
Peter Harper 33d6994d4c rp2/cyw43_configport: Set CYW43_EVENT_POLL_HOOK value.
This should allow USB to work while we're loading WiFi firmware.

Fixes issue #8904.
2022-07-26 01:39:08 +10:00
Jim Mussared a053827084 extmod/network_ninaw10: Move ninaw10 root pointer registrations here.
Originally in drivers/ninaw10/nina_wifi_bsp.c but that isn't a QSTR source.

Also remove outdated commment about root pointers in mpconfigport.h.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-21 16:21:50 +10:00
Jim Mussared 8b4298a4bf rp2/mpbthciport: Remove mp_bthci_uart from set of root pointers.
This is a statically-allocated UART (see machine_uart.c), and doesn't
contain any heap pointers other than the ringbufs (which are already root
pointers), so no need to track it additionally.

Saves needing to add mpbthciport.c to the QSTR sources.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-21 16:19:42 +10:00
robert-hh 80339f1a33 ports: Adapt mimxrt, nrf and rp2 ports to work with latest TinyUSB.
rp2: change tud_task() to tud_task_ext().

mimxrt: use lib/tinyusb/src/portable/chipidea/ci_hs/dcd_ci_hs.c instead of
lib/tinyusb/src/portable/nxp/transdimension/dcd_transdimension.c.

nrf: add a definition for the changed tud_task().  tud_task() is changed
to tud_task_ext(), and the #define for backward compatibility is in
src/device/usbd.h.

The items I know which are fixed with this version:
- Fix for the SAMD USB lock-up.
- Support the MIMXRT11XX series of MCUs.
- Fix a wrong pin definition for MIMXRT1050_EVKB.

Tested with the MIMXRT boards, rp2 Pico, SAMD boards, nrf board.
2022-07-19 11:27:21 +10:00
Damien George b89422ceaa extmod: Always use custom mbedtls error message code.
All ports that use mbedtls use the custom error messages in
mp_mbedtls_errors.c.  This commit simplifies the build so that ports don't
need to explicitly add this file, it's now used by default when mbedtls is
enabled.

Signed-off-by: Damien George <damien@micropython.org>
2022-07-18 22:55:22 +10:00
David Lechner 7e4b205cb0 py/mpstate: Drop MICROPY_PORT_ROOT_POINTERS from mp_state_vm_t.
All in-tree uses of MICROPY_PORT_ROOT_POINTERS have been replaced with
MP_REGISTER_ROOT_POINTER(), so now we can remove both
MICROPY_PORT_ROOT_POINTERS and MICROPY_BOARD_ROOT_POINTERS from the code
and remaining config files.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:51:16 +10:00
David Lechner ffa22b8f97 rp2: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register all port-specific root
pointers in the rp2 port.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:50:34 +10:00
David Lechner a3703584fe extmod/modnetwork: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register mod_network_nic_list and
removes the same from all mpconfigport.h.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:50:25 +10:00
David Lechner e531b72b56 extmod/nimble: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register bluetooth_nimble_memory
and bluetooth_nimble_root_pointers and removes the same from all
mpconfigport.h.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:50:14 +10:00
David Lechner ac86e8449a drivers/ninaw10/nina_wifi_bsp: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register mp_wifi_spi, mp_wifi_timer
and mp_wifi_sockpoll_list and removes the same from all mpconfigport.h.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:49:28 +10:00
David Lechner 81dbea1ce3 shared/readline: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register the readline_history root
pointer array used by shared/readline.c and removes the registration from
all mpconfigport.h files.

This also required adding a new MICROPY_READLINE_HISTORY_SIZE config option
since not all ports used the same sized array.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:48:49 +10:00
Jim Mussared 74794d42b8 rp2/CMakeLists: Use armv6m mpy-cross arch for rp2.
Commit 0e28a1f0e5 made it possible to set
-march=armv6m.  It needs to be used when freezing for rp2.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-12 23:50:19 +10:00
Peter Harper 9f0f7e34c7 rp2/mphalport: Fix missing storage_read_blocks symbol in debug build.
When building `make BOARD=PICO_W DEBUG=1` the cyw43-driver requires
storage_read_blocks().

Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2022-07-12 16:56:38 +10:00
Jim Mussared c5563aa024 rp2/mpconfigport: Make networking options consistent across boards.
Enable the same set of networking features on boards with wifi/ethernet.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-12 16:28:44 +10:00
Jim Mussared 662dc8602b rp2: Make atomic sections suspend the other core (if active).
When a flash write/erase is in progress, we need to ensure that the
other core cannot be using XIP.

This also implements MICROPY_BEGIN_ATOMIC_SECTION as a full mutex, which
is necessary as it's used to syncronise access to things like the scheduler
queue.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-12 16:20:21 +10:00
Jim Mussared daff597753 rp2: Run USB stack task exclusively from core 0.
The goal is to avoid a situation where core 1 is shut down while holding
the tinyusb spinlock, which could happen during soft reset if
mp_thread_deinit is called while core1 is running tud_task().

This also fixes a latent race where the two cores are competing to
decrement and compare `vm_hook_divisor` with no mem fence or atomic
protection -- only core0 will now do this.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-12 16:17:19 +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
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
iabdalkader de823e7741 rp2/boards/ARDUINO_NANO_RP2040_CONNECT: Enable Arduino 1200bps touch. 2022-06-23 14:32:56 +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
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
Andrew Scheller cedb93c179 docs: Update Raspberry Pi URLs from .org to .com. 2022-06-14 11:41:13 +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 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
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