Commit Graph

4939 Commits

Author SHA1 Message Date
Damien George
2c83894257 py: Implement default and star args for lambdas. 2015-11-17 14:00:14 +00:00
Damien George
cbd9ae5256 py/compile: Don't unnecessarily save state when compiling param list.
Parameter lists can't be nested so there is no need to save the global
state when compiling them.
2015-11-17 12:37:02 +00:00
danicampora
e4404fbef0 cc3200: Unmount all user file systems after a soft reset. 2015-11-16 23:43:47 +01:00
Paul Sokolovsky
65971f5160 unix: Add "uselect" module, with poll() function.
Underlyingly, uses standard POSIX poll() for portability.
2015-11-17 00:35:57 +02:00
Paul Sokolovsky
79c4ec1102 unix/input: Switch to POSIX I/O for history reading/writing. 2015-11-16 07:40:56 +02:00
Paul Sokolovsky
f8bc3f6964 tools: Update to upip 0.6.2. Fixes issue due to MacOSX undocumented behavior. 2015-11-15 00:04:18 +02:00
Paul Sokolovsky
3862ef9a9f tools: Update upip to 0.6.1. Fixes normal installs without -p switch. 2015-11-14 17:54:30 +02:00
Paul Sokolovsky
ec314c951d unix/modos: getenv(): Handle non-existing envvar correctly. 2015-11-14 17:12:04 +02:00
Paul Sokolovsky
16d42368a6 stmhal/modmachine: Initial attempt to add I2C & SPI classes.
In new hardware API, these classes implement master modes of interfaces,
and "mode" parameter is not accepted. Trying to implement new HW API
in terms of older pyb module leaves variuos corner cases:

In new HW API, I2C(1) means "I2C #1 in master mode" (? depends on
interpretation), while in old API, it means "I2C #1, with no settings
changes".

For I2C class, it's easy to make mode optional, because that's last
positional param, but for SPI, there's "baudrate" after it (which
is inconsistent with I2C, which requires "baudrate" to be kwonly-arg).
2015-11-14 16:14:08 +02:00
Paul Sokolovsky
908f5159cf unix/modos: Add Windows workaround for mkdir(). 2015-11-14 02:35:38 +02:00
stijn
5be60d6929 windows: Define ssize_t and use renamed mphal header
This fixes the build after changes in [66fd3e4] and [3a6b3d2]
2015-11-14 02:06:55 +02:00
Paul Sokolovsky
863d4cd862 py/modmath: Don't create symbol entry for expm1() if not needed. 2015-11-14 00:55:54 +02:00
Paul Sokolovsky
0d6116d86b py/modmath: Make expm1() be in MICROPY_PY_MATH_SPECIAL_FUNCTIONS. 2015-11-14 00:46:52 +02:00
Paul Sokolovsky
0aff87b808 tools: Update upip to 0.6.
Removes FFI dependency, instead uses builtin os module. Thus can work on
systems where dynamic library loading is not available.
2015-11-14 00:05:24 +02:00
Paul Sokolovsky
27dafa5ed5 unix/modos: Add mkdir().
Dependency of upip.
2015-11-13 22:26:51 +02:00
Paul Sokolovsky
d8557834c0 unix/modos: Add getenv().
Dependency of upip.
2015-11-13 21:30:06 +02:00
Paul Sokolovsky
a01f6c9ae7 unix/main: Remove stray mp_printf() from previous commit. 2015-11-13 17:33:42 +02:00
Paul Sokolovsky
66fd3e4a7b unix: Use standard mphalport.h header.
This also unbreaks "make minimal".
2015-11-13 15:44:26 +02:00
Paul Sokolovsky
3a6b3d230c main.c: Switch stderr printing from ANSI C to native POSIX. 2015-11-13 15:29:42 +02:00
Paul Sokolovsky
94f9330d3e unix: Allow to override MICROPY_PY_MATH_SPECIAL_FUNCTIONS from command-line. 2015-11-13 15:24:57 +02:00
Paul Sokolovsky
6d1eabfeaa unix/mpconfigport: Move log2() definition to modmath.c.
It's safer to define it where it's used, defining it for all source files
may lead to hard to diagnose conflicts in corner cases.
2015-11-13 15:24:48 +02:00
Damien George
432e8275a9 py: Allow to import compiled bytecode files. 2015-11-13 12:49:18 +00:00
Damien George
d8c834c95d py: Add MICROPY_PERSISTENT_CODE_LOAD/SAVE to load/save bytecode.
MICROPY_PERSISTENT_CODE must be enabled, and then enabling
MICROPY_PERSISTENT_CODE_LOAD/SAVE (either or both) will allow loading
and/or saving of code (at the moment just bytecode) from/to a .mpy file.
2015-11-13 12:49:18 +00:00
Damien George
c8e9c0d89a py: Add MICROPY_PERSISTENT_CODE so code can persist beyond the runtime.
Main changes when MICROPY_PERSISTENT_CODE is enabled are:

- qstrs are encoded as 2-byte fixed width in the bytecode
- all pointers are removed from bytecode and put in const_table (this
  includes const objects and raw code pointers)

