Skip to content
Snippets Groups Projects
  1. Mar 08, 2019
    • Damien George's avatar
      py: Add support to save native, viper and asm code to .mpy files. · 1396a026
      Damien George authored
      This commit adds support for saving and loading .mpy files that contain
      native code (native, viper and inline-asm).  A lot of the ground work was
      already done for this in the form of removing pointers from generated
      native code.  The changes here are mainly to link in qstr values to the
      native code, and change the format of .mpy files to contain native code
      blocks (possibly mixed with bytecode).
      
      A top-level summary:
      
      - @micropython.native, @micropython.viper and @micropython.asm_thumb/
        asm_xtensa are now allowed in .py files when compiling to .mpy, and they
        work transparently to the user.
      
      - Entire .py files can be compiled to native via mpy-cross -X emit=native
        and for the most part the generated .mpy files should work the same as
        their bytecode version.
      
      - The .mpy file format is changed to 1) specify in the header if the file
        contains native code and if so the architecture (eg x86, ARMV7M, Xtensa);
        2) for each function block the kind of code is specified (bytecode,
        native, viper, asm).
      
      - When native code is loaded from a .mpy file the native code must be
        modified (in place) to link qstr values in, just like bytecode (see
        py/persistentcode.c:arch_link_qstr() function).
      
      In addition, this now defines a public, native ABI for dynamically loadable
      native code generated by other languages, like C.
      1396a026
  2. Oct 13, 2018
  3. Sep 30, 2018
  4. Sep 27, 2018
  5. Aug 16, 2018
  6. Aug 04, 2018
    • Damien George's avatar
      py/emitnative: Fix x86 native zero checks by comparing full word. · 10830059
      Damien George authored
      On x86 archs (both 32 and 64 bit) a bool return value only sets the 8-bit
      al register, and the higher bits of the ax register have an undefined
      value.  When testing the return value of such cases it is required to just
      test al for zero/non-zero.  On the other hand, checking for truth or
      zero/non-zero on an integer return value requires checking all bits of the
      register.  These two cases must be distinguished and handled correctly in
      generated native code.  This patch makes sure of this.
      
      For other supported native archs (ARM, Thumb2, Xtensa) there is no such
      distinction and this patch does not change anything for them.
      10830059
  7. Apr 10, 2018
    • Damien George's avatar
      py: Refactor how native emitter code is compiled with a file per arch. · ef12a4bd
      Damien George authored
      Instead of emitnative.c having configuration code for each supported
      architecture, and then compiling this file multiple times with different
      macros defined, this patch adds a file per architecture with the necessary
      code to configure the native emitter.  These files then #include the
      emitnative.c file.
      
      This simplifies emitnative.c (which is already very large), and simplifies
      the build system because emitnative.c no longer needs special handling for
      compilation and qstr extraction.
      ef12a4bd
  8. Nov 15, 2017
  9. Jul 31, 2017
  10. Jul 18, 2017
    • Alexander Steffen's avatar
      all: Unify header guard usage. · 299bc625
      Alexander Steffen authored
      The code conventions suggest using header guards, but do not define how
      those should look like and instead point to existing files. However, not
      all existing files follow the same scheme, sometimes omitting header guards
      altogether, sometimes using non-standard names, making it easy to
      accidentally pick a "wrong" example.
      
      This commit ensures that all header files of the MicroPython project (that
      were not simply copied from somewhere else) follow the same pattern, that
      was already present in the majority of files, especially in the py folder.
      
      The rules are as follows.
      
      Naming convention:
      * start with the words MICROPY_INCLUDED
      * contain the full path to the file
      * replace special characters with _
      
      In addition, there are no empty lines before #ifndef, between #ifndef and
      one empty line before #endif. #endif is followed by a comment containing
      the name of the guard macro.
      
      py/grammar.h cannot use header guards by design, since it has to be
      included multiple times in a single C file. Several other files also do not
      need header guards as they are only used internally and guaranteed to be
      included only once:
      * MICROPY_MPHALPORT_H
      * mpconfigboard.h
      * mpconfigport.h
      * mpthreadport.h
      * pin_defs_*.h
      * qstrdefs*.h
      299bc625
  11. Dec 09, 2016
  12. Nov 27, 2016
  13. Oct 19, 2015
  14. Apr 07, 2015
    • Damien George's avatar
      py: Implement full func arg passing for native emitter. · 9988618e
      Damien George authored
      This patch gets full function argument passing working with native
      emitter.  Includes named args, keyword args, default args, var args
      and var keyword args.  Fully Python compliant.
      
      It reuses the bytecode mp_setup_code_state function to do all the hard
      work.  This function is slightly adjusted to accommodate native calls,
      and the native emitter is forced a bit to emit similar prelude and
      code-info as bytecode.
      9988618e
  15. Mar 02, 2015
  16. Feb 25, 2015
  17. Feb 24, 2015
  18. Feb 16, 2015
  19. Jan 01, 2015
  20. Sep 29, 2014
  21. Sep 07, 2014
  22. Jul 03, 2014
  23. May 07, 2014
  24. May 03, 2014
    • Damien George's avatar
      Add license header to (almost) all files. · 04b9147e
      Damien George authored
      Blanket wide to all .c and .h files.  Some files originating from ST are
      difficult to deal with (license wise) so it was left out of those.
      
      Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
      04b9147e
  25. Apr 21, 2014
  26. Apr 18, 2014
  27. Apr 12, 2014
  28. Apr 10, 2014
  29. Apr 08, 2014
  30. Jan 06, 2014
  31. Nov 03, 2013
  32. Oct 05, 2013
Loading