Commit Graph

12939 Commits

Author SHA1 Message Date
Damien George
a0f5b3148a lib/stm32lib: Update library for L4 v1.17.0, new G4, WL, and MMC fixes.
Changes in this new library version are:
- Update L4 HAL to v1.17.0.
- Add G4 HAL at v1.3.0.
- Add WL HAL at v1.1.0.
- Fix F4 UART and DMA data loss with RX hardware flow control.
- Optimise USB to pass config struct by reference.
- Fix bug in F4 MMC HAL_MMC_Erase function.
- Fix bug setting MMC relative address in F4 and F7 HAL.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
0892ebe091 stm32/boards: Enable MICROPY_HW_ENABLE_SERVO on various boards.
Fixes issue #8059.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 23:19:20 +11:00
Damien George
5fc55999b2 stm32/boards: Remove unused MICROPY_HW_ENABLE_TIMER config.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 23:19:00 +11:00
Damien George
10c6f03cbe stm32/boards: Remove stray '+' characters at start of lines in ld files.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 23:15:25 +11:00
Damien George
3f589e2f39 tools/autobuild: Automatically build all esp32 boards.
Any board with a board.json file will be built.  ESP32-based boards will be
built using the IDF at $IDF_PATH_V42, all other MCU variants (S2, S3, C3)
will be built using the IDF at $IDF_PATH_V44.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-10 21:29:27 +11:00
Damien George
c613f5bb49 stm32/boards/LEGO_HUB_NO6: Set filesystem label as HUB_NO6.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 16:51:35 +11:00
Jim Mussared
92f54fe8d9 stm32/boards/NUCLEO_WB55: Fix LED ordering.
These were commented correctly by their colour, but in the wrong order with
respect to the PCB silkscreen.

Fixes issue #8054.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-09 14:03:35 +11:00
Damien George
67f66795c0 tools/mpremote: Implement seek and flush in ioctl method.
Fixes issue #8058.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 13:35:59 +11:00
Damien George
9ffb1ad2f8 unix/Makefile: Use -Og instead of -O0 for debug builds.
For the coverage build this reduces the binary size to about 1/4 of its
size, and seems to help gcov/lcov coverage analysis so that it doesn't miss
lines.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 12:53:09 +11:00
Damien George
efde4b2c75 extmod/modure: Redirect regex debug printing to mp_printf.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 12:53:04 +11:00
Damien George
71168ec55c unix/coverage: Change remaining printf to mp_printf.
For consistency with all other prints in this file, so that the ordering
of output is correct.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-09 12:38:50 +11:00
Jim Mussared
3770fab334 all: Update Python formatting to latest Black version 21.12b0.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-09 12:09:40 +11:00
IhorNehrutsa
b491967bbd esp32/machine_pwm: Implement duty_u16() and duty_ns() PWM methods.
The methods duty_u16() and duty_ns() are implemented to match the existing
docs.  The duty will remain the same when the frequency is changed.
Standard ESP32 as well as S2, S3 and C3 are supported.

Thanks to @kdschlosser for the fix for rounding in resolution calculation.

Documentation is updated and examples expanded for esp32, including the
quickref and tutorial.  Additional notes are added to the machine.PWM docs
regarding limitations of hardware PWM.
2021-12-03 23:58:52 +11:00
Jim Mussared
a7fa18c203 py/builtinimport: Refactor module importing.
Simplify and document/comment the handling of builtin import for:
- already-loaded modules
- built-in modules
- built-in umodules (formerly weak links)
- filesystem modules

Retains existing functionality with smaller code size but should also
facilitate potential new features (built-in packages, controlling the
frozen path).

Also makes the (unix-only) -m behavior a bit more obvious and configurable.

Code size change with this commit:

   bare-arm:    +0 +0.000%
minimal x86:   -64 -0.039%
   unix x64:   -32 -0.006%
unix nanbox:    -4 -0.001%
      stm32:  -184 -0.047% PYBV10
     cc3200:  -120 -0.065%
    esp8266:  -228 -0.033% GENERIC
      esp32:  -268 -0.018% GENERIC[incl +16(data)]
        nrf:  -152 -0.087% pca10040
        rp2:  -256 -0.052% PICO
       samd:   -80 -0.057% ADAFRUIT_ITSYBITSY_M4_EXPRESS