Ultimately this option will enable persistence for not just bytecode but
also native code.
2015-11-13 12:49:18 +00:00
Damien George
713ea1800d py: Add constant table to bytecode.
Contains just argument names at the moment but makes it easy to add
arbitrary constants.
2015-11-13 12:49:18 +00:00
Damien George
3a3db4dcf0 py: Put all bytecode state (arg count, etc) in bytecode. 2015-11-13 12:49:18 +00:00
Damien George
9b7f583b0c py: Reorganise bytecode layout so it's more structured, easier to edit. 2015-11-13 12:49:18 +00:00
Paul Sokolovsky
f882d53fcd unix/main: Use builtin unichar_isdigit() in preference if libc's.
Less dependencies.
2015-11-13 01:57:08 +02:00
Paul Sokolovsky
772f0b4159 tests/jni: Add test for working with container of List interface. 2015-11-13 01:33:09 +02:00
Paul Sokolovsky
3c7e1b80ac unix/modjni: Add missing get_jclass_name() function. 2015-11-11 16:43:27 +02:00
Dave Hylands
3551368424 docs: Fix a typo in the REPL documentation. 2015-11-10 22:19:20 +02:00
Paul Sokolovsky
73ff0687f2 lib/utils/printf: Move from stmhal/ .
This file contains various MicroPython-specific helper functions, so isn't
good fit for lib/libc/.
2015-11-10 18:58:58 +02:00
stijn
b1dbbd32eb windows: Allow specifying the python executable to use for msvc builds
This defaults to 'python' but can be now overridden if needed
2015-11-10 17:37:09 +02:00
omtinez
1b9d161f94 Fix project file for Visual Studio 2015 2015-11-10 17:36:08 +02:00
Paul Sokolovsky
549c79d11e docs/select: Document POLLIN/OUT/ERR/HUP. 2015-11-09 22:10:32 +02:00
Paul Sokolovsky
746b752b8e stmhal/moduselect: Expose POLLIN/OUT/ERR/HUP constants.
This makes select.poll() interface fully compatible with CpYthon. Also, make
their numeric values of these options compatible with Linux (and by extension,
with iBCS2 standard, which jopefully means compatibility with other Unices too).
2015-11-09 22:10:31 +02:00
Damien George
1f92ffb5b7 py/emitinlinethumb: Allow to compile with -Wsign-compare. 2015-11-09 14:11:47 +00:00
Damien George
723d598d32 py/asmthumb: Allow to compile with -Wsign-compare and -Wunused-parameter. 2015-11-09 14:11:21 +00:00
Damien George
40274fec9c lib/pyexec: Move header pyexec.h from stmhal directory. 2015-11-09 13:13:09 +00:00
Paul Sokolovsky
50f56227c6 py/objint_longlong: Instead of assert, throw OverflowError. 2015-11-09 01:34:56 +02:00
Alex March
c27e5c4b0b cc3200: FatFS configuration moved to the library folder.
Port specific settinigs defined in mpconfigport. FreeRTOS and semphr
headers added to define SemaphoreHandle_t for the SYNC_T.
2015-11-08 22:21:17 +00:00
Alex March
748509a93c stmhal: FatFS configuration moved to the library folder.
Port specific settings defined in mpconfigport.
2015-11-08 22:21:17 +00:00
Alex March
34472302d6 lib/fatfs: Unify fatfs configuration.
- A single ffcon.h file to configure fatfs settings across ports.
- A single diskio.h file with common drive definitions.
- Removed now reduntand ffconf_template.h.
2015-11-08 22:21:17 +00:00
Paul Sokolovsky
6e68a68d18 unix/gccollect: Fallback to setjmp-based register fetching automatically.
Now, if we build for an architecture which doesn't have dedicated support
for getting registers for GC scanning, fallback to setjmp-based method
automatically. It's still possible to force setjmp-based implementation
on archs with dedicated support (e.g. for testing, or for peculiar calling
conventions/optimizations).
2015-11-08 16:05:33 +02:00
Dave Hylands
57e00ef262 stmhal: Fix RTC code to work on the F7 2015-11-07 09:42:26 -08:00
Dave Hylands
7f3c0d1ea8 py: Clear finalizer flag when calling gc_free.
Currently, the only place that clears the bit is in gc_collect.
So if a block with a finalizer is allocated, and subsequently
freed, and then the block is reallocated with no finalizer then
the bit remains set.

This could also be fixed by having gc_alloc clear the bit, but
I'm pretty sure that free is called way less than alloc, so doing
it in free is more efficient.
2015-11-07 14:26:11 +00:00
Dave Hylands
41b688e25f stmhal: Print more information at HardFault time. 2015-11-07 13:59:00 +00:00
Paul Sokolovsky
89f2ddd2d0 tools/pyboard.py: Don't add terminating \x04 character to stdout output. 2015-11-07 13:48:35 +00:00
Damien George
b7ca945877 lib/mp-readline: Make it easy to exit auto-indent mode by pressing enter.
This patch allows you to stop auto-indent by pressing enter on a second
blank line.  Easier than having to use backspace, and prevents new users
from getting stuck in auto-indent mode.
2015-11-07 13:07:43 +00:00
Paul Sokolovsky
e6dccaf18e tools/pyboard.py: Make -c (inline Python code) option compatible with python2. 2015-11-07 12:16:11 +03:00