summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-09-24esp32/main: Add option for a board to hook code into startup sequence.Damien George
To do this the board must define MICROPY_BOARD_STARTUP, set MICROPY_SOURCE_BOARD then define the new start-up code. For example, in mpconfigboard.h: #define MICROPY_BOARD_STARTUP board_startup void board_startup(void); in mpconfigboard.cmake: set(MICROPY_SOURCE_BOARD ${MICROPY_BOARD_DIR}/board.c ) and in a new board.c file in the board directory: #include "py/mpconfig.h" void board_startup(void) { boardctrl_startup(); // extra custom startup } This follows stm32's boardctrl facilities. Signed-off-by: Damien George <damien@micropython.org>
2021-09-24esp32/mpthreadport: Fix TCB cleanup function so thread_mutex is ready.leo chung
Because vPortCleanUpTCB is called by the FreeRTOS idle task, and it checks thread, but didn't check the thread_mutex. And if thread is not NULL, but thread_mutex not ready then it will crash with an error when calling mp_thread_mutex_lock(&thread_mutex, 1). As suggested by @dpgeorge, move the thread = &thread_entry0 line to the end of mp_thread_init(). Signed-off-by: leo chung <gewalalb@gmail.com>
2021-09-24esp32/machine_pin: Block out IO16 and IO17 when using SPIRAM on ESP32.Seon Rozenblum
Fixes issue #7819.
2021-09-22esp32/usb: Add USB host connection detection for CDC serial output.Seon Rozenblum
This callback allows detecting if there is a USB host connected to the CDC or not, in which case the stdout_tx should skip CDC TX writing and flushing or the system will block. Fixes issue #7820.
2021-09-22esp32/README: Updated readme with req IDF vers for ESP32-S2, C3 and S3.Seon Rozenblum
2021-09-21docs/esp32: Explain ESP32 PWM modes, timers, and channels.IhorNehrutsa
2021-09-21esp32/machine_pwm: Add support for all PWM timers and channels.IhorNehrutsa
This commit allows using all the available PWM timers (up to 8) and channels (up to 16), without affecting the PWM API. If a new frequency is set, first it checks if another timer is using the same frequency. If yes, then it uses this timer, otherwise, it creates a new one. If all timers are used, the user should set an already used frequency, or de-init a channel. This work is based on #6276 and #3608.
2021-09-21esp32/boards: Add LOLIN_S2_MINI ESP32-S2 board.Stewart Bonnick
To support Lolin S2 Mini ESP32-S2 Variant board. More information about this board can be found at https://www.wemos.cc/en/latest/s2/s2_mini.html
2021-09-21stm32/machine_i2c: Use hardware I2C for STM32H7.iabdalkader
2021-09-21stm32/boards: Add PF11-BOOT0 to stm32f091_af.csv.roland van straten
PF11 is added so it can be used as GPIO.
2021-09-21stm32/boards/NUCLEO_H743ZI: Enable VfsLfs2 on NUCLEO_H743ZI(2) boards.Ned Konz
2021-09-21stm32: Extended flash filesystem space to 512K on H743 boards.Ned Konz
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-19stm32: Enable platform module.iabdalkader
The HAL version is based on the stm32lib version.
2021-09-19extmod: Add platform module.iabdalkader
It contains the compiler version, and underlying system HAL/SDK version.
2021-09-19rp2: Add framework for networking.iabdalkader
MICROPY_PY_NETWORK and MICROPY_PY_USOCKET need to be enabled by a board to get networking. No NICs have yet been defined.
2021-09-19rp2: Add support for bluetooth module using NimBLE.iabdalkader
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