aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-09-01pic16bit: Add definition of SEEK_SET to unistd.h.Damien George
2017-09-01py/modstruct: Check and prevent buffer-write overflow in struct packing.Damien George
Prior to this patch, the size of the buffer given to pack_into() was checked for being too small by using the count of the arguments, not their actual size. For example, a format spec of '4I' would only check that there was 4 bytes available, not 16; and 'I' would check for 1 byte, not 4. The pack() function is ok because its buffer is created to be exactly the correct size. The fix in this patch calculates the total size of the format spec at the start of pack_into() and verifies that the buffer is large enough. This adds some computational overhead, to iterate through the whole format spec. The alternative is to check during the packing, but that requires extra code to handle alignment, and the check is anyway not needed for pack(). So to maintain minimal code size the check is done using struct_calcsize.
2017-09-01py/modstruct: Check and prevent buffer-read overflow in struct unpackingDamien George
Prior to this patch, the size of the buffer given to unpack/unpack_from was checked for being too small by using the count of the arguments, not their actual size. For example, a format spec of '4I' would only check that there was 4 bytes available, not 16; and 'I' would check for 1 byte, not 4. This bug is fixed in this patch by calculating the total size of the format spec at the start of the unpacking function. This function anyway needs to calculate the number of items at the start, so calculating the total size can be done at the same time.
2017-09-01py/modstruct: In struct.pack, stop converting if there are no args left.Damien George
This patch makes a repeat counter behave the same as repeating the typecode, when there are not enough args. For example: struct.pack('2I', 1) now behave the same as struct.pack('II', 1).
2017-09-01tests/class_new: Add another testcase for __new__/__init__ interaction.Paul Sokolovsky
Similar to the existing testcase, but test that returning both value of native type and instance of another user class from __new__ lead to __init__ not being called, for better coverage.
2017-08-31py: Make m_malloc_fail() have void return type, since it doesn't return.Damien George
2017-08-31py/map: Remove unused new/free functions.Damien George
Maps are always allocated "statically" and (de)initialised via mp_map_init and mp_map_deinit.
2017-08-31py/map: Replace always-false condition with assertion.Damien George
2017-08-31extmod/modubinascii: Only include uzlib/tinf.h when it's really needed.Damien George
2017-08-31py/objtype: mp_obj_class_lookup: Improve debug logging.Paul Sokolovsky
Now traces more explicitly thru the lookup process.
2017-08-30tests/class_new: Add checks for __init__ being called and other improvements.Paul Sokolovsky
2017-08-30tests/object_new: Better messages, check user __new__() method.Paul Sokolovsky
Make messages more verbose and easier to follow and check that user class' __new__() is not called by object.__new__(user_class).
2017-08-30py/objtype: mp_obj_instance_make_new: Fix typos in comment.Paul Sokolovsky
2017-08-30py: Change obsolete "///" comment formatting to normal comments.Damien George
This comment style is no longer used because the docs are written by hand, not generated.
2017-08-30all: Convert remaining "mp_uint_t n_args" to "size_t n_args".Damien George
This is to have consistency across the whole repository.
2017-08-30py/objtype: Handle NotImplemented return from binary special methods.Paul Sokolovsky
NotImplemented means "try other fallbacks (like calling __rop__ instead of __op__) and if nothing works, raise TypeError". As MicroPython doesn't implement any fallbacks, signal to raise TypeError right away.
2017-08-29stmhal: Update to new STM Cube HAL library.Damien George
This upgrades the HAL to the versions: - F4 V1.16.0 - F7 V1.7.0 - L4 V1.8.1 The main changes were in the SD card driver. The vendor changed the SD read/write functions to accept block number intead of byte address, so there is no longer any need for a custom patch for this in stm32lib. The CardType values also changed, so pyb.SDCard().info() will return different values for the 3rd element of the tuple, but this function was never documented.
2017-08-29docs/library/micropython: Fix typo in RST formatting.Damien George
2017-08-29docs/library: Add description of "index" parameter to uos.dupterm().Damien George
2017-08-29stmhal/Makefile: Automatically fetch stm32lib submodule if needed.Damien George
2017-08-29stmhal: Remove cmsis and hal files, they are now a submodule.Damien George
2017-08-29stmhal/Makefile: Use lib/stm32lib instead of local cmsis and hal files.Damien George
2017-08-29lib: Add new submodule, stm32lib containing STM32 CMSIS and HAL source.Damien George
Linked to https://github.com/micropython/stm32lib
2017-08-29all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriateDamien George
The unary-op/binary-op enums are already defined, and there are no arithmetic tricks used with these types, so it makes sense to use the correct enum type for arguments that take these values. It also reduces code size quite a bit for nan-boxing builds.
2017-08-29py/nlrx86,x64: Replace #define of defined() with portable macro usage.Damien George
Using gcc -Wpedantic will warn that #define of defined() is non-portable and this patch fixes this.
2017-08-29drivers/memory/spiflash: Change from hard-coded soft SPI to generic SPI.Damien George
The SPI flash driver now supports using an arbitrary SPI object to communicate with the flash chip, and in particular can use a hardware SPI peripheral.
2017-08-29docs/machine.Signal: Improve style/grammar and add usage example.Paul Sokolovsky
2017-08-29py/objstr: startswith, endswith: Check arg to be a string.Paul Sokolovsky
Otherwise, it will silently get incorrect result on other values types, including CPython tuple form like "foo.png".endswith(("png", "jpg")) (which MicroPython doesn't support for unbloatedness).
2017-08-28docs/library/network: Fix ref to "socket" module (should be "usocket").Paul Sokolovsky
2017-08-28docs: More xrefs to "MicroPython port" in glossary.Paul Sokolovsky
2017-08-24stmhal/boards/pllvalues.py: Make script work with both Python 2 and 3.Damien George
2017-08-24stmhal/Makefile: Use GEN_PINS_HDR var instead of writing it explicitly.Damien George
2017-08-24stmhal/modmachine: For F7 MCU, save power by reducing internal volt reg.Damien George
2017-08-24stmhal: Compute PLL freq table during build instead of at run time.Damien George
Allows for simpler, smaller and faster code at run time when selecting the boards frequency, and allows more customisation opportunities for the PLL values depending on the target MCU.
2017-08-23docs/pyboard/tutorial: Add "timeout=0" to UART in pass-through example.Damien George
Without this the pass-through will pause for 1 second at each character.
2017-08-23stmhal/modmachine: Improve support for sleep/deepsleep on F7 MCUs.Damien George
Changes for F7 are: - machine.reset_cause() now reports DEEPSLEEP_RESET correctly; - machine.sleep() is further optimised to reduce power consumption; - machine.deepsleep() is now implemented and working.
2017-08-23stmhal/modmachine: Make machine.bootloader() work when MPU is enabled.Damien George
2017-08-23docs: Bump version to 1.9.2.Damien George
2017-08-23py/asmthumb: Use existing macro to properly clear the D-cache.Damien George
This macro is provided by stmhal/mphalport.h and makes sure the addr and size arguments are correctly aligned.
2017-08-22docs: Consistently link to micropython-lib in glossary.Paul Sokolovsky
2017-08-21esp8266: Fix UART stop bit constants.Ein Terakawa
As per the "ESP8266 Technical Reference".
2017-08-21extmod/modubinascii: Don't post-increment variable that won't be used.Damien George
2017-08-21py/formatfloat: Don't post-increment variable that won't be used again.Damien George
2017-08-21py/objcomplex: Remove unnecessary assignment of variable.Damien George
2017-08-21py/compile: Remove unused pn_colon code when compiling func params.Damien George
2017-08-21all: Make static dicts use mp_rom_map_elem_t type and MP_ROM_xxx macros.Damien George
2017-08-21extmod,unix: For uos.stat interpret st_size member as an unsigned int.Damien George
This prevents large files (eg larger than 2gb on a 32-bit arch) from showing up as having a negative size. Fixes issue #3227.
2017-08-21py/mkrules.mk: Use "find -path" when searching for frozen obj files.Damien George
This allows the command to succeed without error even if there is no $(BUILD)/build directory, which is the case for mpy-cross.
2017-08-20py/stream: seek: Consistently handle negative offset for SEEK_SET.Paul Sokolovsky
Per POSIX, this is EINVAL, so raises OSError(EINVAL).
2017-08-20py/objstringio: Fix regression with handling SEEK_SET.Paul Sokolovsky
For SEEK_SET, offset should be treated as unsigned, to allow full-width stream sizes (e.g. 32-bit instead of 31-bit). This is now fully documented in stream.h. Also, seek symbolic constants are added.