summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-03-24lib/libm: Add implementation of nearbyintf, from musl-1.1.16.Damien George
2017-03-23tests/float: Add tests for math funcs that return ints.Damien George
One should test bigint, inf and nan to make sure all cases are covered.
2017-03-23py/objint: Handle special case of -0 when classifying fp as int.Damien George
Otherwise -0.0 is classified as a bigint, which for builds without bigints will lead unexpectedly to an overflow.
2017-03-23py/modmath: Allow trunc/ceil/floor to return a big int if necessary.Damien George
Previous to this patch, if the result of the trunc/ceil/floor functions overflowed a small int, or was inf or nan, then a garbage value was returned. With this patch the correct big-int is returned if necessary, and exceptions are raised for inf or nan.
2017-03-23py/lexer: Remove obsolete comment, since lexer can now raise exceptions.Damien George
2017-03-23py: Define and use MP_OBJ_ITER_BUF_NSLOTS to get size of stack iter buf.Damien George
It improves readability of code and reduces the chance to make a mistake. This patch also fixes a bug with nan-boxing builds by rounding up the calculation of the new NSLOTS variable, giving the correct number of slots (being 4) even if mp_obj_t is larger than the native machine size.
2017-03-23py/sequence: Convert mp_uint_t to size_t where appropriate.Damien George
2017-03-23py: Use size_t as len argument and return type of mp_get_index.Damien George
These values are used to compute memory addresses and so size_t is the more appropriate type to use.
2017-03-23msvc: Remove directory with generated files when cleaning.stijn
This assures after cleaning all build artefacts (qstr related files, generated version header) have been removed.
2017-03-23windows: Make msvc project file support any version from VS2013 to VS2017stijn
Instead of having the PlatformToolset property hardcoded to a specific version just set it to the value of DefaultPlatformToolset: this gets defined according to the commandline environment in which the build was started. Instead of just supporting VS2015 the project can now be built by any version from VS2013 to VS2017 and normally future versions as well, without quirks like VS asking whether you want to upgrade the project to the latest version (as was the case when opening the project in VS2017) or not being able to build at all (as was the case when opening the project in VS2013). Also adjust the .gitignore file to ignore any artefacts from VS2017.
2017-03-23minimal/Makefile: Change C standard from gnu99 to c99.Damien George
2017-03-23bare-arm/Makefile: Change C standard from gnu99 to c99.Damien George
2017-03-23all/Makefile: Remove -ansi from GCC flags, its ignored anyway.Krzysztof Blazewicz
The -ansi flag is used for C dialect selection and it is equivalent to -std=c90. Because it goes right before -std=gnu99 it is ignored as for conflicting flags GCC always uses the last one.
2017-03-22tests/heapalloc_str: Test no-replacement case for str.replace().Paul Sokolovsky
2017-03-22py/bc: Provide better error message for an unexpected keyword argument.Damien George
Now, passing a keyword argument that is not expected will correctly report that fact. If normal or detailed error messages are enabled then the name of the unexpected argument will be reported. This patch decreases the code size of bare-arm and stmhal by 12 bytes, and cc3200 by 8 bytes. Other ports (minimal, unix, esp8266) remain the same in code size. For terse error message configuration this is because the new message is shorter than the old one. For normal (and detailed) error message configuration this is because the new error message already exists in py/objnamedtuple.c so there's no extra space in ROM needed for the string.
2017-03-22cc3200/mods/modutime: Use generic sleep_ms and sleep_us implementations.Damien George
2017-03-22stmhal/systick: Make mp_hal_delay_ms release the GIL when sleeping.Damien George
2017-03-22extmod/utime_mphal: Don't exit/enter the GIL in generic sleep functions.Damien George
GIL behaviour should be handled by the port. And ports probably want to define sleep_us so that it doesn't release the GIL, to improve timing accuracy.
2017-03-22stmhal/pybthread: Allow interrupts to work during lock/unlock of mutex.Damien George
When locking/unlocking a mutex we only need to protect against a thread switch, not general interrupts.
2017-03-22stmhal/irq: Shift IRQ priorities of TIM and EXTINT to be above PENDSV.Damien George
This way, Timer and ExtInt callbacks can interrupt the low-priority pendsv handler (for example thread switching).
2017-03-21esp8266/machine_pin: Fix pin.irq() to work when all args are keywords.Damien George
2017-03-21esp8266/machine_pin: Fix memset size for zeroing of pin_irq_is_hard.Damien George
Thanks to @robert-hh.
2017-03-20stmhal/pendsv: Disable interrupts during a thread switch.Damien George
We can actually handle interrupts during a thread switch (because we always have a valid stack), but only if those interrupts don't access any of the thread state (because the state may not correspond to the stack pointer). So to be on the safe side we disable interrupts during the very short period of the thread state+stack switch.
2017-03-20py/vm: Don't release the GIL if the scheduler is locked.Damien George
The scheduler being locked general means we are running a scheduled function, and switching to another thread violates that, so don't switch in such a case (even though we technically could). And if we are running a scheduled function then we want to finish it ASAP, so we shouldn't switch to another thread. Furthermore, ports with threading enabled will lock the scheduler during a hard IRQ, and this patch to the VM will make sure that threads are not switched during a hard IRQ (which would crash the VM).
2017-03-20extmod/modframebuf: Add support for monochrome horizontal format.Peter Hinch
MHLSB and MHMSB formats are added to the framebuf module, which have 8 adjacent horizontal pixels represented in a single byte.
2017-03-20docs/library/machine.I2C: Fix scan() doc to match implementation.transistortim
Since eaef6b5324fa2ff425802d4abeea45aa945bfc14 writes are used instead of reads.
2017-03-20unix/coverage: Enable scheduler and add tests for it.Damien George
2017-03-20tests/micropython: Add tests for micropython.schedule().Damien George
2017-03-20esp8266/machine_pin: Make pin.irq arguments positional.Damien George
All arguments to pin.irq are converted from keyword-only to positional, and can still be specified by keyword so it's a backwards compatible change. The default value for the "trigger" arg is changed from 0 (no trigger) to rising+falling edge.
2017-03-20esp8266/machine_pin: Add "hard" parameter to pin.irq, soft by default.Damien George
2017-03-20esp8266: Change machine.Timer callback to soft callback.Damien George
2017-03-20esp8266: Enable micropython.schedule() with locking in pin callback.Damien George
2017-03-20stmhal: Enable micropython.schedule().Damien George
ExtInt, Timer and CAN IRQ callbacks are made to work with the scheduler. They are still hard IRQs by default, but one can now call micropython.schedule within the hard IRQ to schedule a soft callback.
2017-03-20unix: Use mp_handle_pending() in time.sleep().Damien George
2017-03-20py: Add micropython.schedule() function and associated runtime code.Damien George
2017-03-20py/objstr: Use better msg in bad implicit str/bytes conversion exceptionstijn
Instead of always reporting some object cannot be implicitly be converted to a 'str', even when it is a 'bytes' object, adjust the logic so that when trying to convert str to bytes it is shown like that. This will still report bad implicit conversion from e.g. 'int to bytes' as 'int to str' but it will not result in the confusing 'can't convert 'str' object to str implicitly' anymore for calls like b'somestring'.count('a').
2017-03-17utime module documentation fixes and cleanup:Christopher Arndt
* Fix mis-spelling of `ticks_add` in code examples. * Be consistent about parentheses after function names. * Be consistent about formatting of function, variable and constant names. * Be consistent about spaces and punctuation. * Fix some language errors (missing or wrong words, wrong word order). * Keep line length under 90 chars. Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
2017-03-17py: Provide mp_decode_uint_value to help optimise stack usage.Damien George
This has a noticeable improvement on x86-64 and Thumb2 archs, where stack usage is reduced by 2 machine words in the VM.
2017-03-17py: Reduce size of mp_code_state_t structure.Damien George
Instead of caching data that is constant (code_info, const_table and n_state), store just a pointer to the underlying function object from which this data can be derived. This helps reduce stack usage for the case when the mp_code_state_t structure is stored on the stack, as well as heap usage when it's stored on the heap. The downside is that the VM becomes a little more complex because it now needs to derive the data from the underlying function object. But this doesn't impact the performance by much (if at all) because most of the decoding of data is done outside the main opcode loop. Measurements using pystone show that little to no performance is lost. This patch also fixes a nasty bug whereby the bytecode can be reclaimed by the GC during execution. With this patch there is always a pointer to the function object held by the VM during execution, since it's stored in the mp_code_state_t structure.
2017-03-16tests/basics/bytes_add: Add tests for optimised bytes addition.Damien George
2017-03-16py/objstr: Fix eager optimisation of str/bytes addition.Damien George
The RHS can only be returned if it is the same type as the LHS.
2017-03-15travis: Change an stmhal rule to build PYBV11 instead of default PYBV10.Damien George
This allows to test the PYBV11 target as well as the network drivers without adding another rule. It also removes the need to use -B, side-stepping the issue of whether or not -B works with qstr auto generation.
2017-03-15docs/library/framebuf: Fix typo in bit-width for MVLSB description.Damien George
2017-03-15py/mkrules.mk: Remove special check for "-B" in qstr auto generation.Damien George
When make is passed "-B" it seems that everything is considered out-of-date and so $? expands to all prerequisites. Thus there is no need for a special check to see if $? is emtpy.
2017-03-15tests/basics: Move string-modulo-format int tests to dedicated file.Damien George
2017-03-15tests/basics: Add test for string module formatting with int argument.Damien George
2017-03-15tests/basics/string_format2: Adjust comment now that tests succeed.Damien George
2017-03-15py/mpprint: Fix int formatting so "+" is printed for 0-valued integer.Damien George
2017-03-15py/emitnative: Remove obsolete commented out code.Damien George
2017-03-14tests/micropython/viper_error: Add more tests to improve coverage.Damien George