Commit Graph

3573 Commits

Author SHA1 Message Date
Damien George
b5a790d2e6 unix-cpy: Fix compiler warning about unused variable. 2015-02-07 18:50:54 +00:00
Damien George
0bfc7638ba py: Protect mp_parse and mp_compile with nlr push/pop block.
To enable parsing constants more efficiently, mp_parse should be allowed
to raise an exception, and mp_compile can already raise a MemoryError.
So these functions need to be protected by an nlr push/pop block.

This patch adds that feature in all places.  This allows to simplify how
mp_parse and mp_compile are called: they now raise an exception if they
have an error and so explicit checking is not needed anymore.
2015-02-07 18:33:58 +00:00
Damien George
e1e359ff59 py: Put mp_sys_path, mp_sys_argv and gc_collected in mp_state_ctx_t.
Without mp_sys_path and mp_sys_argv in the root pointer section of the
state, their memory was being incorrectly collected by GC.
2015-02-07 17:24:10 +00:00
danicampora
8785645a95 cc3200: Add cc3200 port of MicroPython.
The port currently implements support for GPIO, RTC, ExtInt and the WiFi
subsystem. A small file system is available in the serial flash. A
bootloader which makes OTA updates possible, is also part of this initial
implementation.
2015-02-06 22:10:11 +00:00
blmorris
97f14606f5 stmhal/adc.c: Fix calculation of read_core_vref()
There was a stray factor of 2 (VBAT_DIV) that looks like it was copied incorrectly from the read_core_vbat() function.
The factor exists in read_core_vbat() because VBAT is measured through a 2:1 voltage divider.
read_core_vref now returns values around 1.21V (assuming that external reference voltage is 3.3V) which is in line with the datasheet values.
See comment at http://forum.micropython.org/viewtopic.php?f=6&t=533&p=2991#p2991
2015-02-06 13:56:27 -05:00
Paul Sokolovsky
8775caf9f1 modffi: Add .addr() method to just get symbol address. 2015-02-06 00:19:43 +02:00
Paul Sokolovsky
d6f648d04f esp8266: modesp: Add status() function for connection status. 2015-02-05 00:39:02 +02:00
Li lin
b276cf1977 fix type error 2015-02-04 21:39:34 +08:00
Paul Sokolovsky
1cd47c6315 esp8266: modesp: Add disconnect() function to disconnect from WiFi AP. 2015-02-03 02:02:29 +02:00
Damien George
5f64dc55d8 extmod: Make ujson.loads raise exception if given empty string.
Addresses issue #1097.
2015-02-02 21:52:19 +00:00
Damien George
e8b877be60 tests: Disable float/cmath_fun.py for native emitter. 2015-02-02 20:01:51 +00:00
Damien George
744e767458 py: Make list.sort keep stack usage within O(log(N)) bound.
Also fix list.sort so it works with user-defined types, and parse the
keyword arguments properly.

