aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-05-03tests/basics/sys1.py: Add test for calling sys.exit() without any args.Damien George
2019-05-03py/native: Improve support for bool type in viper functions.Damien George
Variables with type bool now act more like an int, and there is proper casting to/from Python objects.
2019-05-02nrf/boards: Add support for BLYST Nano module based boards.Nguyen Hoan Hoang
- IBK-BLYST-NANO: Breakout board - IDK-BLYST-NANO: DevKit board with builtin IDAP-M CMSIS-DAP Debug JTAG, RGB led - BLUEIO-TAG-EVIM: Sensor tag board (environmental sensor (T, H, P, Air quality) + 9 axis motion sensor) Also, the LED module has been updated to support individual base level configuration of each LED. If set, this will be used instead of the common configuration, MICROPY_HW_LED_PULLUP. The new configuration, MICROPY_HW_LEDX_LEVEL, where X is the LED number can be used to set the base level of the specific LED.
2019-05-02stm32/boards: Add NUCLEO_F413ZH board configuration.Chris Mason
The alternate function pin allocations are different to other NUCLEO-144 boards. This is because the STM32F413 has a very high peripheral count: 10x UART, 5x SPI, 3x I2C, 3x CAN. The pinout was chosen to expose all these devices on separate pins except CAN3 which shares a pin with UART1 and SPI1 which shares pins with DAC.
2019-05-02stm32: Add support for F413 MCUs.Chris Mason
Includes: - Support for CAN3. - Support for UART9 and UART10. - stm32f413xg.ld and stm32f413xh.ld linker scripts. - stm32f413_af.csv alternate function mapping. - startup_stm32f413xx.s because F413 has different interrupt vector table. - Memory configuration with: 240K filesystem, 240K heap, 16K stack.
2019-05-02stm32/flash: Fix bug computing page number for L432 page erase.Damien George
2019-05-02stm32/powerctrl: Support changing frequency when HSI is clock source.Damien George
This patch makes pllvalues.py generate two tables: one for when HSI is used and one for when HSE is used. The correct table is then selected at compile time via the existing MICROPY_HW_CLK_USE_HSI.
2019-05-01mpy-cross: Automatically select ARMV6 arch when running on such a host.Damien George
2019-05-01py/asmthumb: Support asm_thumb code running on normal ARM processors.Damien George
With this change, @micropython.asm_thumb functions will work on standard ARM processors (that are in ARM state by default), in scripts and precompiled .mpy files. Addresses issue #4675.
2019-05-01unix/gcollect: Make sure stack/regs get captured properly for GC.stijn
When building with link time optimization enabled it is possible both gc_collect() and gc_collect_regs_and_stack() get inlined into gc_alloc() which can result in the regs variable being pushed on the stack earlier than some of the registers. Depending on the calling convention, those registers might however contain pointers to blocks which have just been allocated in the caller of gc_alloc(). Then those pointers end up higher on the stack than regs, aren't marked by gc_collect_root() and hence get sweeped, even though they're still in use. As reported in #4652 this happened for in 32-bit msvc release builds: mp_lexer_new() does two consecutive allocations and the latter triggered a gc_collect() which would sweep the memory of the first allocation again.
2019-05-01stm32/main: Increase default UART REPL rx buffer from 64 to 260 bytes.Damien George
This allows the UART to buffer at least 256 bytes (taking into account the extra byte needed by the ring buffer, and word alignment).
2019-05-01stm32/usb: Remove mp_hal_set_interrupt_char now that it's reset at boot.Damien George
2019-05-01lib/utils/interrupt_char: Invalidate interrupt char at start up.Damien George
Otherwise mp_interrupt_char will have a value of zero on start up (because it's in the BSS) and a KeyboardInterrupt may be raised during start up. For example this can occur if there is a UART attached to the REPL which sends spurious null bytes when the device turns on.
2019-05-01lib/utils: Make pyexec_file_if_exists run frozen scripts if they exist.Andrew Leech
So that boot.py and/or main.py can be frozen (either as STR or MPY) in the same way that other scripts are frozen. Frozen scripts have preference to scripts in the VFS.
2019-04-30tests/ussl_basic: Disable setblocking() calls.Paul Sokolovsky
Now that setblocking() is implemented in modussl_axtls, it calls into the underlying stream object, and io.BytesIO doesn't have setblocking().
2019-04-30extmod/modussl_axtls: Add non-blocking mode support.Paul Sokolovsky
It consists of: 1. "do_handhake" param (default True) to wrap_socket(). If it's False, handshake won't be performed by wrap_socket(), as it would be done in blocking way normally. Instead, SSL socket can be set to non-blocking mode, and handshake would be performed before the first read/write request (by just returning EAGAIN to these requests, while instead reading/writing/ processing handshake over the connection). Unfortunately, axTLS doesn't really support non-blocking handshake correctly. So, while framework for this is implemented on MicroPython's module side, in case of axTLS, it won't work reliably. 2. Implementation of .setblocking() method. It must be called on SSL socket for blocking vs non-blocking operation to be handled correctly (for example, it's not enough to wrap non-blocking socket with wrap_socket() call - resulting SSL socket won't be itself non-blocking). Note that .setblocking() propagates call to the underlying socket object, as expected.
2019-04-30extmod/modussl_mbedtls: Support non-blocking handshake.Paul Sokolovsky
For this, add wrap_socket(do_handshake=False) param. CPython doesn't have such a param at a module's global function, and at SSLContext.wrap_socket() it has do_handshake_on_connect param, but that uselessly long. Beyond that, make write() handle not just MBEDTLS_ERR_SSL_WANT_WRITE, but also MBEDTLS_ERR_SSL_WANT_READ, as during handshake, write call may be actually preempted by need to read next handshake message from peer. Likewise, for read(). And even after the initial negotiation, situations like that may happen e.g. with renegotiation. Both MBEDTLS_ERR_SSL_WANT_READ and MBEDTLS_ERR_SSL_WANT_WRITE are however mapped to the same None return code. The idea is that if the same read()/write() method is called repeatedly, the progress will be made step by step anyway. The caveat is if user wants to add the underlying socket to uselect.poll(). To be reliable, in this case, the socket should be polled for both POLL_IN and POLL_OUT, as we don't know the actual expected direction. But that's actually problematic. Consider for example that write() ends with MBEDTLS_ERR_SSL_WANT_READ, but gets converted to None. We put the underlying socket on pull using POLL_IN|POLL_OUT but that probably returns immediately with POLL_OUT, as underlyings socket is writable. We call the same ussl write() again, which again results in MBEDTLS_ERR_SSL_WANT_READ, etc. We thus go into busy-loop. So, the handling in this patch is temporary and needs fixing. But exact way to fix it is not clear. One way is to provide explicit function for handshake (CPython has do_handshake()), and let *that* return distinct codes like WANT_READ/WANT_WRITE. But as mentioned above, past the initial handshake, such situation may happen again with at least renegotiation. So apparently, the only robust solution is to return "out of bound" special sentinels like WANT_READ/WANT_WRITE from read()/write() directly. CPython throws exceptions for these, but those are expensive to adopt that way for efficiency-conscious implementation like MicroPython.
2019-04-30esp32/machine_wdt: Add timeout arg to select interval, make WDT panic.Krono
The machine.WDT() now accepts the "timeout" keyword argument to select the WDT interval. And the WDT is changed to panic mode which means it will reset the device if the interval expires (instead of just printing an error message).
2019-04-29stm32/powerctrl: Deselect PLLSAI as 48MHz src before turning off PLLSAI.Damien George
On the STM32F722 (at least, but STM32F767 is not affected) the CK48MSEL bit must be deselected before PLLSAION is turned off, or else the 48MHz peripherals (RNG, SDMMC, USB) may get stuck without a clock source. In such "lock up" cases it seems that these peripherals are still being clocked from the PLLSAI even though the CK48MSEL bit is turned off. A hard reset does not get them out of this stuck state. Enabling the PLLSAI and then disabling it does get them out. A test case to see this is: import machine, pyb for i in range(100): machine.freq(122_000000) machine.freq(120_000000) print(i, [pyb.rng() for _ in range(4)]) On occasion the RNG will just return 0's, but will get fixed again on the next loop (when PLLSAI is enabled by the change to a SYSCLK of 122MHz). Fixes issue #4696.
2019-04-28javascript/library: Print data as raw bytes to stdout so unicode works.Damien George
2019-04-28javascript/Makefile: Fix unrepresentable float error by using clamp.Damien George
Otherwise converting large floats to ints will fail (as seen by the builtin_float_hash.py test).
2019-04-28javascript: Pass (error) exit value out from script to process caller.Damien George
2019-04-28javascript/library: Use Buffer.alloc() since new Buffer() is deprecated.Damien George
2019-04-28tests: Skip tests needing machine module if (u)machine doesn't exist.Damien George
2019-04-28stm32/usb: Add USB device mode for VCP+VCP without MSC.Andrew Leech
Selectable via pyb.usb_mode('VCP+VCP').
2019-04-26ports: Convert to use pyexec_file_if_exists() to execute boot/main.py.Damien George
The stm32 and nrf ports already had the behaviour that they would first check if the script exists before executing it, and this patch makes all other ports work the same way. This helps when developing apps because it's hard to tell (when unconditionally trying to execute the scripts) if the resulting OSError at boot up comes from missing boot.py or main.py, or from some other error. And it's not really an error if these scripts don't exist.
2019-04-26lib/utils/pyexec: Add pyexec_file_if_exists() helper function.Damien George
It will only execute the script if it can be stat'd and is a file.
2019-04-26extmod/machine_signal: Fix fault when no args are passed to Signal().Damien George
2019-04-26stm32/usbdev: Make USB device descriptors at runtime rather than static.Damien George
2019-04-25tools/pyboard.py: Don't accumulate output data if data_consumer used.Damien George
Prior to this patch, when a lot of data was output by a running script pyboard.py would try to capture all of this output into the "data" variable, which would gradually slow down pyboard.py to the point where it would have large CPU and memory usage (on the host) and potentially lose data. This patch fixes this problem by not accumulating the data in the case that the data is not needed, which is when "data_consumer" is used.
2019-04-24stm32/dac: Rework DAC driver to use direct register access.Damien George
This patch makes the DAC driver simpler and removes the need for the ST HAL. As part of it, new helper functions are added to the DMA driver, which also use direct register access instead of the ST HAL. Main changes to the DAC interface are: - The DAC uPy object is no longer allocated dynamically on the heap, rather it's statically allocated and the same object is retrieved for subsequent uses of pyb.DAC(<id>). This allows to access the DAC objects without resetting the DAC peripheral. It also means that the DAC is only reset if explicitly passed initialisation parameters, like "bits" or "buffering". - The DAC.noise() and DAC.triangle() methods now output a signal which is full scale (previously it was a fraction of the full output voltage). - The DAC.write_timed() method is fixed so that it continues in the background when another peripheral (eg SPI) uses the DMA (previously the DAC would stop if another peripheral finished with the DMA and shut the DMA peripheral off completely). Based on the above, the following backwards incompatibilities are introduced: - pyb.DAC(id) will now only reset the DAC the first time it is called, whereas previously each call to create a DAC object would reset the DAC. To get the old behaviour pass the bits parameter like: pyb.DAC(id, bits). - DAC.noise() and DAC.triangle() are now full scale. To get previous behaviour (to change the amplitude and offset) write to the DAC_CR (MAMP bits) and DAC_DHR12Rx registers manually.
2019-04-23py/mpprint: Support printing %ld and %lu formats on 64-bit archs.Damien George
Fixes issue #4702.
2019-04-18stm32/powerctrl: Enable EIWUP to ensure RTC wakes device from standby.Damien George
2019-04-18stm32/system_stm32f0: Add support for using HSE and PLL as SYSCLK.Damien George
To configure the SYSCLK on an F0 enable one of: MICROPY_HW_CLK_USE_HSI48 MICROPY_HW_CLK_USE_HSE MICROPY_HW_CLK_USE_BYPASS
2019-04-18stm32/system_stm32f0: Enable PWR clock on startup.Damien George
To be consistent with how F4/F7/H7/L4 works in system_stm32.c. The power control peripheral is needed at least for the RTC.
2019-04-18tests/micropython: Add some tests for failed heap allocation.Damien George
This adds tests for some locations in the code where a memory allocation should raise an exception.
2019-04-18esp32/README: Add info about pyparsing and the correct Python version.Damien George
See issue #4655.
2019-04-18docs/cmodules: Note the various ways MODULE_EXAMPLE_ENABLED can be set.Daniel O'Connor
2019-04-16extmod/modurandom: Add init method to seed the Yasmarang generator.Léa Saviot
In CPython the random module is seeded differently on each import, and so this new macro option MICROPY_PY_URANDOM_SEED_INIT_FUNC allows to implement such a behaviour.
2019-04-15docs/cmodules: Fix example to globally define MODULE_EXAMPLE_ENABLED.Daniel O'Connor
MODULE_EXAMPLE_ENABLED must be globally defined for the module to be seen and referenced by all parts of the code.
2019-04-15stm32/timer: Correctly initialise extended break settings on F7/H7/L4.Damien George
Fixes issue #4693.
2019-04-15py/runtime: Fix mp_unpack_ex so seq can't be reclaimed by GC during use.Damien George
The issue described in the comment added here can be seen by forcing a gc_collect() at the start of each call to gc_alloc().
2019-04-15py/objset: Remove unused forward declaration and clean up whitespace.Damien George
2019-04-15py/runtime: Optimise to not create temp float for int to power negative.Damien George
2019-04-12py/makedefs: Use io.open with utf-8 encoding when processing source.Damien George
In case (user) source code contains utf-8 encoded data and the default locale is not utf-8. See #4592.
2019-04-12stm32/rtc: Remove non-ASCII mu-character from source code comment.Damien George
And fix a typo in the comment on this line.
2019-04-11zephyr/CMakeLists.txt: Set AR to point to the Zephyr toolchain exe.Damiano Mazzella
2019-04-11stm32/rtc: Remove unused LSE detection code.Damien George
2019-04-11stm32/rtc: Add auto-LSE-bypass detection with fallback to LSE then LSI.Damien George
If MICROPY_HW_RTC_USE_BYPASS is enabled the RTC startup goes as follows: - RTC is started with LSE in bypass mode to begin with - if that fails to start (after a given timeout) then LSE is reconfigured in non-bypass - if that fails to start then RTC is switched to LSI
2019-04-11extmod/modlwip: Abort TCP conns that didn't close cleanly in a while.Damien George