Commit Graph

2260 Commits

Author SHA1 Message Date
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
Philipp Ebensberger 0d7366c912 mimxrt: Rework flash configuration.
- Moves definition of BOARD_FLASH_SIZE and other header files related to
	flash configuration into the Makefile.
- Adds board specific clock_config.h.
- Adds board.h, pin_mux.h, and peripherals.h as they are
	required by NXP MCU SDK in order to use our own clock_config.h.
- Renames board specific FlexSPI configuration files.
- Updates flash frequency of MIMXRT1020_EVK
- Creates separated flash_config files for QSPI NOR and
	QSPI Hyper flash.
- Unifies VFS start address to be @ 1M for 1010 and 1020 boards.
- Unifies 1050EVK boards
- Adds support to both NOR and HyperFlash on boards with
	both capabilities.
- Adds automatic FlexRAM initialization to start-up code based on
	linker script and NXP HAL.
- Applies code formatting to all files in mimxrt port.

With this change the flash configuration is restructured and
organized. This simplifies the configuration process and
provides a better overview of each board's settings. With the integration
of clock_config.h, board.h, pin_mux.h, and peripherals.h we gain better
control of the settings and clock configurations. Furthermore the
implementation of an explicit FlexRAM setup improves the system
performance and allows for performance tuning.

Signed-off-by: Philipp Ebensberger
2021-09-14 13:52:52 +02:00
Seon Rozenblum f690fd3a47 esp32/machine_timer: Use tx_update member for IDF 4.4 and above. 2021-09-13 18:25:16 +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
Seon Rozenblum 9a7f77bfbc esp32/boards: Add new FeatherS2-Neo board definition. 2021-09-10 15:40:32 +10:00
stijn 318c029d45 windows/README: Remove unsupported Python instructions for Cygwin.
It's not possible anymore to build MicroPython on Cygwin using a
standard Windows installation of Python so don't advertise that.
Specifically: preprocessing in makeqstrdefs.py fails on the subprocess
call with 'gcc: fatal error: no input files' because one of the flags
contains double quotes and that somehow messes up the commandline.
2021-09-10 15:19:25 +10:00
robert-hh 61b7c098b9 mimxrt/machine_bitstream: Add bitstream function to machine module.
Following the code example for ESP32 of Jim Mussard.

As a side effect:
- mp_hal_ticks_cpu() was implemented,
- mp_hal_get_cpu_freq() and mp_hal_ticks_cpu_init() were added and used.
- mp_hal_pin_high() and mp_hal_pin_low() were changed for symmetry
2021-09-10 13:32:53 +10:00
Philipp Ebensberger 87f97e490c mimxrt/sdcard: Implement SDCard driver.
- Configures `PLL2->PFD0` with **198MHz** as base clock of
	`USDHCx` peripheral.
- Adds guards for SDCard related files via `MICROPY_PY_MACHINE_SDCARD`
- Adds creation of pin defines for SDCard to make-pins.py
- Adds new configuration option for SDCard peripheral pinout
        to mpconfigport.h
- Adds interrupt handling support instead of polling
- Adds support for `ADMA2` powered data transfer
- Configures SDCard to run in HS (high-speed mode) with **50MHz** only!

SDCard support is optional and requires `USDHC` peripheral.
Thus this driver is not available on `MIMXRT1010_EVK`.
SDCard support is enabled by setting `MICROPY_PY_MACHINE_SDCARD = 1`
in mpconfigboard.mk.

Signed-off-by: Philipp Ebensberger
2021-09-07 20:45:33 +02:00
YoungJoon Chun bbbdef4cc1 rp2/mpconfigport.h: Enable heapq module.
Fixes issue #7746.
2021-09-04 23:51:14 +10:00
Damien George af64c2ddbd extmod/machine_pwm: Factor out machine.PWM bindings to common code.
This commit refactors machine.PWM and creates extmod/machine_pwm.c.  The
esp8266, esp32 and rp2 ports all use this and provide implementations of
the required PWM functionality.  This helps to reduce code duplication and
keep the same Python API across ports.

This commit does not make any functional changes.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-04 16:31:17 +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 1083cb2f33 zephyr/mphalport.h: Remove unused and unimplemented C-level pin API.
It gives compile warnings.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 13:11:23 +10:00
Damien George d41f6dde56 extmod/modonewire: Make _onewire module configurable via macro option.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 13:11:23 +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
Damien George 35ead0ff0f javascript/Makefile: Change variable to EXPORTED_RUNTIME_METHODS.
EXTRA_EXPORTED_RUNTIME_METHODS is deprecated.

Signed-off-by: Damien George <damien@micropython.org>
2021-09-01 00:42:40 +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
Patrick Van Oosterwijck a66bd7a489 esp32/boards: Add GENERIC_C3_USB board with USB serial/JTAG support.
Add a new board type for ESP32-C3 revision 3 and up that implement the USB
serial/JTAG port on pin 18 and 19.  This variant uses the USB serial for
programming and console, leaving the UART free.