2021-12-01 13:23:34 +11:00
Jonathan Hogg
851ecb2da1 extmod/modbluetooth: Support gap_connect(None) to cancel a connection.
Allow cancellation of in-progress peripheral connections.
2021-12-01 11:56:37 +11:00
Scott Armitage
de7e3cd792 docs/library/machine.Pin.rst: Add Pin.ANALOG mode constant. 2021-11-30 22:33:18 +11:00
Michael Buesch
68d1245f42 docs/library/machine.Timer.rst: Document period and callback args.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:29:03 +11:00
Michael Buesch
1e7c8f2b0b docs/library/machine.SPI.rst: Add example SPI usage.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:28:19 +11:00
Michael Buesch
e7900351bf docs/library/machine.Timer.rst: Document 'id' as positional-only arg.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:27:58 +11:00
Peter Hinch
d94ac4333f docs/library/uasyncio.rst: Detail exception behaviour in cancel/timeout. 2021-11-30 21:43:06 +11:00
Damien George
23a150789d stm32/boards/make-pins.py: Use cpu pins to define static alt-fun macros.
Instead of board pins, so that pins which have only the CPU specified in
pins.csv can still be used with mp_hal_pin_config_alt_static().

Signed-off-by: Damien George <damien@micropython.org>
2021-11-30 10:25:41 +11:00
Damien George
0c9f5b388e stm32: Include HAL MMC code in F4 builds.
So that the MMC driver can be used on F4 MCUs.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-30 10:21:18 +11:00
Damien George
7e61a12eb1 stm32: Add support for F479 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2021-11-30 10:21:18 +11:00
Damien George
35e70c1698 stm32/boards: Convert F413,F439,H743,L4xx,WB55 to new flash FS config.
Signed-off-by: Damien George <damien@micropython.org>
2021-11-29 13:20:35 +11:00
Damien George
84969194a1 stm32/flashbdev: Support generic flash storage config via link symbols.
A board can now define the following linker symbols to configure its flash
storage layout:

    _micropy_hw_internal_flash_storage_start
    _micropy_hw_internal_flash_storage_end
    _micropy_hw_internal_flash_storage_ram_cache_start
    _micropy_hw_internal_flash_storage_ram_cache_end

And optionally have a second flash segment by configuring
MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE_SEGMENT2 to 1 and defining:

    _micropy_hw_internal_flash_storage2_start
    _micropy_hw_internal_flash_storage2_end

Signed-off-by: Damien George <damien@micropython.org>
2021-11-29 13:01:51 +11:00
iabdalkader
97a7cc243b lib: Update pico-sdk to 1.3.0 and tinyusb to 0.12.0.
Fixes #8025
2021-11-26 12:05:38 +11:00
Jim Mussared
678f4b959f esp32/boards/GENERIC_S3: Enable BLE on ESP32 S3.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-26 11:58:12 +11:00
gibbonsc
de8dc4bad2 docs/esp8266/tutorial: Fix comments of FrameBuffer examples.
The third and fourth parameters in display.rect() and display.fill_rect()
are not x,y coordinates, but are instead width,height values.  Update the
comment after the example to show the correct x,y coordinates of the bottom
right corner of each rectangle, respectively.
2021-11-25 23:34:19 +11:00
David Michieli
6259aa50eb stm32/boards/NUCLEO_WB55: Update rfcore_firmwre for new WS.
Adds a fix to behavior occuring since WS 1.11 where the FUS returns
misleading statuses during WS upgrade.
2021-11-25 23:28:58 +11:00
Damien George
a0890983ea py/objfun.h: Remove obsolete comments about entries in extra_args.
These two entries were removed in 049a7a8153

