aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-04-27Add OpenMano boardHEADmasterAditya Naik
Added board hardware configuration to micropython ports/stm32/boards directory.
2021-04-28stm32/uart: Fix H7 UART clock source configuration.iabdalkader
Previously to this commit, Usart16ClockSelection was overwritten and Usart234578ClockSelection was not set.
2021-04-28stm32,teensy: Correct typos in project README files.plan-do-break-fix
2021-04-28pic16bit/Makefile: Make the XC compiler version user-configurable.Daniel Maslowski
2021-04-28py/dynruntime.h: Add mp_obj_get_array() function.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-27bare-arm: Switch to use MICROPY_ERROR_REPORTING_NONE to reduce size.Damien George
Reduces size of this port by about 3300 bytes, and demonstrates how to use this feature. Signed-off-by: Damien George <damien@micropython.org>
2021-04-27py: Add option to compile without any error messages at all.Damien George
This introduces a new option, MICROPY_ERROR_REPORTING_NONE, which completely disables all error messages. To be used in cases where MicroPython needs to fit in very limited systems. Signed-off-by: Damien George <damien@micropython.org>
2021-04-27top: Update .git-blame-ignore-revs for latest formatting commit.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-27tools/gen-cpydiff.py: Fix formatting of doc strings for new Black.iabdalkader
Since version 21.4b0, Black now processes one-line docstrings by stripping leading and trailing spaces, and adding a padding space when needed to break up """"; see https://github.com/psf/black/pull/1740 This commit makes the Python code in this repository conform to this rule.
2021-04-27teensy: Provide own implementation of gc_collect, to not use stm32.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-24lib/utils: Remove unused PYEXEC_SWITCH_MODE from pyexec.h.Damien George
It was made obsolete by commit c98c128fe885e539ecd73843756340f8950115c8. Signed-off-by: Damien George <damien@micropython.org>
2021-04-23drivers/sdcard: Add sleep_ms(1) delay in SDCard.readinto sync loop.Damien George
So this driver works on faster MCUs (that run this loop fast) with older, slower SD cards. Fixes issue #7129. Signed-off-by: Damien George <damien@micropython.org>
2021-04-23windows/mpconfigport.h: Enable features also present in unix port.stijn
2021-04-23esp32/CMakeLists.txt: Require CMake version 3.12.Damien George
Because "find_package(Python3 ...)" requires at least this version of CMake. And other features like GREATER_EQUAL and COMMAND_EXPAND_LISTS need at least CMake 3.7 and 3.8 respectively. Signed-off-by: Damien George <damien@micropython.org>
2021-04-23tools/pyboard.py: Support opening serial port in exclusive mode.Damien George
This is now the default, but can be overridden with CLI `--no-exclusive`, or constructing `Pyboard(..., exclusive=False)`. Signed-off-by: Damien George <damien@micropython.org>
2021-04-23tests: Use .errno instead of .args[0] for OSError exceptions.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-23extmod/uasyncio: Use .errno instead of .args[0] for OSError exceptions.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-23tools/upip.py: Use .errno instead of .args[0] for OSError exceptions.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-23py/objexcept: Support errno attribute on OSError exceptions.Damien George
This commit adds the errno attribute to exceptions, so code can retrieve errno codes from an OSError using exc.errno. The implementation here simply lets `errno` (and the existing `value`) attributes work on any exception instance (they both alias args[0]). This is for efficiency and to keep code size down. The pros and cons of this are: Pros: - more compatible with CPython, less difference to document and learn - OSError().errno will correctly return None, whereas the current way of doing it via OSError().args[0] will raise an IndexError - it reduces code size on most bare-metal ports (because they already have the errno qstr) - for Python code that uses exc.errno the generated bytecode is 2 bytes smaller and more efficient to execute (compared with exc.args[0]); so bytecode loaded to RAM saves 2 bytes RAM for each use of this attribute, and bytecode that is frozen saves 2 bytes flash/ROM for each use - it's easier/shorter to type, and saves 2 bytes of space in .py files that use it (for each use) Cons: - increases code size by 4-8 bytes on minimal ports that don't already have the `errno` qstr - all exceptions now have .errno and .value attributes (a cpydiff test is added to address this) See also #2407. Signed-off-by: Damien George <damien@micropython.org>
2021-04-23stm32/mboot: Allow unpacking dfu without secret key.David Michieli
- unpack-dfu command no longer requies a secret key to be present - pack-dfu command raises an exception if no secret key is found
2021-04-21stm32/machine_timer: Improve usability of Timer constructor and init.Damien George
Improvements are: - Default period is 1000ms with callback disabled. - if period is not specified then it's not updated (previously, if period was not specified then it was set to -1 and running the timer callback as fast as possible, making the REPL unresponsive). - Use uint64_t to compute delta_ms, and raise a ValueError if the period is too large. - If callback is not specified then it's not updated. - Specifying None for the callback will disable the timer. Signed-off-by: Damien George <damien@micropython.org>
2021-04-20stm32/boards/pllvalues.py: Support wider range of PLL values for F413.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-20tools/metrics.py: Add rp2 port to table of ports that can be built.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-19all: Bump version to 1.15.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-18tests/net_inet: Add 'Strict-Transport-Security' to exp file.Damien George
Because micropython.org now adds this to the headers. Signed-off-by: Damien George <damien@micropython.org>
2021-04-17rp2/rp2_pio: Add fifo_join support for PIO.Tim Radvan
The PIO state machines on the RP2040 have 4 word deep TX and RX FIFOs. If you only need one direction, you can "merge" them into either a single 8 word deep TX or RX FIFO. We simply add constants to the PIO object, and set the appropriate bits in `shiftctrl`. Resolves #6854. Signed-off-by: Tim Radvan <tim@tjvr.org>
2021-04-15esp32/machine_pin: Use rtc_gpio_deinit instead of gpio_reset_pin.Damien George
Commit 8a917ad2529ea3df5f47e2be5b4edf362d2d03f6 added the gpio_reset_pin() call to make sure that pins that were used as ADC inputs could subsequently be used as digital IO. But calling gpio_reset_pin() will enable the pull-up on the pin and so pull it high for a brief period. Instead use rtc_gpio_deinit() which will just reconfigure the pin as a digital IO and do nothing else. Fixes issue #7079 (see also #5771). Signed-off-by: Damien George <damien@micropython.org>
2021-04-15tools/ci.sh: Build esp32 using IDF v4.0.2 and v4.3.Damien George
To test different IDF's, and also test building the GENERIC_S2 board. Signed-off-by: Damien George <damien@micropython.org>
2021-04-15esp32/boards: Add GENERIC_S2 board definition.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-15esp32: Add support for USB with CDC ACM.Damien George
The REPL will be available on the USB serial port. Signed-off-by: Damien George <damien@micropython.org>
2021-04-15esp32: Add initial support for ESP32S2 SoCs.Damien George
Builds against IDF v4.3-beta2. Signed-off-by: Damien George <damien@micropython.org>
2021-04-15tests/feature_check: Check for lack of pass result rather than failure.Damien George
Commit cb68a5741aba5d4935428674234a9d643f97405f broke automatic Python feature detection when running tests, because some detection relied on a crash of a feature script returning exactly b"CRASH". This commit fixes this and improves the situation by testing for the lack of a known pass result, rather than an exact failure result. Signed-off-by: Damien George <damien@micropython.org>
2021-04-14esp32/modsocket: Correctly handle poll/read of unconnected TCP socket.Damien George
For an unconnected TCP socket, poll should return WR|HUP and read should raise ENOTCONN. This is implemented by this commit and now the following tests pass on esp32: extmod/usocket_tcp_basic.py, net_hosted/connect_poll.py. Signed-off-by: Damien George <damien@micropython.org>
2021-04-14mimxrt: Enable CPYTHON_COMPAT, PY_ASYNC_AWAIT, PY_ATTRTUPLE options.Damien George
This change allows running the tests in tests/basics/ without any failures (but some tests are still skipped). Signed-off-by: Damien George <damien@micropython.org>
2021-04-14stm32/sdram: Make MICROPY_HW_FMC_BA1,MICROPY_HW_FMC_A11 optional pins.8bitgeek
This supports SDRAM having only 2 internal banks (using BA0 only), and only 11 (A0-A10) bits of address, such as IS42S16100H (512K x 16bit x 2bank).
2021-04-14unix/main: Make static variable that's potentially clobbered by longjmp.Marian Buschsieweke
This fixes `error: variable 'subpkg_tried' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered]` when compiling on ppc64le and aarch64 (and possibly other architectures/toolchains).
2021-04-13stm32/uart: Use LL_USART_GetBaudRate to compute baudrate.Damien George
This function includes the UART prescaler in the calculation (if it has one, eg on H7 and WB MCUs). Signed-off-by: Damien George <damien@micropython.org>
2021-04-13stm32/boards: Split UARTx_RTS_DE into UARTx_RTS/UARTx_DE in pin defs.Damien George
So these alternate functions can be parsed by the build scripts and used in application code. Signed-off-by: Damien George <damien@micropython.org>
2021-04-12py/runtime: Make sys.modules preallocate to a configurable size.matejcik
This allows configuring the pre-allocated size of sys.modules dict, in order to prevent unwanted reallocations at run-time (3 sys-modules is really not quite enough for a larger project).
2021-04-12py/profile: Resolve name collision with STATIC unset.matejcik
When building with STATIC undefined (e.g., -DSTATIC=), there are two instances of mp_type_code that collide at link time: in profile.c and in builtinevex.c. This patch resolves the collision by renaming one of them.
2021-04-12stm32/rfcore: Intercept addr-resolution HCI cmd to work around BLE bug.Damien George
The STM32WB has a problem when address resolution is enabled: under certain conditions the MCU can get into a state where it draws an additional 10mA or so and eventually ends up with a broken BLE RX path in the silicon. A simple way to reproduce this is to enable address resolution (which is the default for NimBLE) and start the device advertising. If there is enough BLE activity in the vicinity then the device will at some point enter the bad state and, if left long enough, will have permanent BLE RX damage. STMicroelectronics are aware of this issue. The only known workaround at this stage is to not enable address resolution, which is implemented by this commit. Work done in collaboration with Jim Mussared aka @jimmo. Signed-off-by: Damien George <damien@micropython.org>
2021-04-12stm32/rfcore: Fix race condition with C2 accessing free buffer list.Damien George
Prior to this commit, if C2 was busy (eg lots of BLE activity) then it may not have had time to respond to the notification on the IPCC_CH_MM channel by the time additional memory was available to put on that buffer. In such a case C1 would modify the free buffer list while C2 was potentially accessing it, and this would eventually lead to lost memory buffers (or a corrupt linked list). If all buffers become lost then ACL packets (asynchronous events) can no longer be delivered from C2 to C1. This commit fixes this issue by waiting for C2 to indicate that it has finished using the free buffer list. Work done in collaboration with Jim Mussared aka @jimmo. Signed-off-by: Damien George <damien@micropython.org>
2021-04-12rp2: Add support for building different board configurations.jahr
This change allows to build firmware for different rp2-based boards, following how it is done in other ports like stm32 and esp32. So far only the original Pico and Adafruit Feather RP2040 are added. Board names should match (sans case) those in pico-sdk/src/boards/include/boards/. Usage: Pico firmware can be build either using make as previously (it is the default board) or by `make BOARD=PICO`. Feather is built by `make BOARD=ADAFRUIT_FEATHER_RP2040`. Only the board name and flash drive size is set, pin definition is taken from the appropriate pico-sdk board definition. Firmware is saved in the directory build-BOARD_NAME.
2021-04-12rp2/machine_uart: Add buffered transfer of data with rxbuf/txbuf kwargs.robert-hh
Instantiation and init now support the rxbuf and txbuf keywords for setting the buffer size. The default size is 256 bytes. The minimum and maximum sizes are 32 and 32766 respectively. uart.write() still includes checks for timeout, even if it is very unlikely to happen due to a) lack of flow control support and b) the minimal timeout values being longer than the time it needs to send a byte.
2021-04-11rp2/rp2_pio: Add StateMachine restart,rx_fifo,tx_fifo helper functions.robert-hh
StateMachine.restart: Restarts the state machine StateMachine.rx_fifo: Return the number of RX FIFO items, 0 if empty StateMachine.tx_fifo: Return the number of TX FIFO items, 0 if empty restart() seems to be the most useful one, as it resets the state machine to the initial state without the need to re-initialise/re-create. It also makes PIO code easier, because then stalling as an error state can be unlocked. rx_fifo() is also useful, for MP code to check for data and timeout if no data arrived. Complex logic is easier handled in Python code than in PIO code. tx_fifo() can be useful to check states where data is not processed, and is mostly for symmetry.
2021-04-09rp2/moduos: Implement uos.urandom().robert-hh
The implementation samples rosc.randombits at a frequency lower than the oscillator frequency. This gives better random values. In addition, for an 8-bit value 8 samples are taken and fed through a 8-bit CRC, distributing the sampling over the byte. The resulting sampling rate is about 120k/sec. The RNG does not include testing of error conditions, like the ROSC being in sync with the sampling or completely failing. Making the interim value static causes it to perform a little bit better in short sync or drop-out situations. The output of uos.urandom() performs well with the NIST800-22 test suite. In my trial it passed all tests of the sts 2.1.2 test suite. I also ran a test of the random data with the Common Criteria test suite AIS 31, and it passed all tests too.
2021-04-09rp2/rp2_pio: Validate state machine frequency in constructor.Damien George
Fixes issue #7025. Signed-off-by: Damien George <damien@micropython.org>
2021-04-09examples/embedding: Fix example so it compiles again.Santeri Paavolainen
There were a few changes that had broken this example, specifically 2cdf1d25f59409b6130c0e8b6cf50300aed2d7e6 removed file.c from ports/unix. And (at least for MacOS) mp_state_ctx must be placed in the BSS with -fno-common so it is visible to the linker. Signed-off-by: Santeri Paavolainen <santtu@iki.fi>
2021-04-09stm32/boards/NUCLEO_L476RG: Add 5 remaining UARTs.aziubin
STM32L476RG MCU of NUCLEO_L476RG board has 6 UART/USART units in total (USART1, USART2, USART3, UART4, UART5 and LPUART1), but only UART2, connected to REPL, was defined and available in Python code. Defined are all 5 remaining UART/USART units including LPUART1. Signed-off-by: Alexander Ziubin aziubin@googlemail.com
2021-04-09esp32: Enable btree module.Damien George
This was disabled with the move to CMake, and this commit reinstates it. Signed-off-by: Damien George <damien@micropython.org>