Commit Graph

6843 Commits

Author SHA1 Message Date
Paul Sokolovsky f59465d763 zephyr/Makefile: Allow to override Zephyr config from make command line. 2016-11-04 19:42:43 +03:00
Paul Sokolovsky 919fc2dc47 zephyr/Makefile: Update comments to the current state of affairs. 2016-11-04 19:13:49 +03:00
Paul Sokolovsky 688cc79294 zephyr/Makefile: Allow to adjust heap size from make command line. 2016-11-04 19:09:39 +03:00
Paul Sokolovsky 13f7a7b86b zephyr/mpconfigport.h: Move less important params to the bottom. 2016-11-04 18:56:04 +03:00
Paul Sokolovsky 9b345a9e48 extmod/utime_mphal: ticks_diff/ticks_add: Don't hardcode 32-bit types.
Use normal mp_int_t/mp_uint_t types, algorithms (hm, formulas) can work
with any type width.
2016-11-03 23:54:16 +03:00
stijn 3272afe57f windows: Implement mp_hal_ticks_cpu in terms of QueryPerformanceCounter 2016-11-03 10:31:58 +01:00
stijn 0b9ed55026 windows: Fix utime_mphal compilation for msvc 2016-11-03 10:31:58 +01:00
Damien George 7bb0f7b0f6 drivers: Add "from micropython import const" when const is used.
Following best-practice use of the const feature, to make it compatible
with Python.
2016-11-03 12:41:11 +11:00
Damien George 561844f3ba py: Add MICROPY_FLOAT_CONST macro for defining float constants.
All float constants in the core should use this macro to prevent
unnecessary creation of double-precision floats, which makes code less
efficient.
2016-11-03 12:33:01 +11:00
Damien George ca973bd308 qemu-arm: Enable software floating point support, and float tests.
This helps to test floating point code on Cortex-M hardware.

As part of this patch the link-time-optimisation was disabled because it
wasn't compatible with software FP support.  In particular, the linker
could not find the __aeabi_f2d, __aeabi_d2f etc functions even though they
were provided by lib/libm/math.c.
2016-11-03 12:28:31 +11:00
Damien George cd527bb324 lib/libm: Move Thumb-specific sqrtf function to separate file.
This allows it to be used only when the hardware supports VFP
instructions, preventing compile errors.
2016-11-03 12:26:32 +11:00
Colin Hogben 828df54bfe py: Change config default so m_malloc0 uses memset if GC not enabled.
With MICROPY_ENABLE_GC set to false the alternate memory manager may not
clear all memory that is allocated, so it must be cleared in m_malloc0.
2016-11-03 10:16:31 +11:00
Alex March 94aeba0427 tests/extmod/framebuf1: Test framebuffer pixel clear, and text function. 2016-11-03 00:10:17 +11:00
Colin Hogben f9b6b37cf6 py: Fix wrong assumption that m_renew will not move if shrinking
In both parse.c and qstr.c, an internal chunking allocator tidies up
by calling m_renew to shrink an allocated chunk to the size used, and
assumes that the chunk will not move.  However, when MICROPY_ENABLE_GC
is false, m_renew calls the system realloc, which does not guarantee
this behaviour.  Environments where realloc may return a different
pointer include:

(1) mbed-os with MBED_HEAP_STATS_ENABLED (which adds a wrapper around
malloc & friends; this is where I was hit by the bug);

(2) valgrind on linux (how I diagnosed it).

