Commit Graph

1218 Commits

Author SHA1 Message Date
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
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
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
Damien George
6995cf03dd stm32/sdcard: Add config option to force MM card capacity.
The current ST HAL does not support reading the extended CSD so cannot
correctly detect the capacity of high-capacity cards.  As a workaround, the
capacity can be forced via the MICROPY_HW_MMCARD_LOG_BLOCK_NBR config
option.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
b26704aac5 stm32/sdcard: Support 8-bit wide SDIO bus.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
9a1ab2286d stm32/main: Call sdcard_init when only MICROPY_HW_ENABLE_MMCARD enabled.
Otherwise, if MMCARD is enabled and not SDCARD, then the GPIO will not be
configured for SDIO.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-14 10:48:01 +11:00
Damien George
88ac5a3116 stm32: Update L4 code to build with latest stm32lib and L4 HAL 1.17.0.
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
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
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
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
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
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
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
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
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
stijn
5900257dd6 extmod/uplatform: Use generic custom platform string.
Don't force the 'HAL' string to be part of the platform string because
it doesn't have a sensible meaning for all possible platforms, and
swap it with the PLATFORM_ARCH string so the strings which most platforms
have come first.
2021-11-18 10:46:14 +11:00
Matt van de Werken
a4c0f52714 stm32/led: Support an extra 2 LEDs in board configuration.
Although the pyboard has only 4 LEDs, there are some boards that (may) have
more.  This commit adds 2 more LEDs to the led.c file that if defined in
the board-specific config file will be compiled in.
2021-11-17 14:46:58 +11:00
MikeTeachman
6d5296e65e stm32,esp32: In machine_i2s, make object reference arrays root pointers.
This change eliminates the risk of the IRQ callback accessing invalid data.
Discussed here:
https://github.com/micropython/micropython/pull/7183#discussion_r660209875

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2021-11-13 12:22:42 +11:00
MikeTeachman
0be3b91f11 stm32,esp32: In machine_i2s, send null samples in underflow situations.
Eliminate noise data from being sent to the I2S peripheral when the
transmitted sample stream is stopped.

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2021-11-12 16:50:15 +11:00
Damien George
c62351fbd6 py/mpconfig.h: Revert MICROPY_REPL_INFO to disabled at all levels.
This is an stm32-specific feature that's accessed via the pyb module, so
not something that will be widely enabled.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-01 15:18:22 +11:00
Jim Mussared
3041881353 stm32/mpconfigport.h: Use the "extra" feature level.
This commit is a no-op change.  Future improvements can come from making
individual boards use CORE or BASIC.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-01 15:02:22 +11:00
Damien George
83827e8e63 stm32/uart: Fix race conditions and clearing status in IRQ handler.
Prior to this commit IRQs on STM32F4 could be lost because SR is cleared by
reading SR then reading DR.  For example, if both RXNE and IDLE IRQs were
active upon entry to the IRQ handler, then IDLE is lost because the code
that handles RXNE comes first and accidentally clears SR (by reading SR
then DR to get the incoming character).

This commit fixes this problem by making the IRQ handler more atomic in the
following operations:
- get current IRQ status flags
- deal with RX character
- clear remaining status flags
- call user handler

On the STM32F4 it's very hard to get this right because the only way to
clear IRQ status flags is to read SR then DR, but the read of DR may read
some data which should remain in the register until the user wants to read
it.  And it won't work to cache the read because RTS/CTS flow control will
then not work.  So instead the new code disables interrupts if the DR is
full and waits for the user to read it before reenabling the interrupts.

Fixes issue mentioned in #4599 and #6082.

Signed-off-by: Damien George <damien@micropython.org>
2021-10-28 13:14:21 +11:00
Mike Causer
590ec2ca6e stm32/boards: Add images to board.json for Adafruit and VCC_GND boards. 2021-10-28 09:52:59 +11:00
Jim Mussared
e359b077dd ports: Add board.json for all boards.
This will be used by https://micropython.org/download/ to generate the
full listing of boards and firmware files.

