Commit Graph

19 Commits

Author SHA1 Message Date
Damien George
89755ae67f py: Rename MICROPY_SYS_EXIT to MICROPY_MOD_SYS_EXIT.
For consistency with MICROPY_MOD_SYS_STDFILES, etc.
2014-05-11 17:35:43 +01:00
Damien George
f92a0d4d16 stmhal: Enable frozenset. Takes 292 text bytes in ROM. 2014-05-11 17:27:31 +01:00
Paul Sokolovsky
deaeaac469 modsys: Enable sys.exit() per port after all. 2014-05-10 17:26:47 +03: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
93e51b594a stmhal: Enable cmath module. 2014-05-03 18:40:50 +01:00
Damien George
5874c1c92b stmhal: Remove #include <stdint.h> from mpconfigport.h.
Make include dependencies neater, and adheres to the coding convention
that headers should not include headers.
2014-05-03 13:24:21 +01:00
Damien George
5b65f0c7d3 py: Rename USE_COMPUTED_GOTOS to USE_COMPUTED_GOTO and enable on stmhal.
On stmhal, computed gotos make the binary about 1k bigger, but makes it
run faster, and we have the room, so why not.  All tests pass on
pyboard using computed gotos.
2014-04-17 23:24:13 +01:00
Damien George
86a03044e3 stmhal: Add stdin/stdout/stderr objects.
Available via sys.std{in,out,err}.  Basic reading and writing supported.
Even sys.stdin.readline!
2014-04-13 19:00:56 +01:00
Damien George
73496fbbe4 py: Fix up source-line calculation.
Should address issue #475.
2014-04-13 14:51:56 +01:00
Damien George
3f4898456b stmhal: Add stm module, which contains some constants for the MCU.
Also contains raw memory read/write functions, read8, read16, read32,
write8, write16, write32.  Can now do:

stm.write16(stm.GPIOA + stm.GPIO_BSRRL, 1 << 13)

This turns on the red LED.

With the new constant folding, the above constants for the GPIO address
are actually compiled to constants (and the addition done) at compile
time.  For viper code and inline assembler, this optimisation will make
a big difference.  In the inline assembler, using these constants would
not be possible without this constant folding.
2014-04-10 22:46:40 +01:00
Damien George
7efc5b3f34 py: Make globals and locals proper dictionary objects.
Finishes addressing issue #424.

In the end this was a very neat refactor that now makes things a lot
more consistent across the py code base.  It allowed some
simplifications in certain places, now that everything is a dict object.

Also converted builtins tables to dictionaries.  This will be useful
when we need to turn builtins into a proper module.
2014-04-05 22:36:42 +01:00
Damien George
12bab72d93 Improve GC finalisation code; add option to disable it. 2014-04-05 20:35:48 +01:00
Damien George
caac542b23 Proper support for registering builtin modules in ROM.
Comes with some refactoring of code and renaming of files.  All modules
are now named mod*.[ch].
2014-03-25 14:18:18 +00:00
Damien George
5fd2ebbbdd stmhal: Update help function. 2014-03-24 11:27:56 +00:00
Damien George
02fa035800 stmhal: Add input() and pyb.input() functions. 2014-03-22 23:53:50 +00:00
Damien George
b92d3e1fde stmhal: Add fatfs support, working with flash and SD card. 2014-03-17 14:04:19 +00:00
Damien George
87e423b866 stmhal: Remove obsolete #defines from mpconfigport.h.
Either not needed anymore, or defined in the board/_hal_conf.h file.
2014-03-15 09:28:08 +00:00
Dave Hylands
0a64c92a9c stmhal - add led support. Add netduino_plus_2 support
Tweaked a couple of the USB files to compile if neither dev nor host was defined.
Tested on netduiono plus 2 and stm32f4discovery boards
2014-03-14 09:48:49 -07:00
Dave Hylands
f14b92b9e1 REPl working on UART6 with STMHAL 2014-03-12 18:15:55 -07:00