Commit Graph

95 Commits

Author SHA1 Message Date
Dave Hylands
9480138f0c Add save/restore_irq
Factored irq functions into a separate file.
2014-08-25 12:22:11 +01:00
Damien George
3c658a4e75 py: Fix bug where GC collected native/viper/asm function data.
Because (for Thumb) a function pointer has the LSB set, pointers to
dynamic functions in RAM (eg native, viper or asm functions) were not
being traced by the GC.  This patch is a comprehensive fix for this.

Addresses issue #820.
2014-08-24 16:28:17 +01:00
Dan Peirce
f0c3a7e781 teensy/README.md (corrected typo) 2014-08-16 11:54:36 +01:00
Dan Peirce
6009309c33 modified: teensy/README.md
Updated teensy/README.md to reflect change in build process (teensyduino is no
longer required for build).
2014-08-16 11:54:36 +01:00
Damien George
284efa89ae stmhal/teensy: Use _ instead of - in source file names.
Trying to move towards consistency, let's use _ exclusively in names of
source files (eg .c, .h, .csv).
2014-08-08 22:34:06 +01:00
Dave Hylands
6f418fc1b0 Add support for selecting pin alternate functions from python.
Converts generted pins to use qstrs instead of string pointers.

This patch also adds the following functions:
pyb.Pin.names()
pyb.Pin.af_list()
pyb.Pin.gpio()

dir(pyb.Pin.board) and dir(pyb.Pin.cpu) also produce useful results.

pyb.Pin now takes kw args.

pyb.Pin.__str__ now prints more useful information about the pin
configuration.

I found the following functions in my boot.py to be useful:
```python
def pins():
    for pin_name in dir(pyb.Pin.board):
        pin = pyb.Pin(pin_name)
        print('{:10s} {:s}'.format(pin_name, str(pin)))

def af():
    for pin_name in dir(pyb.Pin.board):
        pin = pyb.Pin(pin_name)
        print('{:10s} {:s}'.format(pin_name, str(pin.af_list())))
```
2014-08-07 23:15:41 -07:00
Dave Hylands
0538a203e5 Follow rename of readline_init to readline_init0 on teensy 2014-08-04 09:27:29 -07:00
Damien George
2e3e8b2f69 Merge branch 'master' of github.com:micropython/micropython 2014-08-04 11:12:47 +01:00
Damien George
8dbbbbc793 Put call to qstr_init and mp_init_emergency_exc_buf in mp_init.
qstr_init is always called exactly before mp_init, so makes sense to
just have mp_init call it.  Similarly with
mp_init_emergency_exception_buf.  Doing this makes the ports simpler and
less error prone (ie they can no longer forget to call these).
2014-08-04 10:05:16 +01:00
Dave Hylands
ecb5792f88 Updated teensys usb.c and switched to using usb.h from stmhal.
Removed the local usb.h from teensey directory and now uses
the usb.h from the stmhal directory.
Fixed the deploy target to use abspath.
2014-08-03 10:03:02 -07:00
Dave Hylands
e40c72210f Fix teensy to work with the latest tree. 2014-08-02 21:28:32 -07:00
Dave Hylands
04f5ae1d1c Add core files and use same toolchain as stmhal 2014-07-14 22:48:22 -07:00
Dave Hylands
4d9dd26818 Fix teensy to build on latest tree.
Put #include of mpconfig.h before misc.h
Replace uses of ARRAY_SIZE with MP_ARRAY_SIZE
2014-07-14 22:19:27 -07:00
Damien George
54eb4e723e lexer: Convert type (u)int to mp_(u)int_t. 2014-07-03 13:47:47 +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
7a37f647a5 Merge branch 'teensy-new' of github.com:dhylands/micropython into dhylands-teensy-new
Conflicts:
	stmhal/pin_named_pins.c
	stmhal/readline.c

Renamed HAL_H to MICROPY_HAL_H.  Made stmhal/mphal.h which intends to
define the generic Micro Python HAL, which in stmhal sits above the ST
HAL.
2014-07-02 13:42:37 +01:00
Sven Wegener
c3cabf4e33 bare-arm, stmhal, teensy: Duplicate -nostdlib to CFLAGS
As we are building with -nostdlib gcc features like the stack protector
will fail linking, because the failure handlers are in gcc's internal
libs. Such features are implicitly disabled during compilation when
-nostdlib is used in CFLAGS too.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2014-06-18 13:34:07 +02:00
Dave Hylands
4f1b7fec9f Updated teensy to build.
Refactored some stmhal files which are shared with teensy.
2014-06-15 22:48:05 -07:00
Damien George
fb510b3bf9 Rename bultins config variables to MICROPY_PY_BUILTINS_*.
This renames:
MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET
MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY
MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE
MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT

See issue #35 for discussion.
2014-06-01 13:32:54 +01:00
Damien George
58ebde4664 Tidy up some configuration options.
MP_ALLOC_* -> MICROPY_ALLOC_*
MICROPY_PATH_MAX -> MICROPY_ALLOC_PATH_MAX
MICROPY_ENABLE_REPL_HELPERS -> MICROPY_HELPER_REPL
MICROPY_ENABLE_LEXER_UNIX -> MICROPY_HELPER_LEXER_UNIX
MICROPY_EXTRA_* -> MICROPY_PORT_*