Optionally supports a board.md for additional customisation of the
download page, as well as deploy.md for flashing instructions.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-27 14:04:53 +11:00
Damien George
30268c93dc stm32/pendsv: Allow a board to add entries for pendsv_schedule_dispatch.
Signed-off-by: Damien George <damien@micropython.org>
2021-10-20 21:20:18 +11:00
Damien George
69522822de stm32/mpbthciport: Allow a board to hook BT HCI poll functions.
Signed-off-by: Damien George <damien@micropython.org>
2021-10-20 21:20:18 +11:00
Damien George
5f2f9044ff stm32/usbd_cdc_interface: Allow a board to hook into USBD CDC RX events.
Signed-off-by: Damien George <damien@micropython.org>
2021-10-20 21:20:18 +11:00
iabdalkader
eea6cd85b3 stm32/sdram: Enforce gcc opt, and use volatile and DSB in sdram_test.
Ensures consistent behaviour and resolves the D-Cache bug (the "exhaustive"
argument being lost due to cache being turned off) when O0 is used.

The changes in this commit are:

- Change -O0 to -Os because "gcc is considered broken at -O0" according to
  https://github.com/ARM-software/CMSIS_5/issues/620#issuecomment-550235656

- Use volatile for mem_base so the compiler doesn't optimise away reads or
  writes to the SDRAM, which is being tested.

- Use DSB to prevent any other compiler optimisations that would change the
  testing logic.

- Use alternating pattern/antipattern in exhaustive test to catch more
  hardware/configuration errors.

Implementation adapted by @andrewleech, taken directly from investigation
by @iabdalkader and @dpgeorge.

See #7841 and #7869 for further discussion.
2021-10-15 17:59:31 +11:00
iabdalkader
67d1dca9c2 stm32/machine_i2c: Use hardware I2C for STM32H7. 2021-09-21 18:13:28 +10:00
roland van straten
9eff4029ab stm32/boards: Add PF11-BOOT0 to stm32f091_af.csv.
PF11 is added so it can be used as GPIO.
2021-09-21 18:11:42 +10:00
Ned Konz
99bb52047c stm32/boards/NUCLEO_H743ZI: Enable VfsLfs2 on NUCLEO_H743ZI(2) boards. 2021-09-21 18:02:19 +10:00
Ned Konz
8c214ed200 stm32: Extended flash filesystem space to 512K on H743 boards.
The H743 has equal sized pages of 128k, which means the filesystem doesn't
need to be near the beginning.  This commit moves the filesystem to the
very end of flash, and extends it to 512k (4 pages).

