summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-09-19extmod/nimble: Add nimble CMake fragment file.iabdalkader
2021-09-19extmod/mpbthci.h: Add mp_bluetooth_hci_uart_any prototype.iabdalkader
This allows drivers to use mpbthciport functions to read/write/poll UART.
2021-09-19stm32/boards: Add OLIMEX H407 board definition.Chris Fiege
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-19esp32/boards: Add board definition for ESP32-S2-WROVER module.patrick
2021-09-19esp32/machine_hw_spi: Fix hardware SPI DMA channels for S2/S3.Seon Rozenblum
2021-09-16tools/ci.sh: Use IDF v4.4 as part of esp32 CI and build GENERIC_S3.Damien George
IDF v4.4 does not have an official release so for now use the latest master. Also remove building GENERIC with no options (all the other boards are no-option builds), to keep CI time reasonable. Signed-off-by: Damien George <damien@micropython.org>
2021-09-16esp32/boards: Add new GENERIC_S3 board definition.Damien George
Thanks to Seon Rozenblum aka @UnexpectedMaker for the work. Signed-off-by: Damien George <damien@micropython.org>
2021-09-16esp32: Add support for ESP32-S3 SoCs.Damien George
Thanks to Seon Rozenblum aka @UnexpectedMaker for the work. Signed-off-by: Damien George <damien@micropython.org>
2021-09-16all: Remove MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE.Jim Mussared
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-16unix: Enable LOAD_ATTR fast path, and map lookup caching.Jim Mussared
Enabled for all variants except minimal. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16stm32: Enable LOAD_ATTR fast path, and map lookup caching on >M0.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16py/map: Add an optional cache of (map+index) to speed up map lookups.Jim Mussared
The existing inline bytecode caching optimisation, selected by MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE, reserves an extra byte in the bytecode after certain opcodes, which at runtime stores a map index of the likely location of this field when looking up the qstr. This scheme is incompatible with bytecode-in-ROM, and doesn't work with native generated code. It also stores bytecode in .mpy files which is of a different format to when the feature is disabled, making generation of .mpy files more complex. This commit provides an alternative optimisation via an approach that adds a global cache for map offsets, then all mp_map_lookup operations use it. It's less precise than bytecode caching, but allows the cache to be independent and external to the bytecode that is executing. It also works for the native emitter and adds a similar performance boost on top of the gain already provided by the native emitter. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16py/vm: Add a fast path for LOAD_ATTR on instance types.Jim Mussared
When the LOAD_ATTR opcode is executed there are quite a few different cases that have to be handled, but the common case is accessing a member on an instance type. Typically, built-in types provide methods which is why this is common. Fortunately, for this specific case, if the member is found in the member map then there's no further processing. This optimisation does a relatively cheap check (type is instance) and then forwards directly to the member map lookup, falling back to the regular path if necessary. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16minimal/mpconfigport.h: Use MICROPY_CONFIG_ROM_LEVEL_MINIMUM.Jim Mussared
Update minimal port to use the new "minimal" rom level config (this is a no-op change, the binary is the same size and contains the exact same symbols). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16py/mpconfig.h: Define initial templates for "feature levels".Jim Mussared
This is the beginning of a set of changes to simplify enabling/disabling features. The goals are: - Remove redundancy from mpconfigport.h (never set a value to the default -- make it clear exactly what's being enabled). - Improve consistency between ports. All "similar" ports (i.e. approx same flash size) should get the same features. - Simplify mpconfigport.h -- just get default/sensible options for the size of the port. - Make it easy for defining constrained boards (e.g. STM32F0/L0), they can just set a lower level. This commit makes a step towards this and defines the "core" level as the current default feature set, and a "minimal" level to turn off everything. And a few placeholder levels are added for where the other ports will roughly land. This is a no-op change for all ports. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16stm32/dma: Add functions for external users of DMA to enable clock.Damien George
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-16stm32/boards/make-pins.py: Allow empty lines and comments in pins.csv.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-09-16stm32/boards/make-pins.py: Allow a CPU pin to be hidden.Damien George
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-16stm32: Suggest putting code in main.py not boot.py.Jim Mussared
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-16stm32: Add support for H7A3(Q)/H7B3(Q), and STM32H73B3I_DK board defn.Jan Staal
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-15extmod/modnetwork: Remove modnetwork socket u_state member.iabdalkader
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-15extmod/modnetwork: Remove STM32 references.iabdalkader
2021-09-15stm32: Add basic support for STM32H750.Jan Hrudka
2021-09-15extmod/network_cyw43: Make consistent use of STA and AP constants.Damien George
The network.STA_IF and network.AP_IF constants are now independent to the CYW43_ITF_STA and CYW43_ITF_AP constants. Signed-off-by: Damien George <damien@micropython.org>
2021-09-15extmod/modnetwork: Define network interfaces in port config files.iabdalkader
So this network implementation becomes more generic.
2021-09-15extmod/modusocket: Add read/write stream methods to socket object.iabdalkader
Following other socket implementations.
2021-09-15extmod/modnetwork: Add extended socket state.iabdalkader
2021-09-15extmod/modnetwork: Add STA_IF and AP_IF constants.iabdalkader
2021-09-15extmod: Move modnetwork and modusocket from stm32 to extmod.iabdalkader
So they can be used by other ports.
2021-09-14mimxrt: Rework flash configuration.Philipp Ebensberger
- 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-13py/emitnative: Ensure load_subscr does not clobber existing REG_RET.Damien George
Fixes issue #7782, and part of issue #6314. Signed-off-by: Damien George <damien@micropython.org>
2021-09-13tests/perf_bench: Use math.log instead of math.log2.Damien George
So MICROPY_PY_MATH_SPECIAL_FUNCTIONS is not needed for these performance tests. Signed-off-by: Damien George <damien@micropython.org>
2021-09-13esp32/machine_timer: Use tx_update member for IDF 4.4 and above.Seon Rozenblum
2021-09-13docs/library/machine.I2S.rst: Specify that I2S.shift args are kw-only.Peter Hinch
2021-09-13docs/make.bat: Change Windows output dir from '_build' to 'build'.Ihor Nehrutsa
To match the output file used by Makefile.
2021-09-10stm32/boards: Remove trailing spaces, and add newline at end of file.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-09-10stm32/boards/LEGO_HUB_NO6: Remove user paths from cc2564 init file.Tobias Thyrrestrup
Signed-off-by: Tobias Thyrrestrup <tt@LEGO.com>
2021-09-10stm32/boards/OLIMEX_E407: Add Ethernet RMII support.Daniel Gorny
2021-09-10stm32/boards/VCC_GND_H743VI: Add board definition for VCC_GND_H743VI.Boris Vinogradov
2021-09-10tools/autobuild: Add auto build for GENERIC_C3_USB.Patrick Van Oosterwijck
2021-09-10esp32/boards: Add new FeatherS2-Neo board definition.Seon Rozenblum
2021-09-10docs/library/bluetooth.rst: Update incorrect link to gatts_write.Matt Trentini
2021-09-10docs/library/os.rst: Clarify littlefs requirements for block erase.Peter Hinch
2021-09-10windows/README: Remove unsupported Python instructions for Cygwin.stijn
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-10py/parse: Simplify parse nodes representing a list.Damien George
This commit simplifies and optimises the parse tree in-memory representation of lists of expressions, for tuples and lists, and when tuples are used on the left-hand-side of assignments and within del statements. This reduces memory usage of the parse tree when such code is compiled, and also reduces the size of the compiler. For example, (1,) was previously the following parse tree: expr_stmt(5) (n=2) atom_paren(45) (n=1) testlist_comp(146) (n=2) int(1) testlist_comp_3b(149) (n=1) NULL NULL and with this commit is now: expr_stmt(5) (n=2) atom_paren(45) (n=1) testlist_comp(146) (n=1) int(1) NULL Similarly, (1, 2, 3) was previously: expr_stmt(5) (n=2) atom_paren(45) (n=1) testlist_comp(146) (n=2) int(1) testlist_comp_3c(150) (n=2) int(2) int(3) NULL and is now: expr_stmt(5) (n=2) atom_paren(45) (n=1) testlist_comp(146) (n=3) int(1) int(2) int(3) NULL Signed-off-by: Damien George <damien@micropython.org>
2021-09-10mimxrt/machine_bitstream: Add bitstream function to machine module.robert-hh
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-07mimxrt/sdcard: Implement SDCard driver.Philipp Ebensberger
- 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-04rp2/mpconfigport.h: Enable heapq module.YoungJoon Chun
Fixes issue #7746.
2021-09-04extmod/machine_pwm: Factor out machine.PWM bindings to common code.Damien George
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-02stm32/main: Don't unconditionally enable GPIO A,B,C,D clocks.Damien George
Rely on them being enabled only when needed. Signed-off-by: Damien George <damien@micropython.org>