Signed-off-by: Damien George <damien@micropython.org>
2021-11-25 23:24:40 +11:00
Jim Mussared
e99f7b6d25 tests/cpydiff: Clarify f-string diffs regarding concatenation.
Concatenation of any literals (including f-strings) should be avoided.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-25 22:09:59 +11:00
Damien George
11ed94797d py/lexer: Support nested [] and {} characters within f-string params.
Signed-off-by: Damien George <damien@micropython.org>
2021-11-25 21:50:58 +11:00
Damien George
196d26848a stm32/usb: Use a table of allowed values to simplify usb_mode get/set.
This reduces code size and code duplication, and fixes `pyb.usb_mode()` so
that it now returns the correct string when in multi-VCP mode (before, it
would return None when in one of these modes).

Signed-off-by: Damien George <damien@micropython.org>
2021-11-25 21:18:17 +11:00
Frédéric Pierson
d49df423e0 stm32/boards/NADHAT_PYBF405: Rename board to GARATRONIC_NADHAT_F405.
To add the manufacturer as a prefix to the board name, for consistency with
other Garatronic boards.
2021-11-25 21:10:43 +11:00
Frédéric Pierson
fdb925c4c1 stm32/boards: Add PYBSTICK26 F411 board definition. 2021-11-25 21:09:57 +11:00
Frédéric Pierson
c422ca3da1 rp2/boards: Add PYBSTICK26 RP2040 board definition. 2021-11-25 21:05:21 +11:00
robert-hh
81f706aee4 mimxrt: Support PWM using the FLEXPWM and QTMR modules.
Frequency range 15Hz/18Hz to > 1 MHz, with decreasing resolution of the
duty cycle.  The basic API is supported as documentated, except that
keyword parameters are accepted for both the instatiaton and the
PWM.init() call.

Extensions: support PWM for channel pairs.  Channel pairs are declared by
supplying 2-element tuples for the pins.  The two channels of a pair must
be the A/B channel of a FLEXPWM module.  These form than a complementary
pair.

Additional supported keyword arguments:

- center=value Defines the center position of a pulse within the pulse
  cycle.  The align keyword is actually shortcut for center.

- sync=True|False: If set to True, the channels will be synchronized to a
  submodule 0 channel, which has already to be enabled.

- align=PWM.MIDDLE | PMW.BEGIN | PWM.END. It defines, whether synchronized
  channels are Center-Aligned or Edge-aligned.  The channels must be either
  complementary a channel pair or a group of synchronized channels.  It may
  as well be applied to a single channel, but withiout any benefit.

- invert= 0..3. Controls ouput inversion of the pins.  Bit 0 controls the
  first pin, bit 1 the second.

- deadtime=time_ns time of complementary channels for delaying the rising
  slope.

- xor=0|1|2 xor causes the output of channel A and B to be xored.  If
  applied to a X channel, it shows the value oif A ^ B.  If applied to an A
  or B channel, both channel show the xored signal for xor=1.  For xor=2,
  the xored signal is split between channels A and B.  See also the
  Reference Manual, chapter about double pulses.  The behavior of xor=2 can
  also be achieved using the center method for locating a pulse within a
  clock period.

The output is enabled for board pins only.

CPU pins may still be used for FLEXPWM, e.g. as sync source, but the signal
will not be routed to the output.  That applies only to FLEXPWM pins.  The
use of QTMR pins which are not board pins will be rejected.

As part of this commit, the _WFE() statement is removed from
ticks_delay_us64() to prevent PWM glitching during calls to sleep().
2021-11-24 13:48:27 +11:00
Damien George
bb7aae557b tools/autobuild: Automatically build all stm32 boards.
Any board with a board.json file will be built.  Additional variants for
certain pyboards will also be built by the explicit build-stm32-extra.sh
script.  Both .dfu and .hex files will be made available.

Also build boards in a sorted order, and don't stop building if a single
board fails.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-22 17:12:16 +11:00
Damien George
90554d03c0 stm32/boards: Build NUCLEO_WB55 and STM32F769DISC without mboot enabled.
This is to make the builds for all nucleo/discovery boards uniform, so they
can be treated the same by the auto build scripts.

