summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-05-18esp8266: Make port-specific modules use MP_REGISTER_MODULE.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18esp32: Make port-specific modules use MP_REGISTER_MODULE.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18stm32: Make port-specific modules use MP_REGISTER_MODULE.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18extmod: Make port-included extmod modules use MP_REGISTER_MODULES.Jim Mussared
_onewire, socket, and network were previously added by the port rather than objmodule.c. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18py: Make builtin modules use MP_REGISTER_MODULE.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18extmod: Make extmod modules use MP_REGISTER_MODULE.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18py/makemoduledefs.py: Allow multiple ways to register a module.Jim Mussared
For example, ussl can come from axtls or mbedtls. If neither are enabled then don't try and set an empty definition twice, and only include it once in MICROPY_REGISTERED_MODULES. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18github/ISSUE_TEMPLATE: Add GitHub issue templates and external links.Jim Mussared
When opening a new issue the following selection is now shown: - Bug reports - Feature requests - Security issue - Documentation issue - Link to forum - Link to docs - Link to downloads
2022-05-18py/parse: Allow all constant objects to be used in "X = const(o)".Damien George
Now that constant tuples are supported in the parser, eg (1, True, "str"), it's a small step to allow anything that is a constant to be used with the pattern: from micropython import const X = const(obj) This commit makes the required changes to allow the following types of constants: from micropython import const _INT = const(123) _FLOAT = const(1.2) _COMPLEX = const(3.4j) _STR = const("str") _BYTES = const(b"bytes") _TUPLE = const((_INT, _STR, _BYTES)) _TUPLE2 = const((None, False, True, ..., (), _TUPLE)) Prior to this, only integers could be used in const(...). Signed-off-by: Damien George <damien@micropython.org>
2022-05-18tests/micropython: Add more test cases for native generators.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-18tests/extmod: Use bytearray instead of bytes for uctypes test.Damien George
Because the test modifies the (now) bytearray object, and if it's a bytes object it's not guaranteed that it can be modified, or that this constant object isn't used elsewhere. Signed-off-by: Damien George <damien@micropython.org>
2022-05-18py/compile: De-duplicate constant objects in module's constant table.Damien George
The recent rework of bytecode made all constants global with respect to the module (previously, each function had its own constant table). That means the constant table for a module is shared among all functions/methods/etc within the module. This commit add support to the compiler to de-duplicate constants in this module constant table. So if a constant is used more than once -- eg 1.0 or (None, None) -- then the same object is reused for all instances. For example, if there is code like `print(1.0, 1.0)` then the parser will create two independent constants 1.0 and 1.0. The compiler will then (with this commit) notice they are the same and only put one of them in the constant table. The bytecode will then reuse that constant twice in the print expression. That allows the second 1.0 to be reclaimed by the GC, also means the constant table has one less entry so saves a word. Signed-off-by: Damien George <damien@micropython.org>
2022-05-18tests/micropython: Fully unlink nested list in extreme exc test.Damien George
To make sure there are no dangling references to the lists, and the GC can reclaim heap memory. Signed-off-by: Damien George <damien@micropython.org>
2022-05-17py/compile: Allow new qstrs to be allocated at all compiler passes.Damien George
Prior to this commit, all qstrs were required to be allocated (by calling mp_emit_common_use_qstr) in the MP_PASS_SCOPE pass (the first one). But this is an unnecessary restriction, which is lifted by this commit. Lifting the restriction simplifies the compiler because it can allocate qstrs in later passes. This also generates better code, because in some cases (eg when a variable is closed over) the scope of an identifier is not known until a bit later and then the identifier no longer needs its qstr allocated in the global table. Code size is reduced for all ports with this commit. Signed-off-by: Damien George <damien@micropython.org>
2022-05-17py/emitnative: Put a pointer to the native prelude in child_table array.Damien George
Some architectures (like esp32 xtensa) cannot read byte-wise from executable memory. This means the prelude for native functions -- which is usually located after the machine code for the native function -- must be placed in separate memory that can be read byte-wise. Prior to this commit this was achieved by enabling N_PRELUDE_AS_BYTES_OBJ for the emitter and MICROPY_EMIT_NATIVE_PRELUDE_AS_BYTES_OBJ for the runtime. The prelude was then placed in a bytes object, pointed to by the module's constant table. This behaviour is changed by this commit so that a pointer to the prelude is stored either in mp_obj_fun_bc_t.child_table, or in mp_obj_fun_bc_t.child_table[num_children] if num_children > 0. The reasons for doing this are: 1. It decouples the native emitter from runtime requirements, the emitted code no longer needs to know if the system it runs on can/can't read byte-wise from executable memory. 2. It makes all ports have the same emitter behaviour, there is no longer the N_PRELUDE_AS_BYTES_OBJ option. 3. The module's constant table is now used only for actual constants in the Python code. This allows further optimisations to be done with the constants (eg constant deduplication). Code size change for those ports that enable the native emitter: unix x64: +80 +0.015% stm32: +24 +0.004% PYBV10 esp8266: +88 +0.013% GENERIC esp32: -20 -0.002% GENERIC[incl -112(data)] rp2: +32 +0.005% PICO Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tools/ci.sh: For esp8266 CI install esptool 3.3.1.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tools/ci.sh: Run full test suite on stackless and settrace builds.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests/multi_net: Skip SSL test if relevant modules aren't available.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests/run-tests.py: Exclude settrace tests when using native emitter.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests/thread: Use less resources for stress_aes if settrace enabled.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17py/bc: Provide separate code-state setup funcs for bytecode and native.Damien George
mpy-cross will now generate native code based on the size of mp_code_state_native_t, and the runtime will use this struct to calculate the offset of the .state field. This makes native code generation and execution (which rely on this struct) independent to the settings MICROPY_STACKLESS and MICROPY_PY_SYS_SETTRACE, both of which change the size of the mp_code_state_t struct. Fixes issue #5059. Signed-off-by: Damien George <damien@micropython.org>
2022-05-17py/asmx64: Support full range of regs in asm_x64_lea_disp_to_r64.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests/run-perfbench.py: Return error code if any test fails on target.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests/perf_bench: Update .mpy file header to remove old unicode flag.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17docs/reference/mpyfiles: Remove docs about mpy flags and qstr win size.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17py/persistentcode: Remove unicode feature flag from .mpy file.Damien George
Prior to this commit, even with unicode disabled .py and .mpy files could contain unicode characters, eg by entering them directly in a string as utf-8 encoded. The only thing the compiler disallowed (with unicode disabled) was using \uxxxx and \Uxxxxxxxx notation to specify a character within a string with value >= 0x100; that would give a SyntaxError. With this change mpy-cross will now accept \u and \U notation to insert a character with value >= 0x100 into a string (because the -mno-unicode option is now gone, there's no way to forbid this). The runtime will happily work with strings with such characters, just like it already works with strings with characters that were utf-8 encoded directly. This change simplifies things because there are no longer any feature flags in .mpy files, and any bytecode .mpy will now run on any target. Signed-off-by: Damien George <damien@micropython.org>
2022-05-17py/persistentcode: Remove obsolete comment about qstr window size.Damien George
This was made obsolete in f2040bfc7ee033e48acef9f289790f3b4e6b74e5 Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tools/mpy_ld.py: Remove obsolete QSTR_WINDOW_SIZE constant.Damien George
This was made obsolete in f2040bfc7ee033e48acef9f289790f3b4e6b74e5 Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests: Fix tests to use sys.implementation._mpy.Damien George
The field was renamed to _mpy in 59c5d4161120db28bc6cbc7653f2e7fdb4a87370 Signed-off-by: Damien George <damien@micropython.org>
2022-05-06tools/autobuild: Update for ports/renesas-ra.Takeo Takahashi
* Add build_renesas_ra_boards call in autobuild.sh * Add build_renesas_ra_boards function to generate firmware.hex. Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-05-05top: Update .git-blame-ignore-revs for latest formatting commit.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05all: Reformat remaining C code that doesn't have a space after a comma.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05tools/uncrustify: Make sure a space exists after a comma.Damien George
This will add a space after a comma if it doesn't have one, but will allow more than one space if the spaces are already there. Signed-off-by: Damien George <damien@micropython.org>
2022-05-05extmod: Move font_petme128_8x8.h from ports/stm32 to extmod.Damien George
And add spaces after commas so it is consistently formatted. Signed-off-by: Damien George <damien@micropython.org>
2022-05-05py/objmodule: Move stray #include to top of file.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05mimxrt/mbedtls: Use core-provided tracked alloc instead of custom funcs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05stm32/mbedtls: Use core-provided tracked alloc instead of custom funcs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-05py/malloc: Introduce m_tracked_calloc, m_tracked_free functions.Damien George
Enabled by MICROPY_TRACKED_ALLOC. Signed-off-by: Damien George <damien@micropython.org>
2022-05-04renesas-ra: Rename pyb_rtc_ to machine_rtc_.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-05-04renesas-ra: Rename pyb_uart_ to machine_uart_.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-05-04windows: Avoid busy loop when using scheduler.stijn
2022-05-04windows: Consolidate all sleep-related functions into windows_mphal.c.stijn
Replace the timer-based sleep with the standard win32 call since the former has no benefits: even though it allows specifying the time in 100uSec chunks, the actual resolution is still limited by the OS and is never better than 1mSec. For clarity move all of this next to the mp_hal_delay_ms definition so all related functions are in one place.
2022-05-03tests/extmod: Increase timing on uasyncio tests to make more reliable.Damien George
Non-real-time systems like Windows, Linux and macOS do not have reliable timing, so increase the sleep intervals to make these tests more likely to pass. Signed-off-by: Damien George <damien@micropython.org>
2022-05-03all: Use mp_obj_malloc everywhere it's applicable.Jim Mussared
This replaces occurences of foo_t *foo = m_new_obj(foo_t); foo->base.type = &foo_type; with foo_t *foo = mp_obj_malloc(foo_t, &foo_type); Excludes any places where base is a sub-field or when new0/memset is used. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-03py/objfloat: Explain why mp_obj_malloc isn't used.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-03py/obj: Introduce mp_obj_malloc macro to allocate, and set object type.Jim Mussared
This is to replace the following: mp_foo_obj_t *self = m_new_obj(mp_foo_obj_t); self->base.type = &mp_type_foo; with: mp_foo_obj_t *self = mp_obj_malloc(mp_foo_obj_t, &mp_type_foo); Calling the function is less code than inlining setting the type everywhere, adds up to ~100 bytes on PYBV11. It also helps to avoid an easy mistake of forgetting to set the type. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-03py/emitcommon: Don't implicitly close class vars that are assigned to.Damien George
When in a class body or at the module level don't implicitly close over variables that have been assigned to. Fixes issue #8603. Signed-off-by: Damien George <damien@micropython.org>
2022-05-03docs/renesas-ra: Remove unused image files.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-05-02renesas-ra/boards: Change device name information to show properly.Takeo Takahashi
* Change device name table to list style to show properly. * Change the link of cable connection information to the latest. Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29docs: Update files for renesas-ra port.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>