summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-10-28stm32/uart: Fix race conditions and clearing status in IRQ handler.Damien George
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-28esp32/boards/ESP32_S2_WROVER: Link to specific deploy_s2 instructions.Mike Causer
2021-10-28esp32/boards/LOLIN_S2_PICO: Add LOLIN_S2_PICO board definition files.Mike Causer
2021-10-28esp32/usb: Further improve speed of USB CDC output.Damien George
Following on from ba940250a5b630018c8d9b0e21c5ed858a20450f, the change here makes output about 15 times faster (now up to about 550 kbytes/sec). tinyusb_cdcacm_write_queue will return the number of bytes written, so there's no need to use tud_cdc_n_write_available. Signed-off-by: Damien George <damien@micropython.org>
2021-10-28esp32/boards: Update board and deploy metadata for UM_xxx boards.Seon Rozenblum
2021-10-28stm32/boards: Add images to board.json for Adafruit and VCC_GND boards.Mike Causer
2021-10-28esp32/boards/LOLIN_S2_MINI: Add image to board.json.Mike Causer
2021-10-28esp32: Add specific deploy_s2.md instructions for esp32-s2.Jim Mussared
In particular the UM S2 boards (and update the features list). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-27tools/autobuild: Add script to generate website board metadata.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-27ports: Add board.json for all boards.Jim Mussared
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-26extmod/nimble: Remove workaround for OS_ENOMEM.Jim Mussared
This was fixed in NimBLE 1.4. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-26extmod/nimble: Update to NimBLE v1.4.Jim Mussared
We're using the MicroPython fork of NimBLE, which on the `micropython_1_4_0` branch re-adds support for 64-bit targets and fixes initialisation of g_msys_pool_list. Also updates modbluetooth_nimble.c to suit v1.4. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-26lib/mynewt-nimble: Switch to the MicroPython fork of NimBLE.Jim Mussared
We will use this fork for adding further features and patches to support MicroPython. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-26extmod/modbluetooth: Add connection interval to gap_connect.Jim Mussared
This forwards through directly to the NimBLE and BTStack connect functions. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-25tools/ci.sh: Use a specific ESP IDF v4.4 commit.Damien George
There is no release of IDF v4.4 yet but master is now on v5.0-dev so a specific commit must be chosen to stick to v4.4. Signed-off-by: Damien George <damien@micropython.org>
2021-10-25mimxrt: Enable the platform module.robert-hh
2021-10-25mimxrt: Optimize the runtime speed.robert-hh
By moving code to ITCM, like vm, gc, parse, runtime. The change affects mostly the execution speed of MicroPython code. The speed is increased by up to a factor of 6, especially for MCU with small cache.
2021-10-25mimxrt/boards/make-pins.py: Allow empty lines and comments in pins.csv.robert-hh
2021-10-25mimxrt/modmachine: Implement soft_reset() and unique_id() functions.robert-hh
2021-10-25mimxrt/mpconfigport.h: Enable f-strings.robert-hh
2021-10-25tools/autobuild: Add the MIMXRT1010_EVK board to autobuild.robert-hh
Having a board now available for testing, this binary can be provided with good confidence.
2021-10-25mimxrt: Extend the help() message and README.md.robert-hh
2021-10-25mimxrt: Add dht_readinto() to the mimxrt module, and freeze dht.py.robert-hh
The change affects dht.py from the drivers directory as well to include the logic for the mimxrt port.
2021-10-25mimxrt: Fix cycle counter for time.ticks_cpu() and machine.bitstream().robert-hh
Prior to this commit mp_hal_ticks_cpu() was not started properly. It only started when the code was executed with a debugger attached, except for the Teensy (i.MXRT1062) boards. As an additional fix, the CYYCNT timer is now started at boot time. Also rename mp_hal_ticks_cpu_init() to mp_hal_ticks_cpu_enable().
2021-10-25mimxrt/dma_channel: Fix the DMA channel management.robert-hh
The MIMXRT1011 has only 16 channels, so size the channel list accordingly.
2021-10-25mimxrt/hal: Remove duplicate definitions from flexspi_hyper_flash.h.robert-hh
2021-10-25mimxrt/boards: Fix the D14/D15 pin assignment of MIMXRT1050/60/64_EVK.robert-hh
There are several PCB layouts in the market under the same name.
2021-10-25mimxrt/modmachine: Implement machine.WDT() and machine.reset_cause().robert-hh
The API follows that of rp2, stm32, esp32, and the docs. wdt=machine.WDT(0, timeout) Timeout is given in ms. The valid range is 500 to 128000 (128 seconds) with 500 ms granularity. Values outside of that range will be silently aligned. wdt.feed() Resets the watchdog timer (feeding). wdt.timeout_ms(value) Sets a new timeout and feeds the watchdog. This is a new, preliminary method which is not yet documented. reset_cause = machine.reset_cause() Values returned: 1 Power On reset 3 Watchdog reset 5 Software reset: state after calling machine.reset() More elaborate API functions are supported by the MCU, like an interrupt called a certain time after feeding. But for port cosistency that is not implemented.
2021-10-25mimxrt/eth: Add LAN support and integrate the network module.robert-hh
This commit implements 10/100 Mbit Ethernet support in the mimxrt port. The following boards are configured without ETH network: - MIMXRT1010_EVK - Teensy 4.0 The following boards are configured with ETH network: - MIMXRT1020_EVK - MIMXRT1050_EVK - MIMXRT1060_EVK - MIMXRT1064_EVK - Teensy 4.1 Ethernet support tested with TEENSY 4.1, MIMRTX1020_EVK and MIMXRT1050_EVK. Build tested with Teensy 4.0 and MIMXRT1010_EVK to be still working. Compiles and builds properly for MIMXRT1060_EVK and MIMXRT1064_EVK, but not tested lacking suitable boards. Tested functions are: - ping works bothway - simple UDP transfer works bothway - ntptime works - the ftp server works - secure socker works - telnet and webrepl works The MAC address is 0x02 plus 5 bytes from the manifacturing info field, which can be considered as unique per device. Some boards do not wire the RESET and INT pin of the PHY transceiver. For operation, these are not required. If they are defined, they will be used.
2021-10-22mimxrt/sdram: Add SDRAM support.Philipp Ebensberger
Adds support for SDRAM via `SEMC` peripheral. SDRAM support can be enabled in the mpconfigboard.mk file by setting `MICROPY_HW_SDRAM_AVAIL` to `1` and poviding the size of the RAM via `MICROPY_HW_FLASH_SIZE`. When SDRAM support is enabled the whole SDRAM is currently used used for MicroPython heap. Signed-off-by: Philipp Ebensberger
2021-10-21github/workflows: Use Python 3.8 for macos workflow.Damien George
Otherwise it gets a more recent version which fails some of the test suite. Signed-off-by: Damien George <damien@micropython.org>
2021-10-21tests/basics: Add tests for type-checking subclassed exc instances.Mike Wadsten
2021-10-21py/runtime: Fix crash when exc __new__ doesn't return an exc instance.Mike Wadsten
See CPython bug https://bugs.python.org/issue39091 for more details.
2021-10-20stm32/pendsv: Allow a board to add entries for pendsv_schedule_dispatch.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-10-20stm32/mpbthciport: Allow a board to hook BT HCI poll functions.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-10-20stm32/usbd_cdc_interface: Allow a board to hook into USBD CDC RX events.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-10-19unix/modusocket: Support MP_STREAM_POLL in unix socket_ioctl.Andrew Leech
Allows asyncio reading of network sockets when MICROPY_PY_USELECT is used in the build configuration.
2021-10-19extmod/vfs_posix_file: Support MP_STREAM_POLL in vfs_posix_file_ioctl.Andrew Leech
Allows asyncio reading of sys.stdin when MICROPY_PY_USELECT is used in the build configuration.
2021-10-16esp32/usb: Improve speed of USB CDC output.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-10-16esp32: Enable optimisations and move code to iRAM to boost performance.Damien George
This commit enables some significant optimisations for esp32: - move the VM to iRAM - move hot parts of the runtime to iRAM (map lookup, load global/name, mp_obj_get_type) - enable MICROPY_OPT_LOAD_ATTR_FAST_PATH - enable MICROPY_OPT_MAP_LOOKUP_CACHE - disable assertions - change from -Os to -O2 for compilation It's hard to measure performance on esp32 due to external flash and hardware caching. But this set of changes improves performance compared to master by (on a TinyPICO with the GENERIC build, using IDF 4.2.2, running at 160MHz): diff of scores (higher is better) N=100 M=100 esp32-master -> esp32-perf diff diff% (error%) bm_chaos.py 71.28 -> 268.08 : +196.80 = +276.094% (+/-0.04%) bm_fannkuch.py 44.10 -> 69.31 : +25.21 = +57.166% (+/-0.01%) bm_fft.py 1385.27 -> 2538.23 : +1152.96 = +83.230% (+/-0.01%) bm_float.py 1060.94 -> 3900.62 : +2839.68 = +267.657% (+/-0.03%) bm_hexiom.py 10.90 -> 32.79 : +21.89 = +200.826% (+/-0.02%) bm_nqueens.py 1000.83 -> 2372.87 : +1372.04 = +137.090% (+/-0.01%) bm_pidigits.py 288.13 -> 664.40 : +376.27 = +130.590% (+/-0.46%) misc_aes.py 102.45 -> 345.69 : +243.24 = +237.423% (+/-0.01%) misc_mandel.py 1016.58 -> 2121.92 : +1105.34 = +108.731% (+/-0.01%) misc_pystone.py 632.91 -> 1801.87 : +1168.96 = +184.696% (+/-0.08%) misc_raytrace.py 76.66 -> 281.78 : +205.12 = +267.571% (+/-0.05%) viper_call0.py 210.63 -> 273.17 : +62.54 = +29.692% (+/-0.01%) viper_call1a.py 208.45 -> 269.51 : +61.06 = +29.292% (+/-0.00%) viper_call1b.py 185.44 -> 228.25 : +42.81 = +23.086% (+/-0.01%) viper_call1c.py 185.86 -> 228.90 : +43.04 = +23.157% (+/-0.01%) viper_call2a.py 207.10 -> 267.25 : +60.15 = +29.044% (+/-0.00%) viper_call2b.py 173.76 -> 209.42 : +35.66 = +20.523% (+/-0.00%) Five tests have more than 3x speed up (200%+). The performance of the tests bm_fft, bm_pidigits and misc_aes now scale with CPU frequency (eg changing frequency to 240MHz boosts the performance of these by 50%), which means they are no longer influenced by timing of external flash access. (The viper_call* tests did previously scale with CPU frequency, and they still do.) Turning off assertions reduces code size by about 80k, and going from -Os to -O2 costs about 100k, so the net change in code size (for the GENERIC board) is about +20k. If a board wants to enable assertions, or use -Os instead of -O2, that's still possible by overriding the sdkconfig parameters. Signed-off-by: Damien George <damien@micropython.org>
2021-10-15py: Add wrapper macros so hot VM functions can go in fast code location.Damien George
For example, on esp32 they can go in iRAM to improve performance. Signed-off-by: Damien George <damien@micropython.org>
2021-10-15stm32/sdram: Enforce gcc opt, and use volatile and DSB in sdram_test.iabdalkader
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-14docs/esp32/tutorial: Add an example of peripheral control via regs.NitiKaur
2021-10-14docs/library/stm.rst: Document the stm module.NitiKaur
2021-10-14docs/reference/manifest.rst: Add docs for manifest.py files.NitiKaur
2021-10-14docs/reference/mpremote.rst: Add docs for mpremote.NitiKaur
2021-10-13docs/library/random.rst: Document the random module.NitiKaur
2021-10-13docs/rp2: Add reference for PIO assembly instructions, and PIO tutorial.NitiKaur
2021-09-24extmod/moduplatform: Improve implementation for PC ports.stijn
Fix identification of 32/64 bit and of the Windows platform and add a platform string mimicking CPython for the latter.
2021-09-24py/builtinimport: Forward all debug printing to MICROPY_DEBUG_PRINTER.stijn