The CI script is updated to explicitly enable mboot and packing, to test
these features.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-22 17:12:16 +11:00
Laurens Valk
e2ca8ab8fc py/runtime: Allow types to use both .attr and .locals_dict.
Make it possible to proceed to a regular lookup in locals_dict if the
custom type->attr fails.  This allows type->attr to extend rather than
completely replace the lookup in locals_dict.

This is useful for custom builtin classes that have mostly regular methods
but just a few special attributes/properties.  This way, type->attr needs
to deal with the special cases only and the default lookup will be used for
generic methods.

Signed-off-by: Laurens Valk <laurens@pybricks.com>
2021-11-22 12:10:35 +11:00
Damien George
01ceb9aca3 stm32/dma: Make DMA2_Stream3 exclusive to SDIO when CYW43 enabled.
This prevents SPI4/5 from being used if SDIO and CYW43 are enabled, because
the DMA for the SDIO is used on an IRQ and must be exclusivly available for
use by the SDIO peripheral.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-22 11:57:37 +11:00
Damien George
dfa75f33a5 stm32/sdio: Don't explicitly disable DMA2 on deinit of SDIO.
Because DMA2 may be in use by other peripherals, eg SPI1.

On PYBD-SF6 it's possible to trigger a bug in the existing code by turning
on WLAN and connecting to an AP, pinging the IP address from a PC and
running the following code on the PYBD:

    def spi_test(s):
        while 1:
            s.write('test')
            s.read(4)

    spi_test(machine.SPI(1,100000000))

This will eventually fail with `OSError: [Errno 110] ETIMEDOUT` because
DMA2 was turned off by the CYW43 driver during the SPI1 transfer.

This commit fixes the bug by removing the code that explicitly disables
DMA2.  Instead DMA2 will be automatically disabled after an inactivity
timeout, see commit a96afae90f

Signed-off-by: Damien George <damien@micropython.org>
2021-11-22 11:57:37 +11:00
Peter Boin
e83aa252f7 stm32/main: Run optional frozen module at boot.
If a board specifies a filename via MICROPY_BOARD_FROZEN_BOOT_FILE then
that will be run on start up, before the usual boot.py.
2021-11-22 11:56:24 +11:00
Damien George
123dcdb8e5 py/modsys: Replace non-ASCII quote char with ASCII char.
The source code should stay 7-bit ASCII clean.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-19 17:26:04 +11:00
Damien George
78ab2eeda3 py/showbc: Print unary-op string when dumping bytecode.
Signed-off-by: Damien George <damien@micropython.org>
2021-11-19 17:05:40 +11:00
Lorenzo Cappelletti
8f0e304e65 stm32/boards: Add new board MikroElektronika Quail, and F427 support.
Quail (https://www.mikroe.com/quail, PID: MIKROE-1793) is based on an
STM32F427VI CPU, featuring 2048 kB of Flash memory and 192 kB of RAM.  An
on-board Cypress S25FL164K adds 8 MB of SPI Flash.

Quail has 4 mikroBUS(TM) sockets for Mikroe click(TM) board connectivity,
along with 24 screw terminals for connecting additional electronics and two
USB ports (one for programming, the other for external mass storage).

4 UARTs, 2 SPIs and 1 I2C bus are available for communication.

Signed-off-by: Lorenzo Cappelletti <lorenzo.cappelletti@gmail.com>
2021-11-19 16:33:13 +11:00
Lorenzo Cappelletti
16c7a80874 stm32/boards/MIKROE_CLICKER2_STM32: Add more detail to board.json.
Signed-off-by: Lorenzo Cappelletti <lorenzo.cappelletti@gmail.com>
2021-11-19 16:32:53 +11:00
iabdalkader
78425208ba nrf/main: Use VFS helper function to mount fs and chdir. 2021-11-19 15:43:04 +11:00
iabdalkader
f7a0c98e00 extmod/network_ninaw10: Fix scan list order to match other NICs. 2021-11-19 15:41:26 +11:00
iabdalkader
b65d17fced drivers/ninaw10: Fix BSSID byte order, and add null byte to ESSID.
- Fix the BSSID byte order from scan and netinfo.
- Make sure ESSID from netinfo is null terminated.
2021-11-19 15:41:26 +11:00