Commit Graph

8508 Commits

Author SHA1 Message Date
Damien George a0973b09ce py/vm: Fix VM opcode tracing to print correct stack pointer.
Also const_table is now moved to the code_state->fun_bc structure.
2017-03-27 10:52:04 +11:00
Paul Sokolovsky 220df8544b zephyr/zephyr_getchar: Use native k_sem instead of legacy nano_sem. 2017-03-27 00:41:58 +03:00
Glenn Ruben Bakke 06af64a78a nrf5/bluetooth: Adding template functions for service discovery in bluetooth driver. 2017-03-26 22:59:30 +02:00
Glenn Ruben Bakke 0914b34193 nrf5/bluetooth: Adding function to register gattc event handler (central). 2017-03-26 22:57:07 +02:00
Glenn Ruben Bakke 025f07dbab nrf5/bluetooth: Adding intermediate gattc callback function type in bluetooth driver. 2017-03-26 22:51:10 +02:00
Glenn Ruben Bakke 49cce723a9 nrf5/bluetooth: Turning off debug logging in bluetooth driver, which does not work well with bluetooth REPL mode. 2017-03-26 21:06:17 +02:00
Glenn Ruben Bakke 2f2e67e9bd nrf5/bluetooth: Fixing some smaller tab errors in the bluetooth driver. 2017-03-26 21:05:06 +02:00
Glenn Ruben Bakke cd2149a47f nrf5/bluetooth: Updating bluetooth le driver to handle GAP conn param update request. Also updating minor syntax in previous switch case. 2017-03-26 21:02:25 +02:00
Glenn Ruben Bakke fb983c7692 nrf5/boards: Inrease heap size in the nrf52832 w/s132 bluetooth stack linker script. 2017-03-26 20:46:23 +02:00
Glenn Ruben Bakke c230bc021a nrf5/modules/ubluepy: Update connect method to parse dev_addr parameter and pass it to the bluetooth driver, going through a allocated heap buffer. Adding call to the bluetooth driver to issue a connect. Hardcoding address type for now. 2017-03-26 20:45:21 +02:00
Glenn Ruben Bakke bcf4631e0a nrf5/bluetooth: Updating connect function in the bluetooth driver to do a successful connect to a peripheral device. 2017-03-26 20:43:43 +02:00
Damien George 3f810daeb3 py/obj: Change mp_uint_t to size_t for mp_obj_get_array_fixed_n len arg. 2017-03-26 19:20:06 +11:00
Damien George 9c388f66cf esp8266/modesp: Use mp_obj_str_get_str instead of mp_obj_str_get_data. 2017-03-26 19:19:48 +11:00
Damien George b568448306 extmod/modlwip: Use mp_obj_str_get_str instead of mp_obj_str_get_data. 2017-03-26 19:19:35 +11:00
Damien George fb139a4ba6 README: Change Travis & Coveralls badges to not use link references.
Link references don't seem to work anymore.
2017-03-26 17:03:54 +11:00
Paul Sokolovsky 99866a00a0 py/nlrx86: Better check for Zephyr (requires 1.7). 2017-03-26 00:33:23 +03:00
Glenn Ruben Bakke 4d147beedb nrf5/modules/ubluepy: Adding template function for central connect() in peripheral object. 2017-03-25 17:51:52 +01:00
Glenn Ruben Bakke 098e64b122 nrf5/modules/ubluepy: Adding locals dict to Scan Entry introducing function to retreive Scan Data. Not working as expected together with .attr. It looks like locals dict functions are treated to be attributes and cannot be resolved. 2017-03-25 17:39:44 +01:00
Paul Sokolovsky fa17eabce9 README: Describe extmod/ dir. 2017-03-25 17:12:24 +03:00
Paul Sokolovsky c16d1c07ca README: Add link to docs.micropython.org. 2017-03-25 17:07:57 +03:00
Damien George 29424304d9 unix: Use mp_obj_str_get_str instead of mp_obj_str_get_data. 2017-03-25 19:54:07 +11:00
Damien George ab5689bc9d py/objarray: Use mp_obj_str_get_str instead of mp_obj_str_get_data. 2017-03-25 19:53:31 +11:00
Damien George 64a4f11b2d py: Remove MP_STATE_CTX, use MP_STATE_THREAD instead (it's an alias).
MP_STATE_CTX was recently aliased to MP_STATE_THREAD and can now be
removed.
2017-03-24 18:43:28 +11:00
Damien George 707f16b05c py: Use mp_locals/mp_globals accessor funcs instead of MP_STATE_CTX.
To improve maintainability of the code.
2017-03-24 18:41:11 +11:00
Damien George f4ee1ba9b4 py/objnamedtuple: Use size_t where appropriate, instead of mp_uint_t. 2017-03-24 17:25:25 +11:00
Damien George d1b93ced78 py/objtype: Use size_t where appropriate, instead of mp_uint_t or uint. 2017-03-24 16:58:13 +11:00
Damien George bfb48c1620 tests/float: Add tests for round() of inf, nan and large number. 2017-03-24 11:00:45 +11:00
Damien George c236ebfea7 py/modbuiltins: Allow round() to return a big int if necessary.
Previous to this patch, if the result of the round function overflowed a
small int, or was inf or nan, then a garbage value was returned.  With
this patch the correct big-int is returned if necessary and exceptions are
raised for inf or nan.
2017-03-24 11:00:45 +11:00
Damien George 125eae1ba3 py/modbuiltins: For round() builtin use nearbyint instead of round.
The C nearbyint function has exactly the semantics that Python's round()
requires, whereas C's round() requires extra steps to handle rounding of
numbers half way between integers.  So using nearbyint reduces code size
and potentially eliminates any source of errors in the handling of half-way
numbers.

Also, bare-metal implementations of nearbyint can be more efficient than
round, so further code size is saved (and efficiency improved).

nearbyint is provided in the C99 standard so it should be available on all
supported platforms.
2017-03-24 11:00:45 +11:00
Damien George fb161aa45a lib/libm: Add implementation of nearbyintf, from musl-1.1.16. 2017-03-24 10:38:11 +11:00
Glenn Ruben Bakke f38b0ba037 nrf5/bluetooth: Adding function for connecting to a device (in central role). Not yet tested. 2017-03-23 21:03:40 +01:00
Damien George bacb52aa2d tests/float: Add tests for math funcs that return ints.
One should test bigint, inf and nan to make sure all cases are covered.
2017-03-23 23:54:10 +11:00
Damien George c073519ec8 py/objint: Handle special case of -0 when classifying fp as int.
Otherwise -0.0 is classified as a bigint, which for builds without bigints
will lead unexpectedly to an overflow.
2017-03-23 23:51:35 +11:00
Damien George febeff4af4 py/modmath: Allow trunc/ceil/floor to return a big int if necessary.
Previous to this patch, if the result of the trunc/ceil/floor functions
overflowed a small int, or was inf or nan, then a garbage value was
returned.  With this patch the correct big-int is returned if necessary,
and exceptions are raised for inf or nan.
2017-03-23 22:57:08 +11:00
Damien George f64a3e296e py/lexer: Remove obsolete comment, since lexer can now raise exceptions. 2017-03-23 16:40:24 +11:00
Damien George 60656eaea4 py: Define and use MP_OBJ_ITER_BUF_NSLOTS to get size of stack iter buf.
It improves readability of code and reduces the chance to make a mistake.

This patch also fixes a bug with nan-boxing builds by rounding up the
calculation of the new NSLOTS variable, giving the correct number of slots
(being 4) even if mp_obj_t is larger than the native machine size.
2017-03-23 16:36:08 +11:00
Damien George 507119f4d8 py/sequence: Convert mp_uint_t to size_t where appropriate. 2017-03-23 16:23:20 +11:00
Damien George c88cfe165b py: Use size_t as len argument and return type of mp_get_index.
These values are used to compute memory addresses and so size_t is the
more appropriate type to use.
2017-03-23 16:17:40 +11:00
stijn 3f3df43501 msvc: Remove directory with generated files when cleaning.
This assures after cleaning all build artefacts (qstr related files,
generated version header) have been removed.
2017-03-23 15:49:57 +11:00
stijn c61131380d windows: Make msvc project file support any version from VS2013 to VS2017
Instead of having the PlatformToolset property hardcoded to a specific
version just set it to the value of DefaultPlatformToolset: this gets
defined according to the commandline environment in which the build was
started.
Instead of just supporting VS2015 the project can now be built by any
version from VS2013 to VS2017 and normally future versions as well, without
quirks like VS asking whether you want to upgrade the project to the latest
version (as was the case when opening the project in VS2017) or not being
able to build at all (as was the case when opening the project in VS2013).

Also adjust the .gitignore file to ignore any artefacts from VS2017.
2017-03-23 15:44:27 +11:00
Damien George 92cd000842 minimal/Makefile: Change C standard from gnu99 to c99. 2017-03-23 15:41:38 +11:00
Damien George 4afa782fb4 bare-arm/Makefile: Change C standard from gnu99 to c99. 2017-03-23 15:41:04 +11:00
Krzysztof Blazewicz 75589272ef all/Makefile: Remove -ansi from GCC flags, its ignored anyway.
The -ansi flag is used for C dialect selection and it is equivalent to -std=c90.
Because it goes right before -std=gnu99 it is ignored as for conflicting flags
GCC always uses the last one.
2017-03-23 15:32:12 +11:00
Glenn Ruben Bakke 8a884de7b9 nrf5/modules/ubluepy: Return BLE peer address as string instead of bytearray. Updated struct in modubluepy.h to use a mp_obj_t to hold a string instead of a fixed 6-byte array. Stripped down ScanEntry print out to only contain class name, peer address available through addr attribute. 2017-03-22 23:18:41 +01:00
Paul Sokolovsky 4a4bb84e92 tests/heapalloc_str: Test no-replacement case for str.replace(). 2017-03-22 22:17:52 +03:00
Damien George 58f23def55 py/bc: Provide better error message for an unexpected keyword argument.
Now, passing a keyword argument that is not expected will correctly report
that fact.  If normal or detailed error messages are enabled then the name
of the unexpected argument will be reported.

This patch decreases the code size of bare-arm and stmhal by 12 bytes, and
cc3200 by 8 bytes.  Other ports (minimal, unix, esp8266) remain the same in
code size.  For terse error message configuration this is because the new
message is shorter than the old one.  For normal (and detailed) error
message configuration this is because the new error message already exists
in py/objnamedtuple.c so there's no extra space in ROM needed for the
string.
2017-03-22 13:40:27 +11:00
Damien George 1110c8873c cc3200/mods/modutime: Use generic sleep_ms and sleep_us implementations. 2017-03-22 12:57:51 +11:00
Damien George 3509e2d307 stmhal/systick: Make mp_hal_delay_ms release the GIL when sleeping. 2017-03-22 12:54:43 +11:00
Damien George 2e3fc77809 extmod/utime_mphal: Don't exit/enter the GIL in generic sleep functions.
GIL behaviour should be handled by the port.  And ports probably want to
define sleep_us so that it doesn't release the GIL, to improve timing
accuracy.
2017-03-22 12:49:21 +11:00
Damien George 96c35d0ac4 stmhal/pybthread: Allow interrupts to work during lock/unlock of mutex.
When locking/unlocking a mutex we only need to protect against a thread
switch, not general interrupts.
2017-03-22 12:44:04 +11:00