Commit Graph

37 Commits

Author SHA1 Message Date
Diego Elio Pettenò 34b4993d63 Add license to some obvious files. 2020-07-06 19:16:25 +01:00
Dan Halbert 0d27f4d9a6 continued WIP: almost compiling 2018-07-12 14:13:51 -04:00
Dan Halbert 7c219600a2 WIP: after merge; before testing 2018-07-11 16:45:30 -04:00
Damien George ef12a4bd05 py: Refactor how native emitter code is compiled with a file per arch.
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.
2018-04-10 15:06:47 +10:00
Damien George 564a95cb04 py/emitnative: Clean up asm macro names so they have dest as first arg.
All the asm macro names that convert a particular architecture to a generic
interface now follow the convention whereby the "destination" (usually a
register) is specified first.
2017-11-15 11:46:49 +11:00
Dan Halbert ef61b5ecb5 Initial merge of micropython v1.9.2 into circuitpython 2.0.0 (in development) master.
cpx build compiles and loads and works in repl; test suite not run yet
esp8266 not tested yet
2017-08-25 22:17:07 -04:00
Alexander Steffen 55f33240f3 all: Use the name MicroPython consistently in comments
There were several different spellings of MicroPython present in comments,
when there should be only one.
2017-07-31 18:35:40 +10:00
Alexander Steffen 299bc62586 all: Unify header guard usage.
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
2017-07-18 11:57:39 +10:00
Scott Shawcroft cea5503ca0 Fixup warnings from merge about undefined macro values, switch to
VM keyboard exception and switch to FATFS reader.
2017-01-12 12:46:18 -08:00
Damien George c8746e1e72 py: Move arch-specific assembler macros from emitnative to asmXXX.h. 2016-12-09 16:51:49 +11:00
Damien George 612599587b py: Factor out common code from assemblers into asmbase.[ch].
All assemblers should "derive" from mp_asm_base_t.
2016-11-28 09:24:50 +11:00
Damien George 096d1e4512 py: Add lsl/lsr/asr opcode support to inline Thumb2 assembler. 2015-10-19 14:26:19 +01:00
Damien George 9988618e0e py: Implement full func arg passing for native emitter.
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.
2015-04-07 22:43:28 +01:00
Damien George 9f142f0c84 py: For inline assembler, add bcc_n and bcc_w ops.
Addresses issue #1143.
2015-03-02 14:29:52 +00:00
Damien George 534574348e py: Make inline assembler raise exception when branch not in range.
Addresses issue #1132.
2015-02-25 15:45:55 +00:00
Damien George e41b21c01e py: Make more asmthumb functions inline to reduce code size. 2015-02-24 16:32:52 +00:00
Damien George eff10f66a6 py: Implement bl/bx instructions for inline Thumb assembler. 2015-02-16 18:17:07 +00:00
Damien George 42495392da py: Implement "it" instruction for inline Thumb assembler. 2015-02-16 17:46:49 +00:00
Damien George ebde3c694f py: Add guarded includes for asm-based headers. 2015-01-01 18:07:43 +00:00
Damien George 0b610de017 py: Make macro names in assemblers consistent, and tidy up a bit. 2014-09-29 19:42:06 +01:00
Damien George 851f15f34c py: In asmthumb, clean up unit/int types and ite ops. 2014-09-29 19:42:06 +01:00
Damien George 8105736982 py: Clean up x86-64 native assembler; allow use of extended regs.
Native x86-64 now has 3 locals in registers.
2014-09-07 01:06:19 +01:00
Damien George 40f3c02682 Rename machine_(u)int_t to mp_(u)int_t.
See discussion in issue #50.
2014-07-03 13:25:24 +01:00
Damien George 36db6bcf54 py, compiler: Improve passes; add an extra pass for native emitter. 2014-05-07 17:24:22 +01:00
Damien George 04b9147e15 Add license header to (almost) all files.
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/.
2014-05-03 23:27:38 +01:00
Damien George e5f8a77db6 py: Add 'align' and 'data' meta-instructions to inline assembler. 2014-04-21 13:33:15 +01:00
Damien George 90edf9e13b inlinethumb: Add wfi, cpsid and cpsie instructions. 2014-04-18 16:56:54 +01:00
Damien George 8721087661 py: Big improvements to inline assembler.
Improved the Thumb assembler back end.  Added many more Thumb
instructions to the inline assembler.  Improved parsing of assembler
instructions and arguments.  Assembler functions can now be passed the
address of any object that supports the buffer protocol (to get the
address of the buffer).  Added an example of how to sum numbers from
an array in assembler.
2014-04-13 00:30:32 +01:00
Damien George a26dc50968 py: Improve inline assembler; improve compiler constant folding. 2014-04-12 17:54:52 +01:00
Damien George 6f355fd3b9 py: Make labels unsigned ints (converted from int).
Labels should never be negative, and this modified type signature
reflects that.
2014-04-10 14:11:31 +01:00
Damien George 47e1b85d9c py: Improve inline assembler; add a few more opcodes. 2014-04-08 18:28:33 +01:00
Damien 9b9e996df6 Support for for-loop in native thumb. 2013-11-03 14:25:43 +00:00
Damien 1a6633a74d Implement more thumb branch instructions. 2013-11-03 13:58:19 +00:00
Damien 03d4124320 Add b_n opcode to inline thumb asm. 2013-10-06 00:36:05 +01:00
Damien 826005c60b Add support for inline thumb assembly. 2013-10-05 23:17:28 +01:00
Damien 5bfb759980 Incorporate emit_thumb into new emit framework. 2013-10-05 18:41:24 +01:00
Damien 429d71943d Initial commit. 2013-10-04 19:53:11 +01:00