summaryrefslogtreecommitdiff
path: root/py/dynruntime.h
AgeCommit message (Collapse)Author
2021-04-28py/dynruntime.h: Add mp_obj_get_array() function.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-09-18py/dynruntime.h: Add mp_import_* and mp_load/store_*.Jim Mussared
These functions already exist in the fun table, and this commit just adds convenience macros for them.
2020-06-08py/dynruntime.h: Make mp_obj_str_get_str raise if arg not a str/bytes.Damien George
2020-04-05py/dynruntime.mk: Set MICROPY_ENABLE_DYNRUNTIME instead of per module.Jim Mussared
So this setting could be used by other source files if needed.
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-21py/dynruntime.h: Add implementation of mp_obj_cast_to_native_base.Damien George
2019-12-13py/dynruntime: Implement uint new/get, mp_obj_len and mp_obj_subscr.Damien George
2019-12-12py/dynruntime: Add support for float API to make/get floats.Damien George
We don't want to add a feature flag to .mpy files that indicate float support because it will get complex and difficult to use. Instead the .mpy is built using whatever precision it chooses (float or double) and the native glue API will convert between this choice and what the host runtime actually uses.
2019-12-12tools/mpy_ld.py: Add new mpy_ld.py tool and associated build files.Damien George
This commit adds a new tool called mpy_ld.py which is essentially a linker that builds .mpy files directly from .o files. A new header file (dynruntime.h) and makefile fragment (dynruntime.mk) are also included which allow building .mpy files from C source code. Such .mpy files can then be dynamically imported as though they were a normal Python module, even though they are implemented in C. Converting .o files directly (rather than pre-linked .elf files) allows the resulting .mpy to be more efficient because it has more control over the relocations; for example it can skip PLT indirection. Doing it this way also allows supporting more architectures, such as Xtensa which has specific needs for position-independent code and the GOT. The tool supports targets of x86, x86-64, ARM Thumb and Xtensa (windowed and non-windowed). BSS, text and rodata sections are supported, with relocations to all internal sections and symbols, as well as relocations to some external symbols (defined by dynruntime.h), and linking of qstrs.