aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-09-12extmod/moduhashlib: Add md5 implementation using mbedtls.Damien George
2018-09-12extmod/moduhashlib: Use newer message digest API for mbedtls >=2.7.0.Damien George
Since mbedtls 2.7.0 new digest functions were introduced with a "_ret" suffix to allow the functions to return an error message (eg, if the underlying hardware acceleration failed). These new functions must be used instead of the old ones to prevent deprecation warnings, or link errors for missing functions, depending on the mbedtls configuration.
2018-09-12stm32/flashbdev: Protect flash writes from cache flushing and USB MSC.Damien George
2018-09-12stm32: Change flash IRQ priority from 2 to 6 to prevent preemption.Damien George
The flash-IRQ handler is used to flush the storage cache, ie write outstanding block data from RAM to flash. This is triggered by a timeout, or by a direct call to flush all storage caches. Prior to this commit, a timeout could trigger the cache flushing to occur during the execution of a read/write to external SPI flash storage. In such a case the storage subsystem would break down. SPI storage transfers are already protected against USB IRQs, so by changing the priority of the flash IRQ to that of the USB IRQ (what is done in this commit) the SPI transfers can be protected against any timeouts triggering a cache flush (the cache flush would be postponed until after the transfer finished, but note that in the case of SPI writes the timeout is rescheduled after the transfer finishes). The handling of internal flash sync'ing needs to be changed to directly call flash_bdev_irq_handler() sync may be called with the IRQ priority already raised (eg when called from a USB MSC IRQ handler).
2018-09-11stm32/spi: Be sure to set all SPI config values in SPI proto init.Damien George
2018-09-11stm32/sdcard: Move temporary DMA state from BSS to stack.Damien George
2018-09-11stm32/sdcard: Use only a single DMA stream for both SDIO TX/RX.Damien George
No need to be wasteful on DMA resources.
2018-09-11stm32/dma: Reinitialise the DMA if the direction changed on the channel.Damien George
2018-09-11stm32/dma: Pass DMA direction as parameter to dma_init not in cfg structDamien George
Some DMA channels (eg for SDIO) can be used in both directions and this patch allows such peripherals to dynamically select the DMA direction.
2018-09-11stm32: For MCUs that have PLLSAI allow to set SYSCLK at 2MHz increments.Damien George
MCUs that have a PLLSAI can use it to generate a 48MHz clock for USB, SDIO and RNG peripherals. In such cases the SYSCLK is not restricted to values that allow the system PLL to generate 48MHz, but can be any frequency. This patch allows such configurability for F7 MCUs, allowing the SYSCLK to be set in 2MHz increments via machine.freq(). PLLSAI will only be enabled if needed, and consumes about 1mA extra. This fine grained control of frequency is useful to get accurate SPI baudrates, for example.
2018-09-11py/emitnative: Fix try-finally in outer scope, so finally is cancelled.Damien George
2018-09-11stm32/boards/STM32L476DISC: Enable external RTC xtal to get RTC working.roland
2018-09-11stm32/Makefile: Allow external BOARD_DIR directory to be specified.Andrew Leech
This makes it easy to add a custom board definition outside of the micropython tree, keeping the micropython submodule clean and official.
2018-09-11py/objarray: bytearray: Allow 2nd/3rd arg to constructor.Paul Sokolovsky
If bytearray is constructed from str, a second argument of encoding is required (in CPython), and third arg of Unicode error handling is allowed, e.g.: bytearray("str", "utf-8", "strict") This is similar to bytes: bytes("str", "utf-8", "strict") This patch just allows to pass 2nd/3rd arguments to bytearray, but doesn't try to validate them to not impact code size. (This is also similar to how bytes constructor is handled, though it does a bit more validation, e.g. check that in case of str arg, encoding argument is passed.)
2018-09-11tests/extmod/uhashlib_md5: Add coverage tests for MD5 algorithm.Paul Sokolovsky
Based on tests/extmod/uhashlib_sha1.
2018-09-11extmod/moduhashlib: Add md5 implementation, using axTLS.Paul Sokolovsky
MD5 is still widely used, and may be important in some cases for networking interoperability, e.g. HTTP Digest authentication.
2018-09-11py/runtime: Fix incorrect test for MICROPY_PORT_DEINIT_FUNC.stijn
2018-09-10unix/Makefile: Build libffi inside $BUILD.Paul Sokolovsky
Avoids polluting the source tree, allows to build for different (sub)archs without intermediate cleaning.
2018-09-08esp8266/main: Increase heap by 2kb, now that axtls rodata is in ROM.Damien George
2018-09-08esp8266/Makefile: Remove build of libaxtls.a and add back tuned config.Damien George
2018-09-08unix/Makefile: Remove building of libaxtls.a which is no longer needed.Damien George
2018-09-08py/py.mk: Build axtls library directly from its source files.Damien George
This removes the need for a separate axtls build stage, and builds all axtls object files along with other code. This simplifies and cleans up the build process, automatically builds axtls when needed, and puts the axtls object files in the correct $(BUILD) location. The MicroPython axtls configuration file is provided in extmod/axtls-include/config.h
2018-09-05tests: Remove pyboard.py symlink and instead import from ../tools.Damien George
To eliminate the need for symlinks which don't work on systems like Windows.
2018-09-05stm32/mboot/main: Use correct formula for DFU download address.Damien George
As per ST's DfuSe specification, and following their example code.
2018-09-05stm32/mboot/Makefile: Use -Wno-attributes for ll_usb.c HAL source file.Damien George
A recent version of arm-none-eabi-gcc (8.2.0) will warn about unused packed attributes in USB_WritePacket and USB_ReadPacket. This patch suppresses such warnings for this file only.
2018-09-04tests/float: Test -inf and some larger values for special math funcs.Damien George
2018-09-04tests/float/cmath_fun.py: Fix truncation of small real part of complex.Damien George
2018-09-04lib/libm/wf_tgamma: Fix tgammaf handling of -inf, should return nan.Damien George
2018-09-04lib/libm/math: Make tanhf more efficient and handle large numbers.Damien George
Prior to this patch tanhf(large number) would return nan due to inf/inf.
2018-09-04lib/libm_dbl/tanh: Make tanh more efficient and handle large numbers.Damien George
Prior to this patch tanh(large number) would return nan due to inf/inf.
2018-09-04py/compile: Factor code that compiles start/end of exception handler.Damien George
2018-09-04tests/basics: Add test cases for context manager raising in enter/exit.Damien George
2018-09-04tests/basics: Add more tests for return within try-finally.Damien George
2018-09-04tests/run-tests: Enable native tests for unwinding jumps.Damien George
2018-09-04py/emitnative: Add support for return/break/continue in try and with.Damien George
This patch adds full support for unwinding jumps to the native emitter. This means that return/break/continue can be used in try-except, try-finally and with statements. For code that doesn't use unwinding jumps there is almost no overhead added to the generated code.
2018-09-03py/emitnative: Cancel caught exception once handled to prevent reraise.Damien George
The native emitter keeps the current exception in a slot in its C stack (instead of on its Python value stack), so when it catches an exception it must explicitly clear that slot so the same exception is not reraised later on.
2018-09-03py/vm: Fix handling of finally-return with complex nested finallys.Damien George
Back in 8047340d7532ec32bc9f2d603bffc0bc9544297f basic support was added in the VM to handle return statements within a finally block. But it didn't cover all cases, in particular when some finally's were active and others inactive when the "return" was executed. This patch adds further support for return-within-finally by correctly managing the currently_in_except_block flag, and should fix all cases. The main point is that finally handlers remain on the exception stack even if they are active (currently being executed), and the unwind return code should only execute those finally's which are inactive. New tests are added for the cases which now pass.
2018-08-17tests/basics: Provide .exp files for generator tests that fail PEP479.Damien George
PEP479 (see https://www.python.org/dev/peps/pep-0479/) prohibited raising StopIteration from within a generator (it is turned into a RuntimeError). This behaviour was introduced in Python 3.5 and in 3.7 was made compulsory. Until uPy implements PEP479, this patch adds .py.exp files for the relevant tests so they can be run under Python 3.7.
2018-08-17tests: Modify tests that print repr of an exception with 1 arg.Damien George
In Python 3.7 the behaviour of repr() of an exception with one argument changed: it no longer prints a trailing comma in the argument list. See https://bugs.python.org/issue30399 This patch modifies tests that rely on this behaviour to not rely on it. And the python34.py test is updated to include a test for this behaviour with a .exp file.
2018-08-17tests/basics/int_big_error.py: Use bytearray to test for int overflow.Damien George
In Python 3.7 "1 >> (big int)" is now allowed, it no longer raises an OverflowError. So use bytearray to test big-int conversion overflow.
2018-08-17tests/basics/set_pop.py: Sort set before printing for consistent output.Damien George
2018-08-17py/emitnx86: Fix number of args passed to mp_setup_code_state, 4 not 5.Damien George
2018-08-17py/asmxtensa: Use narrow version of add instr to reduce native code sizeDamien George
2018-08-17py/emitnative: Fix bug with store of 16 and 32 values in viper ARM mode.Damien George
2018-08-17py/asmxtensa: Optimise loading local addr and support larger offsets.Damien George
2018-08-17py/asmxtensa: Fix bug with order of regs in addi encoding.Damien George
2018-08-17tests/micropython: Add tests for try and with blocks under native/viper.Damien George
2018-08-16py/emitnative: Optimise and improve exception handling in native code.Damien George
Prior to this patch, native code would use a full nlr_buf_t for each exception handler (try-except, try-finally, with). For nested exception handlers this would use a lot of C stack and be rather inefficient. This patch changes how exceptions are handled in native code by setting up only a single nlr_buf_t context for the entire function, and then manages a state machine (using the PC) to work out which exception handler to run when an exception is raised by an nlr_jump. This keeps the C stack usage at a constant level regardless of the depth of Python exception blocks. The patch also fixes an existing bug when local variables are written to within an exception handler, then their value was incorrectly restored if an exception was raised (since the nlr_jump would restore register values, back to the point of the nlr_push). And it also gets nested try-finally+with working with the viper emitter. Broadly speaking, efficiency of executing native code that doesn't use any exception blocks is unchanged, and emitted code size is only slightly increased for such function. C stack usage of all native functions is either equal or less than before. Emitted code size for native functions that use exception blocks is increased by roughly 10% (due in part to fixing of above-mentioned bugs). But, most importantly, this patch allows to implement more Python features in native code, like unwind jumps and yielding from within nested exception blocks.
2018-08-16py/asm*: Support assembling code to jump to a register, and get PC+off.Damien George
Useful for position independent code, and implementing state machines.
2018-08-16py/asmxtensa: Handle function entry/exit when stack use larger than 127.Damien George