aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-04-04esp8266/makeimg.py: Print out info about RAM segments when building fw.Damien George
2020-04-04esp8266: Change from FAT to littlefs v2 as default filesystem.Damien George
This commit changes the esp8266 boards to use littlefs v2 as the filesystem, rather than FAT. Since the esp8266 doesn't expose the filesystem to the PC over USB there's no strong reason to keep it as FAT. Littlefs is smaller in code size, is more efficient in use of flash to store data, is resilient over power failure, and using it saves about 4k of heap RAM, which can now be used for other things. This is a backwards incompatible change because all existing esp8266 boards will need to update their filesystem after installing new firmware (eg backup old files, install firmware, restore files to new filesystem). As part of this commit the memory layout of the default board (GENERIC) has changed. It now allocates all 1M of memory-mapped flash to the firmware, so the filesystem area starts at the 2M point. This is done to allow more frozen bytecode to be stored in the 1M of memory-mapped flash. This requires an esp8266 module with 2M or more of flash to work, so a new board called GENERIC_1M is added which has the old memory-mapping (but still changed to use littlefs for the filesystem). In summary there are now 3 esp8266 board definitions: - GENERIC_512K: for 512k modules, doesn't have a filesystem. - GENERIC_1M: for 1M modules, 572k for firmware+frozen code, 396k for filesystem (littlefs). - GENERIC: for 2M (or greater) modules, 968k for firmware+frozen code, 1M+ for filesystem (littlefs), FAT driver also included in firmware for use on, eg, external SD cards.
2020-04-04docs,tests: Add docs and test for uasyncio custom exc handler methods.Damien George
2020-04-04extmod/uasyncio: Add global exception handling methods.Kevin Köck
This commit adds support for global exception handling in uasyncio according to the CPython error handling: https://docs.python.org/3/library/asyncio-eventloop.html#error-handling-api This allows a program to receive exceptions from detached tasks and log them to an appropriate location, instead of them being printed to the REPL. The implementation preallocates a context dictionary so in case of an exception there shouldn't be any RAM allocation. The approach here is compatible with CPython except that in CPython the exception handler is called once the task that threw an uncaught exception is freed, whereas in MicroPython the exception handler is called immediately when the exception is thrown.
2020-04-02esp32/README.md: Fix typo in venv instructions.Jim Mussared
2020-04-02extmod/uasyncio: Add StreamReader/StreamWriter as aliases of Stream cls.Damien George
To be compatible with CPython. Fixes issue #5847.
2020-04-02extmod/uasyncio: Add error message to Lock.release's RuntimeError.Kevin Köck
Otherwise it can be hard to understand what the error is if a blank RuntimeError is raised.
2020-04-02extmod/uasyncio: Implement Loop.stop() to stop the event loop.Damien George
2020-04-01extmod/uasyncio: Don't create a Loop instance in get_event_loop().Damien George
The event loop is (for now) just a singleton so make it so that Loop instances are not needed.
2020-03-31unix/mpthreadport: Ensure enough thread stack to detect overflow.Damien George
Following up to 5e6cee07aba4fd73c13024f091a287171bea1f17, some systems (eg FreeBSD 12.0 64-bit) will crash if the stack-overflow margin is too small. It seems the margin of 8192 bytes (or thereabouts) is always needed. This commit adds this much margin if the requested stack size is too small. Fixes issue #5824.
2020-03-30tests/run-tests: Add commands to print and clean *.exp,out files.David Lechner
This adds a couple of commands to the run-tests script to print the diffs of failed tests and also to clean up the .exp and .out files after failed tests. (And a spelling error is fixed while we are touching nearby code.) Travis is also updated to use these new commands, including using it for more builds.
2020-03-30tests/float: Add new lexer test to test parsing of float without prefix.David Lechner
Since automatically formatting tests with black, we have lost one line of code coverage. This adds an explicit test to ensure we are testing the case that is no longer covered implicitly.
2020-03-30tests: Format all Python code with black, except tests in basics subdir.David Lechner
This adds the Python files in the tests/ directory to be formatted with ./tools/codeformat.py. The basics/ subdirectory is excluded for now so we aren't changing too much at once. In a few places `# fmt: off`/`# fmt: on` was used where the code had special formatting for readability or where the test was actually testing the specific formatting.
2020-03-30tests/micropython/heapalloc_fail_set.py: Remove extra trailing comma.David Lechner
Unlike tuples, sets do not need trailing comma when there is only one item.
2020-03-30travis: Build full unix coverage build on osx job.David Lechner
This should help catch more compile errors with the clang compiler.
2020-03-30all: Fix implicit casts of float/double, and signed comparison.David Lechner
These were found by buiding the unix coverage variant on macOS (so clang compiler). Mostly, these are fixing implicit cast of float/double to mp_float_t which is one of those two and one mp_int_t to size_t fix for good measure.
2020-03-30tools/pyboard.py: Add -d as an alias for --device.Lars Kellogg-Stedman
2020-03-30tools/pyboard.py: Support setting device/baudrate from shell env vars.Lars Kellogg-Stedman
Allow defaults for --device and --baudrate to be set in the environment using PYBOARD_DEVICE and PYBOARD_BAUDRATE.
2020-03-28tests/basics/dict_pop.py: Remove extra comma in call and fix grammar.David Lechner
2020-03-28all: Remove spaces inside and around parenthesis.Damien George
Using new options enabled in the uncrustify configuration.
2020-03-28travis: Build NUCLEO_L073RZ instead of B_L072Z_LRWAN1 for stm32 job.Damien George
The NUCLEO_L073RZ build is slightly bigger and this MCU has only 192k flash so this helps to catch flash overflow.
2020-03-28stm32/boards: Disable pend_throw, uheapq, utimeq on small-flash boards.Damien George
These are mainly used by the previous version of uasyncio which is now replaced by a newer version, with built-in C module _uasyncio. Saves about 1300 bytes of flash.
2020-03-28stm32/mpconfigport.h: Make most extended modules configurable by board.Damien George
2020-03-28travis: Use grep with --text on qemu-arm output.David Lechner
If the .out file contains non-text characters, grep won't show the output unless we ask nicely.
2020-03-28travis: Use custom PPA to get pre-built uncrustify.David Lechner
Use PPA so that we don't have to rebuild uncrustify from source, speeding up the job. This also requires not running this test on arm64.
2020-03-27unix: Implement PEP 475 to retry syscalls failing with EINTR.David Lechner
https://www.python.org/dev/peps/pep-0475/ This implements something similar to PEP 475 on the unix port, and for the VfsPosix class. There are a few differences from the CPython implementation: - Since we call mp_handle_pending() between any ENITR's, additional functions could be called if MICROPY_ENABLE_SCHEDULER is enabled, not just signal handlers. - CPython only handles signal on the main thread, so other threads will raise InterruptedError instead of retrying. On MicroPython, mp_handle_pending() will currently raise exceptions on any thread. A new macro MP_HAL_RETRY_SYSCALL is introduced to reduce duplicated code and ensure that all instances behave the same. This will also allow other ports that use POSIX-like system calls (and use, eg, VfsPosix) to provide their own implementation if needed.
2020-03-27unix/mpthreadport: Fix crash when thread stack size <= 8k.David Lechner
The stack size adjustment for detecting stack overflow in threads was not taking into account that the requested stack size could be <= 8k, in which case the subtraction would overflow. This is fixed in this commit by ensuring that the adjustment can't be more than the available size. This fixes the test tests/thread/thread_stacksize1.py which sometimes crashes with a segmentation fault because of an uncaught NLR jump, which is a "maximum recursion depth exceeded" exception. Suggested-by: @dpgeorge
2020-03-27stm32/mpconfigport.h: Remove unused root pointer for BTstack bindings.Damien George
This was a cut-and-paste error from the NimBLE bindings.
2020-03-26esp32: Enable and freeze uasyncio.Damien George
2020-03-26esp8266: Enable and freeze uasyncio.Damien George
Only included in GENERIC build.
2020-03-26stm32: Enable and freeze uasyncio.Damien George
2020-03-26extmod/uasyncio: Add manifest.py for freezing uasyncio Py files.Damien George
2020-03-26docs/library: Add initial docs for uasyncio module.Damien George
2020-03-26unix: Enable uasyncio C helper module on coverage build.Damien George
2020-03-26extmod/uasyncio: Add optional implementation of core uasyncio in C.Damien George
Implements Task and TaskQueue classes in C, using a pairing-heap data structure. Using this reduces RAM use of each Task, and improves overall performance of the uasyncio scheduler.
2020-03-26tests/net_inet: Add uasyncio internet tests.Damien George
2020-03-26tests/multi_net: Add uasyncio test for TCP server and client.Damien George
Includes a test where the (non uasyncio) client does a RST on the connection, as a simple TCP server/client test where both sides are using uasyncio, and a test for TCP stream close then write.
2020-03-26tests: Make default MICROPYPATH include extmod to find uasyncio.Damien George
2020-03-26travis: Exclude some uasyncio tests on OSX.Damien George
2020-03-26tests/run-tests: Skip uasyncio if no async, and skip one test on native.Damien George
2020-03-26tests/extmod: Add uasyncio tests.Damien George
All .exp files are included because they require CPython 3.8 which may not always be available.
2020-03-26extmod/uasyncio: Add new implementation of uasyncio module.Damien George
This commit adds a completely new implementation of the uasyncio module. The aim of this version (compared to the original one in micropython-lib) is to be more compatible with CPython's asyncio module, so that one can more easily write code that runs under both MicroPython and CPython (and reuse CPython asyncio libraries, follow CPython asyncio tutorials, etc). Async code is not easy to write and any knowledge users already have from CPython asyncio should transfer to uasyncio without effort, and vice versa. The implementation here attempts to provide good compatibility with CPython's asyncio while still being "micro" enough to run where MicroPython runs. This follows the general philosophy of MicroPython itself, to make it feel like Python. The main change is to use a Task object for each coroutine. This allows more flexibility to queue tasks in various places, eg the main run loop, tasks waiting on events, locks or other tasks. It no longer requires pre-allocating a fixed queue size for the main run loop. A pairing heap is used to queue Tasks. It's currently implemented in pure Python, separated into components with lazy importing for optional components. In the future parts of this implementation can be moved to C to improve speed and reduce memory usage. But the aim is to maintain a pure-Python version as a reference version.
2020-03-26stm32/softtimer: Initialise pairing-heap node before pushing to heap.Damien George
2020-03-26unix/coverage: Init all pairheap test nodes before using them.Damien George
2020-03-26py/pairheap: Add helper function to initialise a new node.Damien George
2020-03-26py/pairheap: Properly unlink node on pop and delete.Damien George
This fixes a bug in the pairing-heap implementation when nodes are deleted with mp_pairheap_delete and then reinserted later on.
2020-03-26travis: Print errors out for OSX job.Damien George
2020-03-26qemu-arm: Set default board as mps2-an385 to get more flash for tests.Damien George
And use Ubuntu bionic for qemu-arm Travic CI job.
2020-03-26py/mpconfig.h: Enable MICROPY_MODULE_GETATTR by default.Damien George
To enable lazy loading of submodules (among other things), which is very useful for MicroPython libraries that want to have optional subcomponents. Disabled explicitly on minimal ports.
2020-03-25ports: Add lib/libm/roundf.c to bare-metal Makefile's.Zoltán Vörös
This function is not used by the core but having it as part of the build allows it to be used by user C modules, or board extensions. The linker won't include it in the final firmware if it remains unused.