The fix is to call m_renew_maybe with allow_move=false.
2016-11-02 23:15:41 +11:00
ernitron e5f06559e6 esp8266/modules: Fix negative temperature in ds18x20 driver. 2016-11-02 22:58:49 +11:00
Paul Sokolovsky 10bde6933e extmod/utime_mphal: ticks_diff(): Optimize to avoid if conditions. 2016-11-02 02:50:48 +03:00
Paul Sokolovsky 5fae914326 esp8266/etshal.h: Adjust size of MD5_CTX structure.
Size 64 was incorrect and will lead to stack corruption. Size 88 was
verified empirically. Also, allow to skip defining it if MD5_CTX
preprocessor macro is already defined (to avoid header conflict).
2016-11-02 02:16:35 +03:00
Paul Sokolovsky 2ec70dc812 esp8266/etshal.h: Add prototypes for SPIRead/SPIWrite/SPIEraseSector. 2016-11-02 02:16:20 +03:00
Jan Pochyla ffb04a5845 unix: fix symbol references for x86 Mac 2016-11-02 00:42:04 +03:00
Paul Sokolovsky a6c9060d81 esp8266/main: Bump heap size to 36K.
ESP8266 SDK2.0 fixes (at least, I can't reproduce it) an infamous bug
with crash during scan. 36K seams to be a safe value based on a download
test (test_dl.py), over 1GB was downloaded. More testing is needed, but
let's have other people participate by committing it now.
2016-11-02 00:22:43 +03:00
puuu b97c17e125 esp8266/modnetwork.c: Allows AP reconnection without WiFi credentials
There is no automatic reconnect after wlan.active(False);
wlan.active(True). This commit provide the possibility to run
wlan.connect() without parameter, to reconnect to the previously
connected AP.

resolve #2493
2016-11-01 06:59:41 +03:00
Paul Sokolovsky eddcf0a5de esp8266/scripts/port_diag: Add descriptions for esf_buf types. 2016-11-01 06:56:10 +03:00
Paul Sokolovsky 805f7ea2f2 docs/utime: Add docs for ticks_add(), improvements for other ticks_*(). 2016-11-01 00:14:12 +03:00
Paul Sokolovsky 8679d9e6a6 docs/utime: Remove only:: for ticks_diff().
It's mandatory function which should be present in every port. Even if
it's not, in the stdlib intro we waarn users that a particular port can
lack anything of described in the docs.
2016-11-01 00:03:40 +03:00
Pavol Rusnak 7ffc959c00 py: remove asserts that are always true in emitbc.c 2016-10-31 23:21:22 +03:00
Pavol Rusnak 3679ee9b52 py: fix null pointer dereference in mpz.c, fix missing va_end in warning.c 2016-10-31 23:21:15 +03:00
Paul Sokolovsky e377f3cb40 esp8266/modnetwork: config(): Fix copy-paste error in setting "mac". 2016-10-31 00:30:26 +03:00
Paul Sokolovsky d60ad5cf53 docs/utime: Describe new semantics of ticks_diff() (signed ring arithmetics). 2016-10-31 00:17:56 +03:00
Paul Sokolovsky 153665f159 docs/utime: Document ticks_cpu() in more detail.
Also, drop ::only directive.
2016-10-30 23:15:28 +03:00
Paul Sokolovsky 7219a18d17 docs/library/index: Update TOCs so builtins sorted before modules. 2016-10-30 23:13:52 +03:00
Paul Sokolovsky 796b720dbc tools/tinytest-codegen: Exclude ticks_diff test for qemu-arm port. 2016-10-30 22:24:07 +03:00
Paul Sokolovsky be6a765c69 tests/extmod/ticks_diff: Test for new semantics of ticks_diff(). 2016-10-30 21:33:12 +03:00
Fabio Utzig 8908e505ce py/sequence: Fix reverse slicing of lists. 2016-10-30 15:54:19 -02:00
Paul Sokolovsky e429daa572 extmod/utime_mphal: Fix implementation of new semantics of ticks_diff().
Now the function properly uses ring arithmetic to return signed value
in range (inclusive):
[-MICROPY_PY_UTIME_TICKS_PERIOD/2, MICROPY_PY_UTIME_TICKS_PERIOD/2-1].

That means that function can properly process 2 time values away from
each other within MICROPY_PY_UTIME_TICKS_PERIOD/2 ticks, but away in
both directions. For example, if tick value 'a' predates tick value 'b',
ticks_diff(a, b) will return negative value, and positive value otherwise.
But at positive value of MICROPY_PY_UTIME_TICKS_PERIOD/2-1, the result
of the function will wrap around to negative -MICROPY_PY_UTIME_TICKS_PERIOD/2,
in other words, if a follows b in more than MICROPY_PY_UTIME_TICKS_PERIOD/2 - 1
ticks, the function will "consider" a to actually predate b.
2016-10-30 03:07:22 +03:00
Paul Sokolovsky 76146b3d9a extmod/utime_mphal: Allow ticks functions period be configurable by a port.
Using MICROPY_PY_UTIME_TICKS_PERIOD config var.
2016-10-30 03:02:07 +03:00
Paul Sokolovsky 1ba4db5685 tests/btree1: Fix out of memory error running on esp8266. 2016-10-29 19:53:31 +03:00
Paul Sokolovsky 64c6bdb8ee esp8266/modutime: Consistently convert to MP_ROM_QSTR/MP_ROM_PTR. 2016-10-29 18:48:04 +03:00
Paul Sokolovsky 369233105b stmhal/modutime: Consistently convert to MP_ROM_QSTR/MP_ROM_PTR. 2016-10-29 17:46:47 +03:00
Paul Sokolovsky d86cac4b82 extmod/utime_mphal: Implement ticks_add(), add to all maintained ports. 2016-10-29 17:30:05 +03:00
Paul Sokolovsky c62679bdaa unix/mphalport.h: Add dummy definition of mp_hal_ticks_cpu().
To fix coverage build.
2016-10-29 17:23:05 +03:00
Paul Sokolovsky 6a2c6098f4 windows: Enable utime_mphal following unix, define mp_hal_ticks_*.
mp_hal_ticks_ms, mp_hal_ticks_us taken from unix port, mp_hal_ticks_cpu
dummy.
2016-10-29 14:32:15 +03:00
Paul Sokolovsky 3cc87b1e2a unix/modtime: Switch ticks/sleep_ms/us() to utime_mphal. 2016-10-29 14:17:02 +03:00
Paul Sokolovsky 6a87084019 extmod/utime_mphal: Add MP_THREAD_GIL_EXIT/ENTER warppers for sleep functions.
Ported from unix port.
2016-10-29 13:42:36 +03:00
Paul Sokolovsky 99ed0f25cb unix/mphalport.h: Add warning of mp_hal_delay_ms() implementation.
It's implemented in terms of usleep(), and POSIX doesn't guarantee that
usleep() can sleep for more than a second. This restriction unlikely
applies to any real-world system, but...
2016-10-29 13:38:02 +03:00
Paul Sokolovsky 6ed5583f8c extmod/utime_mphal: ticks_diff(): switch arg order, return signed value.
Based on the earlier discussed RFC. Practice showed that the most natural
order for arguments corresponds to mathematical subtraction:

ticks_diff(x, y) <=> x - y

Also, practice showed that in real life, it's hard to order events by time
of occurance a priori, events tend to miss deadlines, etc. and the expected
order breaks. And then there's a need to detect such cases. And ticks_diff
can be used exactly for this purpose, if it returns a signed, instead of
unsigned, value. E.g. if x is scheduled time for event, and y is the current
time, then if ticks_diff(x, y) < 0 then event has missed a deadline (and e.g.
needs to executed ASAP or skipped). Returning in this case a large unsigned
number (like ticks_diff behaved previously) doesn't make sense, and such
"large unsigned number" can't be reliably detected per our definition of
ticks_* function (we don't expose to user level maximum value, it can be
anything, relatively small or relatively large).
2016-10-29 05:02:24 +03:00
Paul Sokolovsky e381efed4a unix/modtime: Use ticks_diff() implementation from extmod/utime_mphal.c. 2016-10-29 04:58:06 +03:00
Paul Sokolovsky aee6483536 zephyr/README: Update for the current featureset, add more info. 2016-10-28 21:51:18 +03:00
Paul Sokolovsky 938c693948 zephyr: Support time -> utime module "weaklink".
So, now it's possible to just do normal Python's "import time".
2016-10-28 21:38:52 +03:00
Alex March cc0cc67815 tests/extmod/uhashlib_sha256: Rename sha256.py test. 2016-10-28 19:51:54 +03:00
Alex March b83ac44e82 tests/extmod/uhashlib_sha1: Coverage for SHA1 algorithm. 2016-10-28 19:51:46 +03:00