- Dec 11, 2017
-
-
Damien George authored
For consistency this helper function is renamed to match the other exception helpers, and moved to their location in runtime.c.
-
- Dec 10, 2017
-
-
Paul Sokolovsky authored
A long overdue overview of preparing packages, installing them with upip, freezing, dealing with resources. Initial version, more iterations required.
-
Paul Sokolovsky authored
This function was implemented as an experiment, and was enabled only in unix port. To remind, it allows to access arbitrary files frozen as source modules (vs bytecode). However, further experimentation showed that the same functionality can be implemented with frozen bytecode. The process requires more steps, but with suitable toolset it doesn't matter patch. This process is: 1. Convert binary files into "Python resource module" with tools/mpy_bin2res.py. 2. Freeze as the bytecode. 3. Use micropython-lib's pkg_resources.resource_stream() to access it. In other words, the extra step is using tools/mpy_bin2res.py (because there would be wrapper for uio.resource_stream() anyway). Going frozen bytecode route allows more flexibility, and same/additional efficiency: 1. Frozen source support can be disabled altogether for additional code savings. 2. Resources could be also accessed as a buffer, not just as a stream. There're few caveats too: 1. It wasn't actually profiled the overhead of storing a resource in "Python resource module" vs storing it directly, but it's assumed that overhead is small. 2. The "efficiency" claim above applies to the case when resource file is frozen as the bytecode. If it's not, it actually will take a lot of RAM on loading. But in this case, the resource file should not be used (i.e. generated) in the first place, and micropython-lib's pkg_resources.resource_stream() implementation has the appropriate fallback to read the raw files instead. This still poses some distribution issues, e.g. to deployable to baremetal ports (which almost certainly would require freezeing as the bytecode), a distribution package should include the resource module. But for non-freezing deployment, presense of resource module will lead to memory inefficiency. All the discussion above reminds why uio.resource_stream() was implemented in the first place - to address some of the issues above. However, since then, frozen bytecode approach seems to prevail, so, while there're still some issues to address with it, this change is being made. This change saves 488 bytes for the unix x86_64 port.
-
- Dec 09, 2017
-
-
Paul Sokolovsky authored
This target removes any stray files (i.e. something not committed to git) from scripts/ and modules/ dirs (or whatever FROZEN_DIR and FROZEN_MPY_DIR is set to). The expected workflow is: 1. make clean-frozen 2. micropython -m upip -p modules <packages_to_freeze> 3. make As it can be expected that people may drop random thing in those dirs which they can miss later, the content is actually backed up before cleaning.
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
This is second part of fun_bc_call() vs mp_obj_fun_bc_prepare_codestate() common code refactor. This factors out code to initialize codestate object. After this patch, mp_obj_fun_bc_prepare_codestate() is effectively DECODE_CODESTATE_SIZE() followed by allocation followed by INIT_CODESTATE(), and fun_bc_call() starts with that too.
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
fun_bc_call() starts with almost the same code as mp_obj_fun_bc_prepare_codestate(), the only difference is a way to allocate the codestate object (heap vs stack with heap fallback). Still, would be nice to avoid code duplication to make further refactoring easier. So, this commit factors out the common code before the allocation - decoding and calculating codestate size. It produces two values, so structured as a macro which writes to 2 variables passed as arguments.
-
- Dec 08, 2017
-
-
Paul Sokolovsky authored
Or it will be truncated on a 64-bit platform.
-
Paul Sokolovsky authored
To allow easier override it for custom tracing.
-
Paul Sokolovsky authored
E.g.: >>> 1+1 binary 26 __add__ 3 3 Output is similar to bytecode dump (numeric code, then op name).
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
Tinytest library was misplaced under tools/. By convention, any target libraries belong to lib/, while tools/ contains host-side tools.
-
Paul Sokolovsky authored
Command-line argc and argv should be passed, and as we don't have them, placeholders were passed, but incorrectly. As we don't have them, just pass 0/NULL. Looking at the source, this migh lead to problems under Windows, but this test doesn't run under Windows. Also, use "%d" printf format consistently with the rest of the codebase.
-
Paul Sokolovsky authored
-
Damien George authored
The assembler back-end for most architectures needs to know if a jump is backwards in order to emit optimised machine code, and they do this by checking if the destination label has been set or not. So always reset label offsets to -1 (this reverts partially the previous commit, with some minor optimisation for the if-logic with the pass variable).
-
Damien George authored
Clearing the labels to -1 is purely a debugging measure. For release builds there is no need to do it as the label offset table should always have the correct value assigned.
-
- Dec 07, 2017
-
-
Paul Sokolovsky authored
Accessing them will crash immediately instead still working for some time, until overwritten by some other data, leading to much less deterministic crashes.
-
Paul Sokolovsky authored
This is mostly a workaround for forceful rebuilding of mpy-cross on every codebase change. If this file has debug logging enabled (by patching), mpy-cross build failed.
-
Paul Sokolovsky authored
Error out if they're set incompatibly.
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
Before that, the output was truncated to 32 bits. Only "%x" format is handled, because a typical use is for addresses. This refactor actually decreased x86_64 code size by 30 bytes.
-
Paul Sokolovsky authored
Before, the output was truncated to 32 bits.
-
- Dec 06, 2017
-
-
Paul Sokolovsky authored
Lack of spaces between them led to weird option artifacts like -Ifoo-Dbar.
-
Paul Sokolovsky authored
-
- Dec 05, 2017
-
-
Paul Sokolovsky authored
-
Damien George authored
This allows the function to raise an exception when unknown keyword args are passed in. This patch also reduces code size by (in bytes): bare-arm: -24 minimal x86: -76 unix x64: -56 unix nanbox: -84 stm32: -40 esp8266: -68 cc3200: -48 Furthermore, this patch adds space (" ") to the set of ROM qstrs which means it doesn't need to be put in RAM if it's ever used.
-
- Dec 04, 2017
-
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
Return the result of called function. If exception happened, return MP_OBJ_NULL. Allows to use mp_call_function_*_protected() with callbacks returning values, etc.
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
Similar to existing m_new_obj_with_finaliser().
-
- Dec 03, 2017
-
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
This is the proper fix for https://github.com/micropython/micropython/issues/3442.
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
-
- Dec 01, 2017
-
-
Paul Sokolovsky authored
Required for #include <zephyr.h> to work.
-
Damien George authored
5-pin JTAG and 2-pin SWD are logically separate interfaces so encode them in the AF tables as separate entries (separated by /, not -).
-
Damien George authored
Based on ST datasheet, DocID029041 Rev 3, DM00273119.pdf.
-