Addresses issue #338.
2015-02-02 15:14:22 +00:00
Damien George
ae3150cb5c tests: Add test for cmath module. 2015-02-02 12:52:38 +00:00
Damien George
f49782f005 py: Fix cmath.log10; fix printing of complex number with negative imag. 2015-02-02 12:52:14 +00:00
Paul Sokolovsky
471b2a8906 esp8266: modesp: Add connect() function to connect to WiFi AP. 2015-02-01 01:36:48 +02:00
Paul Sokolovsky
8fff7f8d38 esp8266: Add "reset" target to Makefile.
Just always keep jumper in bootloader position. After flashing, uPy
automatically executed. And to get back to bootloader, do "make reset".
2015-01-31 00:51:39 +02:00
Paul Sokolovsky
eca9a9323a esp8266: Update ROM address map to vendor SDK 0.9.5. 2015-01-31 00:36:41 +02:00
Paul Sokolovsky
98c4bc3fac py: Add MICROPY_PY_ALL_SPECIAL_METHODS and __iadd__ special method under it. 2015-01-31 00:35:56 +02:00
Damien George
32bade19d9 py: Convert CR to LF and CR LF to LF in lexer.
Only noticeable difference is how newlines are encoded in triple-quoted
strings.  The behaviour now matches CPython3.
2015-01-30 00:27:46 +00:00
Damien George
3da677e658 py: Implement Ellipsis object in native emitter. 2015-01-29 15:13:40 +00:00
Damien George
92ab95f215 tests: Add some tests to improve coverage. 2015-01-29 14:56:09 +00:00
Damien George
598af3a7d6 unix: Add "coverage" target to do coverage testing using gcov. 2015-01-29 14:54:38 +00:00
Damien George
827b0f747b py: Change vstr_null_terminate -> vstr_null_terminated_str, returns str. 2015-01-29 13:57:23 +00:00
Damien George
26c0b155fa tests: Make float/int_power.py pass on pyboard/single prec float. 2015-01-29 13:56:58 +00:00
Damien George
12c66be2b8 tests: Add some tests to improve coverage.
Used gcov to find some parts of vm.c, runtime.c, obj.c that were not
covered by any tests.  Still need to use gcov more thoroughly.
2015-01-29 00:44:11 +00:00
Damien George
81e70a88a7 py: Make REPL printing function print repr of object, not str.
Addresses issue #1014.
2015-01-28 23:53:13 +00:00
Damien George
0d3cb6726d py: Change vstr so that it doesn't null terminate buffer by default.
This cleans up vstr so that it's a pure "variable buffer", and the user
can decide whether they need to add a terminating null byte.  In most
places where vstr is used, the vstr did not need to be null terminated
and so this patch saves code size, a tiny bit of RAM, and makes vstr
usage more efficient.  When null termination is needed it must be
done explicitly using vstr_null_terminate.
2015-01-28 23:43:01 +00:00
Paul Sokolovsky
57aebe1714 tests: Add testcase for bytes() on values in range 128-255. 2015-01-28 22:29:51 +02:00
Paul Sokolovsky
bbd9251bac py: bytes(): Make sure we add values as bytes, not as chars. 2015-01-28 22:29:07 +02:00
Damien George
98e3a64694 py: Remove duplicated mp_obj_str_make_new function from objstrunicode.c. 2015-01-28 14:14:57 +00:00
Damien George
16677ce311 py: Be more precise about unicode type and disabled unicode behaviour. 2015-01-28 14:07:11 +00:00
Damien George
0ecd5988a2 stmhal: Remove unnecessary #include "systick.h" from pyexec.c.
Makes pyexec.c more re-usable for other ports.
2015-01-28 00:59:27 +00:00
Paul Sokolovsky
e9995bdea2 moduzlib: Align out buffer to block size; shrink when decompression done. 2015-01-28 02:30:01 +02:00
Paul Sokolovsky
2324f3ef29 moduzlib: Implement raw DEFLATE decoding support. 2015-01-28 02:21:49 +02:00
David Steinberg
0b3014ce3a py: Add support for floats in mp_binary_{get,set}_val()
- This then provides support for floats in the struct package
2015-01-27 22:49:01 +02:00
Damien George
a5efcd4745 py: Specify unary/binary op name in TypeError error message.
Eg, "() + 1" now tells you that __add__ is not supported for tuple and
int types (before it just said the generic "binary operator").  We reuse
the table of names for slot lookup because it would be a waste of code
space to store the pretty name for each operator.
2015-01-27 18:02:25 +00:00
Damien George
a9dc9b8f6d py: Fix comparison of minus-zero long int. 2015-01-27 17:47:38 +00:00
Paul Sokolovsky
e6a118ee85 moduzlib: Update to uzlib v1.2.
Actually manage size of the output buffer.
2015-01-26 22:01:45 +02:00
Damien George
2f8c409a4f qemu-arm: Disable try_finally1.py test (it fails randomly on Travis). 2015-01-25 18:48:03 +00:00
Damien George
8788b131ec py: Check for NDEBUG using #ifdef rather than #if.
Defining NDEBUG (to any value, even 0) disables debugging.  Otherwise,
if it's not defined, debugging is enabled.
2015-01-25 18:35:54 +00:00
Damien George
17d299b7bd lib/mp-readline: Use simple VT100 commands to speed up line redraw. 2015-01-25 18:26:07 +00:00
Damien George
4b35a5464c Merge branch 'master' of github.com:micropython/micropython 2015-01-25 17:11:47 +00:00
Paul Sokolovsky
5fb775a0c0 esp8266: Handle exceptions in callback. 2015-01-25 17:41:06 +02:00
Paul Sokolovsky
6ec650b41f esp8266: Add "esp" module with esp8266-specific "cooperative" networking.
So far implements .scan(lambda x: print(x)) function to scan for WiFi access
points.
2015-01-25 17:10:06 +02:00
Damien George
552f7c40a0 docs: Bump version to 1.3.9. 2015-01-25 00:10:07 +00:00
Damien George
ad33e2465c stmhal: Disable MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE.
It uses RAM and on pyboard we are generally tight on RAM, so disable
this optimisation for general builds.  If users need the speed then
they can build their own version.  Maybe in the future we can have
different versions of pyboard firmware built with different tradeoffs.
2015-01-24 23:45:37 +00:00
Paul Sokolovsky
31c1f1300e modffi: 's' (string) return type: handle NULL properly (return None). 2015-01-25 01:36:14 +02:00
Damien George
32444b759a py: Don't use anonymous unions, name them instead.
This makes the code (more) compatible with the C99 standard.
2015-01-24 23:14:12 +00:00
Damien George
5c670acb1f py: Be more machine-portable with size of bit fields. 2015-01-24 23:12:58 +00:00
David Steinberg
4c1a7e0d6a tests: Update float2int tests for new range classifications
- Tests vary based on build configuration (32/64-bit and internal int type).
- Added tests for exceptions raised on overflow of int type.
2015-01-24 21:05:16 +00:00