See issue #35.
2014-05-21 20:32:59 +01:00
Damien George
d553be5982 build: Simplify build directory layout by putting all headers in genhdr.
Any generated headers go in $(BUILD)/genhdr/, and are #included as
'genhdr/xxx.h'.
2014-04-17 18:03:27 +01:00
Andrew Scheller
70a7d7a943 build directory can now be renamed
The autogenerated header files have been moved about, and an extra
include dir has been added, which means you can give a custom
BUILD=newbuilddir option to make, and everything "just works"

Also tidied up the way the different Makefiles build their include-
directory flags
2014-04-16 22:16:28 +01:00
Damien George
97790455fe Improve REPL detecting when input needs to continue.
Full CPython compatibility with this requires actually parsing the
input so far collected, and if it fails parsing due to lack of tokens,
then continue collecting input.  It's not worth doing it this way.  Not
having compatibility at this level does not hurt the goals of Micro
Python.
2014-04-08 11:04:29 +00:00
Damien George
6827f9fc55 Add uPy welcome message to UNIX and Windows ports; update Teensy port.
Partly addresses issue #154.
2014-04-07 13:27:50 +01:00
Damien George
65cad12d38 py: Add option to compiler to specify default code emitter.
Also add command line option to unix port to select emitter.
2014-04-06 11:48:15 +01:00
Damien George
ea13f407a3 py: Change nlr_jump to nlr_raise, to aid in debugging.
This does not affect code size or performance when debugging turned off.

To address issue #420.
2014-04-05 18:32:08 +01:00
jon mills
aabb314928 Update README.md
Very minor typo
2014-03-31 15:18:22 +01:00
Damien George
d17926db71 Rename rt_* to mp_*.
Mostly just a global search and replace.  Except rt_is_true which
becomes mp_obj_is_true.

Still would like to tidy up some of the names, but this will do for now.
2014-03-30 13:35:08 +01:00
Damien George
c5966128c7 Implement proper exception type hierarchy.
Each built-in exception is now a type, with base type BaseException.
C exceptions are created by passing a pointer to the exception type to
make an instance of.  When raising an exception from the VM, an
instance is created automatically if an exception type is raised (as
opposed to an exception instance).

Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper.

Handling of parse error changed to match new exceptions.

mp_const_type renamed to mp_type_type for consistency.
2014-02-15 16:10:44 +00:00
Damien George
a71c83a1d1 Change mp_obj_type_t.name from const char * to qstr.
Ultimately all static strings should be qstr.  This entry in the type
structure is only used for printing error messages (to tell the type of
the bad argument), and printing objects that don't supply a .print method.
2014-02-15 11:34:50 +00:00
Damien George
099a9cb575 Remove mp_obj_new_exception_msg_1_arg and _2_arg. 2014-02-12 23:02:19 +00:00
Dave Hylands
6a6ac8e4c7 Bah - Removed a couple of warnings for teensy that I didn't notice before. 2014-02-10 21:33:03 -08:00
Damien George
181d190643 stm: Remove unused, useless and not-to-be-used strndup.
Addresses issue #275.
2014-02-10 22:55:15 +00:00
Damien George
724026ab40 Merge pull request #271 from dhylands/teensy-2014-02-10
Updated teensy to work with latest on master
2014-02-10 22:02:47 +00:00
Dave Hylands
6f9c03676b Updated teensy to work with latest on master
Added analogRead, analogWriteXxx and servo support for teensy.
2014-02-10 09:06:41 -08:00
Paul Sokolovsky
58ff93bc7c Get rid of calloc().
If there's malloc and memset, then there's no need for calloc, especially if
we need to implement it ourselves.
2014-02-10 18:40:00 +02:00
Dave Hylands
c89c681a9f Rework makefiles. Add proper dependency checking. 2014-01-24 08:46:48 -08:00
Damien George
08335004cf Add source file name and line number to error messages.
Byte code has a map from byte-code offset to source-code line number,
used to give better error messages.
2014-01-18 23:24:36 +00:00
John R. Lenton
9549919349 made DEBUG control CFLAGS in Makefiles oter than stm as well. 2014-01-13 13:25:10 +00:00
Dave Hylands
d80ee8bbfd Added memzip filesystem support for teensy
You can now append a zipfile (containining uncomressed python sources)
to the micropython.hex file.

Use MEMZIP_DIR=directory when you call make, or set that in your
environment to include a different tree of source files.

Added sample /boot.py, /src/main.py, /test.py and /src/test.py files.

Added run command so that you can execute scripts from REPL (until import is implemented).

Added build directory to .gitignore
2014-01-11 16:16:20 -08:00
Dave Hylands
4646801181 Make build output quieter.
Use make V=1e make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.

This should fix issue #117
2014-01-08 10:30:06 -08:00
Dave Hylands
ee0013d24e Update teemsy/Makefile to use py.mk
I also fixed main.c to compile with the new str lexer
2014-01-08 09:09:47 -08:00
Damien George
9193f89296 Move lexerstr to main py directory (everyone uses it). 2014-01-08 15:28:26 +00:00
Dave Hylands
9b7b947b01 Updated teensy to use common code from stm directory.
Updated mconfigport.h to enable GC
2014-01-08 00:29:44 -08:00
Dave Hylands
297446e7af Initial support for Teensy 3.1 2014-01-06 00:20:11 -08:00