Signed-off-by: Damien George <damien@micropython.org>
2021-09-21 18:02:14 +10:00
iabdalkader
782d5b2e53 stm32: Enable platform module.
The HAL version is based on the stm32lib version.
2021-09-19 23:35:44 +10:00
Chris Fiege
6e39f2cc1e stm32/boards: Add OLIMEX H407 board definition.
This change adds the OLIMEX H407 support to the STM32 port.  The H407
(https://www.olimex.com/Products/ARM/ST/STM32-H407/) is simliar to the
already existing E407
(https://www.olimex.com/Products/ARM/ST/STM32-E407) but does not support
Ethernet and has a full-size USB-A port instead of a Mini-USB socket.

Both boards use the STM32F407ZGT6 CPU.

This port is basically a copy of the E407 but with changed pinmux:
* Removed Ethernet pin definition
* Removed UART1 (pins are used for other functions)
* Removed UART3 flow control pins (pins are used for other functions)
* Removed SD-Card detect pin (since it is not connected on the H407)

A REPL on UART3 is connected to the U3BOOT-header, a 3-pin header with RX,
TX and GND that is intended for the serial terminal.

Tested:
* Micro-SD Card is detected when inserted on RESET
* REPL on UART3 works
* Serial port on the mini USB socket

Signed-off-by: Chris Fiege <cfi@pengutronix.de>
2021-09-19 16:58:58 +10:00
Jim Mussared
b326edf68c all: Remove MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE.
This commit removes all parts of code associated with the existing
MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE optimisation option, including the
-mcache-lookup-bc option to mpy-cross.

This feature originally provided a significant performance boost for Unix,
but wasn't able to be enabled for MCU targets (due to frozen bytecode), and
added significant extra complexity to generating and distributing .mpy
files.

The equivalent performance gain is now provided by the combination of
MICROPY_OPT_LOAD_ATTR_FAST_PATH and MICROPY_OPT_MAP_LOOKUP_CACHE (which has
been enabled on the unix port in the previous commit).

It's hard to provide precise performance numbers, but tests have been run
on a wide variety of architectures (x86-64, ARM Cortex, Aarch64, RISC-V,
xtensa) and they all generally agree on the qualitative improvements seen
by the combination of MICROPY_OPT_LOAD_ATTR_FAST_PATH and
MICROPY_OPT_MAP_LOOKUP_CACHE.

For example, on a "quiet" Linux x64 environment (i3-5010U @ 2.10GHz) the
change from CACHE_MAP_LOOKUP_IN_BYTECODE, to LOAD_ATTR_FAST_PATH combined
with MAP_LOOKUP_CACHE is:

diff of scores (higher is better)
N=2000 M=2000       bccache -> attrmapcache      diff      diff% (error%)
bm_chaos.py        13742.56 ->   13905.67 :   +163.11 =  +1.187% (+/-3.75%)
bm_fannkuch.py        60.13 ->      61.34 :     +1.21 =  +2.012% (+/-2.11%)
bm_fft.py         113083.20 ->  114793.68 :  +1710.48 =  +1.513% (+/-1.57%)
bm_float.py       256552.80 ->  243908.29 : -12644.51 =  -4.929% (+/-1.90%)
bm_hexiom.py         521.93 ->     625.41 :   +103.48 = +19.826% (+/-0.40%)
bm_nqueens.py     197544.25 ->  217713.12 : +20168.87 = +10.210% (+/-3.01%)
bm_pidigits.py      8072.98 ->    8198.75 :   +125.77 =  +1.558% (+/-3.22%)
misc_aes.py        17283.45 ->   16480.52 :   -802.93 =  -4.646% (+/-0.82%)
misc_mandel.py     99083.99 ->  128939.84 : +29855.85 = +30.132% (+/-5.88%)
misc_pystone.py    83860.10 ->   82592.56 :  -1267.54 =  -1.511% (+/-2.27%)
misc_raytrace.py   21490.40 ->   22227.23 :   +736.83 =  +3.429% (+/-1.88%)

This shows that the new optimisations are at least as good as the existing
inline-bytecode-caching, and are sometimes much better (because the new
ones apply caching to a wider variety of map lookups).

The new optimisations can also benefit code generated by the native
emitter, because they apply to the runtime rather than the generated code.
The improvement for the native emitter when LOAD_ATTR_FAST_PATH and
MAP_LOOKUP_CACHE are enabled is (same Linux environment as above):

diff of scores (higher is better)
N=2000 M=2000        native -> nat-attrmapcache  diff      diff% (error%)
bm_chaos.py        14130.62 ->   15464.68 :  +1334.06 =  +9.441% (+/-7.11%)
bm_fannkuch.py        74.96 ->      76.16 :     +1.20 =  +1.601% (+/-1.80%)
bm_fft.py         166682.99 ->  168221.86 :  +1538.87 =  +0.923% (+/-4.20%)
bm_float.py       233415.23 ->  265524.90 : +32109.67 = +13.756% (+/-2.57%)
bm_hexiom.py         628.59 ->     734.17 :   +105.58 = +16.796% (+/-1.39%)
bm_nqueens.py     225418.44 ->  232926.45 :  +7508.01 =  +3.331% (+/-3.10%)
bm_pidigits.py      6322.00 ->    6379.52 :    +57.52 =  +0.910% (+/-5.62%)
misc_aes.py        20670.10 ->   27223.18 :  +6553.08 = +31.703% (+/-1.56%)
misc_mandel.py    138221.11 ->  152014.01 : +13792.90 =  +9.979% (+/-2.46%)
misc_pystone.py    85032.14 ->  105681.44 : +20649.30 = +24.284% (+/-2.25%)
misc_raytrace.py   19800.01 ->   23350.73 :  +3550.72 = +17.933% (+/-2.79%)

In summary, compared to MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE, the new
MICROPY_OPT_LOAD_ATTR_FAST_PATH and MICROPY_OPT_MAP_LOOKUP_CACHE options:
- are simpler;
- take less code size;
- are faster (generally);
- work with code generated by the native emitter;
- can be used on embedded targets with a small and constant RAM overhead;
- allow the same .mpy bytecode to run on all targets.

See #7680 for further discussion.  And see also #7653 for a discussion
about simplifying mpy-cross options.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16 16:04:03 +10:00
Jim Mussared
68219a295c stm32: Enable LOAD_ATTR fast path, and map lookup caching on >M0.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16 16:02:19 +10:00
Damien George
0c0807e084 stm32/dma: Add functions for external users of DMA to enable clock.
Any external user of DMA (eg a board with a custom DMA driver) must call
dma_external_acquire() for their DMA controller/stream to ensure that the
DMA clock is not automatically turned off while it's still being used
externally.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-16 13:01:43 +10:00
Damien George
c51cc46bf8 stm32/boards/make-pins.py: Allow empty lines and comments in pins.csv.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-16 12:53:16 +10:00
Damien George
a6907c779a stm32/boards/make-pins.py: Allow a CPU pin to be hidden.
This change allows a CPU pin to be hidden from the user by prefixing it
with a "-" in the pins.csv file for a board.  It will still be available in
C code, just not exposed to Python.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-16 12:53:16 +10:00
Jim Mussared
e3eebc329f stm32: Suggest putting code in main.py not boot.py.
Don't want users to accidentally use boot.py (because recovering requires
knowing how to activate safe mode).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16 12:40:05 +10:00
Jan Staal
9e2423e730 stm32: Add support for H7A3(Q)/H7B3(Q), and STM32H73B3I_DK board defn.
This commit is based upon prior work of @dpgeorge and @koendv.

MCU support for the STM32H7A3 and B3 families MCUs:
- STM32H7A3xx
- STM32H7A3xxQ (SMPS)
- STM32H7B3xx
- STM32H7B3xxQ (SMPS)

Support has been added for the STM32H7B3I_DK board.

Signed-off-by: Jan Staal <info@janstaal.com>
2021-09-16 12:29:28 +10:00
iabdalkader
d9749f90ad extmod/modnetwork: Remove modnetwork socket u_state member.
To simplify the socket state.

The CC3K driver (see drivers/cc3000/inc/socket.h and src/socket.c) has
socket() returning an INT16 so there is now enough room to store it
directly in the fileno member.
2021-09-15 11:29:02 +10:00
Jan Hrudka
d451dc0086 stm32: Add basic support for STM32H750. 2021-09-15 10:42:20 +10:00
iabdalkader
4dba04a50f extmod/modnetwork: Define network interfaces in port config files.
So this network implementation becomes more generic.
2021-09-15 01:29:26 +10:00
iabdalkader
7aab0dc5d8 extmod: Move modnetwork and modusocket from stm32 to extmod.
So they can be used by other ports.
2021-09-15 01:25:12 +10:00
Damien George
0a51073724 stm32/boards: Remove trailing spaces, and add newline at end of file.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-10 16:09:03 +10:00
Tobias Thyrrestrup
4c31d0ab60 stm32/boards/LEGO_HUB_NO6: Remove user paths from cc2564 init file.
Signed-off-by: Tobias Thyrrestrup <tt@LEGO.com>
2021-09-10 16:00:21 +10:00
Daniel Gorny
b71c621f46 stm32/boards/OLIMEX_E407: Add Ethernet RMII support. 2021-09-10 15:52:03 +10:00
Boris Vinogradov
97bbc0bb91 stm32/boards/VCC_GND_H743VI: Add board definition for VCC_GND_H743VI. 2021-09-10 15:49:26 +10:00
Damien George
9792c9105f stm32/main: Don't unconditionally enable GPIO A,B,C,D clocks.
Rely on them being enabled only when needed.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 20:28:53 +10:00
Damien George
05cd17e36f stm32/pin: Enable GPIO clock of pin if it's constructed without init.
Fixes issue #7363.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 20:28:53 +10:00
Damien George
afe0634c98 extmod/machine_spi: Make SoftSPI configurable via macro option.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 13:11:23 +10:00
Damien George
122d901ef1 extmod/machine_i2c: Make SoftI2C configurable via macro option.
The zephyr port doesn't support SoftI2C so it's not enabled, and the legacy
I2C constructor check can be removed.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 13:11:23 +10:00
Damien George
25f30eb8a6 stm32/boards/LEGO_HUB_NO6: Add comment re constraints on SPI flash cfg.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 00:03:41 +10:00
David Lechner
86371781e9 tools/uncrustify: Force 1 newline at end of file.
To keep things neat and tidy, we ensure that each file has 1 and only 1
newline at the end of each file.

Signed-off-by: David Lechner <david@pybricks.com>
2021-08-31 13:14:45 +10:00
Damien George
6f19b9c08d stm32/boards/LEGO_HUB_NO6: Add make commands to backup/restore firmware.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-31 00:16:39 +10:00
Damien George
bac791c5fd stm32/boards/LEGO_HUB_NO6: Skip first 1MiB of SPI flash for storage.
The first 1MiB is used by the built-in bootloader and is best left as-is.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-31 00:16:39 +10:00
Damien George
e3eed26d0b stm32/boards/LEGO_HUB_NO6: Change SPI flash storage to use hardware SPI.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-31 00:16:39 +10:00
Damien George
6936f410ab stm32/storage: Make extended-block-device more configurable.
A board can now define the following to fully customise the extended block
device interface provided by the storage sub-system:
- MICROPY_HW_BDEV_BLOCKSIZE_EXT
- MICROPY_HW_BDEV_READBLOCKS_EXT
- MICROPY_HW_BDEV_WRITEBLOCKS_EXT
- MICROPY_HW_BDEV_ERASEBLOCKS_EXT

Signed-off-by: Damien George <damien@micropython.org>
2021-08-31 00:16:39 +10:00
Jim Mussared
b51e7e9d01 stm32: Disable computed goto on constrained boards.
Saves ~1kiB.  Add comment to this effect to mpconfig.h.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-20 20:18:52 +10:00
Damien George
61d5a8b9ce stm32/stm32_it: Support TIM17 IRQs on WB MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-20 17:04:39 +10:00
Tobias Thyrrestrup
0886bf46ca stm32/Makefile: Allow GIT_SUBMODULES and LIBS to be extended.
Signed-off-by: Tobias Thyrrestrup <tt@LEGO.com>
2021-08-19 22:56:39 +10:00
Jim Mussared
e64cda5295 stm32: Add implementation of machine.bitstream.
Hand-written version for M0, and cycle-counter version for everything else.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +10:00
Jim Mussared
5733c49174 stm32,esp32,rp2: Enable MICROPY_PY_FSTRINGS by default.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14 16:58:40 +10:00
Ned Konz
42d1a1635c stm32/mbedtls: Fix compile warning about uninitialized val. 2021-08-10 23:43:25 +10:00
Ned Konz
a0cd18c1a5 stm32/boards/NUCLEO_H743ZI2: Add modified version of NUCLEO_H743ZI.
This commit creates a new stm32 board for the NUCLEO_H743ZI2, which is the
current version of this from ST.  This is a modified copy of the
NUCLEO_H743ZI board, and the ZI2 board differs in a few minor ways:

- LED2 has moved from PB7 to PE1 and is now yellow rather than blue
- the USB power enable has moved from PG6 to PG10
- the USER button is now pulled down
2021-08-10 23:38:05 +10:00
Damien George
f834fef6bb stm32/powerctrl: Support changing frequency on WB MCUs.
This allows changing the frequency to: 100kHz, 200kHz, 400kHz, 800kHz,
1MHz, 2MHz, 4MHz, 8MHz, 16MHz, 32MHz, 64MHz.  For frequencies 2MHz and
below, low power run (LPR) mode is enabled automatically.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:41:20 +10:00
Damien George
3b32b3d1b3 stm32/usbd_cdc_interface: Rename USBD_CDC_xx opts to MICROPY_HW_USB_xx.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:13:58 +10:00
Damien George
f28e8b9073 stm32/usbd_desc: Rename USBD_xxx descriptor opts to MICROPY_HW_USB_xxx.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:13:58 +10:00
Damien George
96c6b8cae3 ports: Rename USBD_VID/PID config macros to MICROPY_HW_USB_VID/PID.
For consistency with other board-level config macros that begin with
MICROPY_HW_USB.

Also allow boards in the mimxrt, nrf and samd ports to configure these
values.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:13:55 +10:00
Damien George
40b8ff0a6f stm32/README.md: Update supported MCUs, and submodule and mboot use.
Also mention mpremote as a way to access the REPL.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-31 15:12:13 +10:00
Tobias Thyrrestrup
60e3e51753 stm32/Makefile: Update to only pull in used Bluetooth library. 2021-07-31 15:11:46 +10:00
Tobias Thyrrestrup
7a1edb91cb stm32/boards/LEGO_HUB_NO6: Add board definition for LEGO_HUB_NO6.
Add basic support for LEGO HUB NO.6 (e.g. LEGO SPIKE Prime, LEGO MINDSTORMS
Robot Inventor).

See README.md for details.

Thanks to @dpgeorge for helping put this together.

Signed-off-by: Tobias Thyrrestrup <tt@LEGO.com>
2021-07-31 10:25:18 +10:00
Damien George
224ac355cd stm32/boards/NUCLEO_F439ZI: Add board definition for NUCLEO_F439ZI.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-27 16:46:10 +10:00
Matúš Olekšák
0f0006f4e1 stm32/boards/STM32F429DISC: Set correct UART2 pins and add UART3/6. 2021-07-26 14:38:39 +10:00
Damien George
aa0cf873bf stm32/uart: Support low baudrates on LPUART1.
By selecting a larger prescaler when needed.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-26 13:53:50 +10:00
Damien George
fef2114404 stm32/uart: Fix LPUART1 baudrate set/get.
It needs to use a different function because the formula to compute the
baudrate on LPUART1 is different to a normal UART.

Fixes issue #7466.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-26 13:53:50 +10:00
Chris Wilson
aecb697c72 stm32/boards: Add support for SparkFun STM32 MicroMod Processor board.
Signed-off-by: Chris Wilson <christopher.david.wilson@gmail.com>
2021-07-23 22:03:16 +10:00
Sashkoiv
753b08cae6 stm32/boards/NUCLEO_F446RE: Enable CAN bus support. 2021-07-23 00:06:13 +10:00
iabdalkader
7649f5fbd2 stm32/sdram: Make SDRAM test cache aware, and optional failure with msg.
* Make SDRAM test cache-aware for newer MCUs.
* Use the defined data bus width (instead of the fixed 8-bits).
* Allow optional failure on error with verbose error messages.
* Test speed is now inverted (test accepts exhaustive instead fast).
2021-07-22 16:47:49 +10:00