- Pins 18 and 19 are correctly reserved for this variant.  Also pins 14-17
  are reserved for flash for any ESP32-C3 so they can't be reconfigured
  anymore to crash the system.
- Added usb_serial_jtag.c and .h to implement this interface.
- Interface was tested to work correctly together with webrepl.
- Interface was tested to work correctly when sending and receiving
  large files with ampy.
- Disconnecting terminal or USB will not hang the system when it's
  trying to print.
2021-08-31 00:12:41 +10:00
iabdalkader a3ce8f08ec rp2/mpconfigport.h: Allow boards to add root pointers. 2021-08-29 12:22:50 +10:00
iabdalkader 79baef843b rp2/CMakeLists.txt: Add option to enable double tap reset to bootrom.
* For boards a with reset switch, pressing twice resets into bootloader.
* Enabled by linking with the pico_bootsel_via_double_reset library.
2021-08-29 12:20:01 +10:00
iabdalkader c82244a7c0 rp2/rp2_flash: Disable IRQs while calling flash_erase/program.
Flash erase/program functions disable the XIP bit.  If any code runs from
flash at the same time (eg an IRQ or code it calls) it will fail and cause
a lockup.
2021-08-29 12:15:01 +10:00
Jim Mussared 996f703166 esp32,esp8266: Remove dead code for end_ticks in machine_bitstream.
The compiler was optimising this out already so it's a no-op change.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-24 23:55:08 +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 b352db7a63 rp2/Makefile: Add "submodules" target, to match other ports.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:54:57 +10:00
Jim Mussared 62fd450e62 drivers/neopixel: Add common machine.bitstream-based neopixel module.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +10:00
Jim Mussared 39e9c0788f esp8266: Replace esp.neopixel with machine.bitstream.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +10:00
Jim Mussared 71f4faac27 esp32: Replace esp.neopixel with machine.bitstream.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +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 0c2cadf1c8 unix/Makefile: Disable error compression on arm-linux-gnueabi-gcc.
This compiler is unable to optimise out the giant strcmp match generated
by MP_MATCH_COMPRESSED.

See github.com/micropython/micropython/pull/7659#issuecomment-899479793

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-17 11:20:58 +10:00
Damien George e25c5cb8d2 esp32/machine_pin: Make check for non-output pins respect chip variant.
Fixes issue #7631.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-16 15:24:05 +10:00
Jonathan Hogg 5b655665ab esp32/machine_hw_spi: Release GIL during transfers.
Release the GIL while waiting for SPI transfers to complete to allow other
threads to make progress.

Fixes #7662.
2021-08-16 15:21:10 +10:00
Philipp Ebensberger a1dc7277d9 mimxrt/machine_pin: Implement ioctl for Pin.
To make machine.Signal work correctly (among other things).  The solution
is taken over from the rp2 port.

Signed-off-by: Philipp Ebensberger
2021-08-16 15:03:50 +10:00
Jim Mussared 1d9e489af3 extmod/modbluetooth: Add send_update arg to gatts_write.
This allows the write to trigger a notification or indication, but only to
subscribed clients. This is different to gatts_notify/gatts_indicate,
which will unconditionally notify/indicate.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14 22:21:55 +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
Jim Mussared 692d36d779 py: Implement partial PEP-498 (f-string) support.
This implements (most of) the PEP-498 spec for f-strings and is based on
https://github.com/micropython/micropython/pull/4998 by @klardotsh.

It is implemented in the lexer as a syntax translation to `str.format`:
  f"{a}" --> "{}".format(a)

It also supports:
  f"{a=}" --> "a={}".format(a)

This is done by extracting the arguments into a temporary vstr buffer,
then after the string has been tokenized, the lexer input queue is saved
and the contents of the temporary vstr buffer are injected into the lexer
instead.

There are four main limitations:
- raw f-strings (`fr` or `rf` prefixes) are not supported and will raise
  `SyntaxError: raw f-strings are not supported`.

- literal concatenation of f-strings with adjacent strings will fail
    "{}" f"{a}" --> "{}{}".format(a)    (str.format will incorrectly use
                                         the braces from the non-f-string)
    f"{a}" f"{a}" --> "{}".format(a) "{}".format(a) (cannot concatenate)

- PEP-498 requires the full parser to understand the interpolated
  argument, however because this entirely runs in the lexer it cannot
  resolve nested braces in expressions like
    f"{'}'}"

- The !r, !s, and !a conversions are not supported.

Includes tests and cpydiffs.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14 16:58:40 +10:00
Daniel Mizyrycki 8f45f5ee4f nrf: Set .mpy features consistent with documentation and other ports.
This allows nrf devices to load .mpy files.  And nrf52840 and nrf9160 based
boards also support compiling and loading native code.
2021-08-13 23:22:54 +10:00
Ned Konz 42d1a1635c stm32/mbedtls: Fix compile warning about uninitialized val. 2021-08-10 23:43:25 +10:00