aboutsummaryrefslogtreecommitdiff
path: root/mpy-cross
AgeCommit message (Collapse)Author
2021-02-04all: Rename BYTES_PER_WORD to MP_BYTES_PER_OBJ_WORD.Damien George
The "word" referred to by BYTES_PER_WORD is actually the size of mp_obj_t which is not always the same as the size of a pointer on the target architecture. So rename this config value to better reflect what it measures, and also prefix it with MP_. For uses of BYTES_PER_WORD in setting the stack limit this has been changed to sizeof(void *), because the stack usually grows with machine-word sized values (eg an nlr_buf_t has many machine words in it). Signed-off-by: Damien George <damien@micropython.org>
2021-01-30py/persistentcode: Introduce MICROPY_PERSISTENT_CODE_SAVE_FILE option.David CARLIER
This should be enabled when the mp_raw_code_save_file function is needed. It is enabled for mpy-cross, and a check for defined(__APPLE__) is added to cover Mac M1 systems.
2020-10-22mpy-cross: Enable more warnings.Emil Renner Berthing
2020-04-30all: Fix auto-enable of MICROPY_GCREGS_SETJMP to select GC behaviour.Damien George
Only enable it if MICROPY_GCREGS_SETJMP is not already defined, and no supported architecture is defined.
2020-04-29all: Factor gchelper code to one place and use it for unix & ARM ports.Jim Mussared
No functionality change is intended with this commit, it just consolidates the separate implementations of GC helper code to the lib/utils/ directory as a general set of helper functions useful for any port. This reduces duplication of code, and makes it easier for future ports or embedders to get the GC implementation correct. Ports should now link against gchelper_native.c and either gchelper_m0.s or gchelper_m3.s (currently only Cortex-M is supported but other architectures can follow), or use the fallback gchelper_generic.c which will work on x86/x64/ARM. The gc_helper_get_sp function from gchelper_m3.s is not really GC related and was only used by cc3200, so it has been moved to that port and renamed to cortex_m3_get_sp.
2020-04-23all: Format code to add space after C++-style comment start.stijn
Note: the uncrustify configuration is explicitly set to 'add' instead of 'force' in order not to alter the comments which use extra spaces after // as a means of indenting text for clarity.
2020-04-16mpy-cross/main: Print uncaught nlr jump to stderr.David Lechner
This is to be consistent with the same change in the unix port, 4ab8bee82f7d095c10c624de93da12a7aa1af8fd.
2020-04-16mpy-cross/main: Fix stderr_print_strn parameter type.David Lechner
Change mp_uint_t to size_t to match the mp_print_strn_t function prototype. This fixes a compiler warning when mp_uint_t and size_t are not the same size.
2020-03-28all: Remove spaces inside and around parenthesis.Damien George
Using new options enabled in the uncrustify configuration.
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.
2019-12-09mpy-cross/README.md: Add notes about -march and -O.Jim Mussared
2019-12-03mpy-cross: Support armv7em, armv7emsp, armv7emdp architectures.Damien George
2019-10-05mpy-cross: Enable Xtensa-Windowed native emitter.Damien George
Selectable via the command line: -march=xtensawin.
2019-09-26mpy-cross: Set number of registers in nlr_buf_t based on native arch.Damien George
Fixes #5059. Done in collaboration with Jim Mussared.
2019-09-18mpy-cross,windows: Add msvc build of mpy-cross.stijn
Add the project file to the mpy-cross directory, which is also where the executable ends up, and change the Appveyor settings to build mpy-cross with both msvc and mingw-w64 and verify this all works by running tests with --via-mpy.
2019-09-18mpy-cross: Make mpconfigport.h compatible with msvc compiler.stijn
Add a copy of the required options from windows/mpconfigport.h.
2019-08-28py: Add global default_emit_opt variable to make emit kind persistent.Damien George
mp_compile no longer takes an emit_opt argument, rather this setting is now provided by the global default_emit_opt variable. Now, when -X emit=native is passed as a command-line option, the emitter will be set for all compiled modules (included imports), not just the top-level script. In the future there could be a way to also set this variable from a script. Fixes issue #4267.
2019-08-28mpy-cross/main: Only accept full emit cmdline options if native enabled.Damien George
2019-06-03mpy-cross: Do not automatically build mpy-cross, rather do it manually.Damien George
Building mpy-cross automatically leads to some issues with the build process and slows it down. Instead, require it to be built manually.
2019-05-24mpy-cross/mpconfigport.h: Remove defn of MP_NOINLINE to use global one.Damien George
A global definition of MP_NOINLINE was added to py/mpconfig.h long ago in 0f5bf1aafe0ca073d958f271bd96addc6da8fe10
2019-05-07mpy-cross: Add --version command line option to print version info.Damien George
Prints something like: MicroPython v1.10-304-g8031b7a25 on 2019-05-02; mpy-cross emitting mpy v4
2019-05-01mpy-cross: Automatically select ARMV6 arch when running on such a host.Damien George
2019-03-26mpy-cross: Support compiling with MICROPY_PY___FILE__ enabled.Damien George
2019-03-14mpy-cross: Add "-march=<arch>" option to select native emitter.Damien George
2019-03-08py: Update and rework build system for including external C modules.Andrew Leech
How to use this feature is documented in docs/develop/cmodules.rst.
2019-03-08mpy-cross: Enable building of x64 native .mpy files.Damien George
2018-08-14mpy-cross/Makefile: Also undefine MICROPY_FORCE_32BIT and CROSS_COMPILE.Paul Sokolovsky
mpy-cross is a host, not target binary. It should not be build with the target compiler, compiler options and other settings. For example, If someone currently tries to build from pristine checkout the unix port with the following command: make CROSS_COMPILE=arm-linux-gnueabihf- then mpy-cross will be built with arm-linux-gnueabihf-gcc and of course won't run on the host, leading to overall build failure. This situation was worked around for some options in 1d8c3f4cff1, so add MICROPY_FORCE_32BIT and CROSS_COMPILE to that set too.
2018-07-10mpy-cross: Make build independent of extmod directory.Damien George
mpy-cross doesn't depend on any code in the extmod directory so completely exclude it from the build (extmod may still be scanned for qstrs but that is controlled by py/py.mk). This speeds up the build a little, and improves abstraction of this component. Also, make -I$(BUILD) take precedence over -I$(TOP) in case there are stray files in the root directory that would be picked up.
2017-10-04all: Remove inclusion of internal py header files.Damien George
Header files that are considered internal to the py core and should not normally be included directly are: py/nlr.h - internal nlr configuration and declarations py/bc0.h - contains bytecode macro definitions py/runtime0.h - contains basic runtime enums Instead, the top-level header files to include are one of: py/obj.h - includes runtime0.h and defines everything to use the mp_obj_t type py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h, and defines everything to use the general runtime support functions Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-09-06all: Update Makefiles and others to build with new ports/ dir layout.Damien George
Also renames "stmhal" to "stm32" in documentation and everywhere else.
2017-08-11all: Make use of $(TOP) variable in Makefiles, instead of "..".Damien George
$(TOP) is defined in py/mkenv.mk and should be used to refer to the top level of this repository.
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-07-24all: Don't include system errno.h when it's not needed.Damien George
2017-07-19all: Remove trailing spaces, per coding conventions.Damien George
2017-05-26mpy-cross/Makefile: Guard "override undefine" by test for make feature.Damien George
make v3.81 doesn't have "undefine" so we can't use it with that version.
2017-05-11mpy-cross/Makefile: Override undefine any inherited variables.Damien George
This is a temporary hack to allow othe Makefiles to build mpy-cross recursively.
2017-05-03mpy-cross: Fix compiler detection for including windows/fmode.cstijn
fmode.c should only be included for builds targetting 'pure' windows, i.e. msvc or mingw builds but not when using msys or cygwin's gcc (see #2298). Just checking if the OS is windows and UNAME doesn't have msys stil leaves the gate open for builds with cygwin's gcc since UNAME there is e.g. CYGWIN_NT-6.1-WOW. Fix this by checking for 'mingw' explicitly in the compiler version; both gcc and clang have the -dumpmachine flag so the check should be ok for all platforms.
2017-04-22mpy-cross, unix, windows, stmhal: Enable return-if-else optimisation.Damien George
Prior to making this a config option it was previously available on these (and all other) ports, and it makes sense to keep it enabled for mpy-cross as well as ports that have a decent amount of space for the code.
2017-04-01all: Move BYTES_PER_WORD definition from ports to py/mpconfig.hDamien George
It can still be overwritten by a port in mpconfigport.h but for almost all cases one can use the provided default.
2017-03-23all/Makefile: Remove -ansi from GCC flags, its ignored anyway.Krzysztof Blazewicz
The -ansi flag is used for C dialect selection and it is equivalent to -std=c90. Because it goes right before -std=gnu99 it is ignored as for conflicting flags GCC always uses the last one.
2017-03-14mpy-cross/main: Move lexer constructor to within NLR handler block.Damien George
2016-11-16mpy-cross: Get compiling after recent persistent code refactors.Damien George
2016-09-05mpy-cross: Don't use the internal printf functions.Damien George
They require mp_hal_stdout_tx_strn_cooked, which requires extra work to add to mpy-cross.
2016-08-15ports: Remove typedef of machine_ptr_t, it's no longer needed.Damien George
This type was used only for the typedef of mp_obj_t, which is now defined by the object representation. So we can now remove this unused typedef, to simplify the mpconfigport.h file.
2016-07-30mpy-cross: Fix mingw and msys2 compilationstijn
When compiling with msys2's gcc there's no need to apply the binary fmode so adjust the Makefile to reflect that. When compiling with mingw we need to include malloc.h since there is no alloca.h, and the 64bit detection in mpconfigport.h needs some adjustment.
2016-07-22mpy-cross: Use binary file translation mode for creating mpy files on windowsstijn
This is a fix for https://github.com/micropython/micropython/issues/2209: by default a file created using open() uses text translation mode so writing \n to it will result in the file having \r\n. This is obviously problematic for binary .mpy files, so provide functions for setting the open mode and use binary mode in mpy-cross' main().
2016-07-11mpy-cross: Fix Makefile to handle gc-sections linker flags on OS X.Anton Sokolchenko
2016-06-28py: Add MP_STATE_THREAD to hold state specific to a given thread.Damien George
2016-05-23mpy-cross: Add -s option to specify the embedded source filename.Damien George
.mpy files contain the name of the source file that they were compiled from. This patch adds a way to change this name to an arbitrary string, specified on the command line with the -s option. The default is to use the full name of the input filename. This new -s option is useful to strip off a leading directory name so that mpy-tool.py can freeze packages.
2016-03-09mpy-cross: Remove setting of MICROPY_FORCE_32BIT=1 from Makefile.Damien George
Building in 32-bit mode was only to reduce binary size on 64-bit machines and is otherwise not needed. Having it forced to 32-bit meant an unnecessary dependency on 32-bit libraries that is now removed.