summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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>
2022-04-29docs/renesas-ra: Add renesas-ra docs files.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29tests/run-tests.py: Update for renesas-ra port.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29tests/renesas-ra: Add tests for renesas-ra port.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29tools/ci.sh: Update for ports/renesas-ra.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29github/workflows: Add workflow for renesas-ra port.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29drivers/dht/dht.py: Change default import module as machine.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29renesas-ra: Add new port to Renesas RA.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29lib/fsp: Add renesas fsp git repository as submodule.TakeoTakahashi2020
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-28qemu-arm/mpconfigport: Define MICROPY_PY_SYS_PLATFORM.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-28py/modsys: Introduce sys.implementation._machine constant.Damien George
This contains a string useful for identifying the underlying machine. This string is kept consistent with the second part of the REPL banner via the new config option MICROPY_BANNER_MACHINE. This makes os.uname() more or less redundant, as all the information in os.uname() is now available in the sys module. Signed-off-by: Damien George <damien@micropython.org>
2022-04-28py/modsys: Rename sys.implementation.mpy to sys.implementation._mpy.Damien George
Per CPython docs, non-standard attributes must begin with an underscore. Signed-off-by: Damien George <damien@micropython.org>
2022-04-28py/modsys: Append MicroPython git version and build date to sys.version.Damien George
This commit adds the git hash and build date to sys.version. This is allowed according to CPython docs, and is what PyPy does. The docs state: A string containing the version number of the Python interpreter plus additional information on the build number and compiler used. Eg on CPython: Python 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.version '3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]' and PyPy: Python 2.7.12 (5.6.0+dfsg-4, Nov 20 2016, 10:43:30) [PyPy 5.6.0 with GCC 6.2.0 20161109] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>> import sys >>>> sys.version '2.7.12 (5.6.0+dfsg-4, Nov 20 2016, 10:43:30)\n[PyPy 5.6.0 with GCC ... With this commit on MicroPython we now have: MicroPython v1.18-371-g9d08eb024 on 2022-04-28; linux [GCC 11.2.0] v... Use Ctrl-D to exit, Ctrl-E for paste mode >>> import sys >>> sys.version '3.4.0; MicroPython v1.18-371-g9d08eb024 on 2022-04-28' Note that the start of the banner is the same as the end of sys.version. This helps to keep code size under control because the string can be reused by the compiler. Signed-off-by: Damien George <damien@micropython.org>
2022-04-28stm32/boards/NUCLEO_G0B1RE: Add NUCLEO_G0B1RE board definition.Asensio Lorenzo Sempere
This commit adds a board definition for NUCLEO_G0B1RE. This board has the REPL on UART2 which is connected to the on-board ST-link USB-UART. Signed-off-by: Asensio Lorenzo Sempere <asensio.aerospace@gmail.com>
2022-04-28stm32: Add support for G0 MCUs.Asensio Lorenzo Sempere
This commit adds support for the STM32G0 series of MCUs. Signed-off-by: Asensio Lorenzo Sempere <asensio.aerospace@gmail.com>