Commit Graph

8699 Commits

Author SHA1 Message Date
Damien George adf22c19ae py/mpprint: Remove unreachable check for neg return of mp_format_float. 2017-06-30 12:10:50 +10:00
Scott Shawcroft b6ebf855d3 Update README with os and random info. 2017-06-29 17:30:02 -07:00
Scott Shawcroft 3bf6303081 Add link to discord chat. 2017-06-29 17:17:50 -07:00
Damien George 8f6ef8de48 tests/basics/namedtuple1: Add test for creating with pos and kw args. 2017-06-29 17:50:09 +10:00
Damien George 265500c5c8 py/objnamedtuple: Simplify and remove use of alloca building namedtuple.
Prior to this patch there were 2 paths for creating the namedtuple, one for
when no keyword args were passed, and one when there were keyword args.
And alloca was used in the keyword-arg path to temporarily create the array
of elements for the namedtuple, which would then be copied to a
heap-allocated object (the namedtuple itself).

This patch simplifies the code by combining the no-keyword and keyword
paths, and removing the need for the alloca by constructing the namedtuple
on the heap before populating it.

Heap usage in unchanged, stack usage is reduced, use of alloca is removed,
and code size is not increased and is actually reduced by between 20-30
bytes for most ports.
2017-06-29 17:40:25 +10:00
Paul Sokolovsky 1942f0ceef docs/{framebuf,usocket}: Use markup adhering to the latest docs conventions. 2017-06-29 02:22:14 +03:00
Scott Shawcroft 725d715a1b shared-bindings: Introduce storage.remount() so you can set root as
writeable and prevent USB from editing it.
2017-06-28 16:18:13 -07:00
Scott Shawcroft 1e16e813e8 atmel-samd: Update sys.path with correct root path. 2017-06-28 14:53:01 -07:00
Scott Shawcroft 05f0681966 atmel-samd: update boot output location for new mount point. 2017-06-28 14:51:46 -07:00
Scott Shawcroft d6a24afd71 Change vfs mount ordering such that the root is always last in the
linked list. Its also the only one statically allocated and made
available over USB.
2017-06-28 14:46:49 -07:00
Scott Shawcroft 5ddbf26b62 atmel-samd: Update sys.path to match that the internal/onboard
flash is now at / rather than /flash.
2017-06-28 12:52:29 -07:00
Scott Shawcroft c797f3cb24 shared-module: Fix os.listdir to correctly return list rather than
iterator.
2017-06-28 12:51:32 -07:00
Damien George 346f5d4cce stmhal/mpconfigport.h: Allow MICROPY_PY_THREAD to be overridden. 2017-06-28 15:45:04 +10:00
Damien George 05a08506ae stmhal/Makefile: Add CFLAGS_EXTRA to CFLAGS so cmdline can add options. 2017-06-28 15:44:29 +10:00
Damien George 703370ebc5 stmhal/Makefile: Rename FLOAT_IMPL to MICROPY_FLOAT_IMPL to match C name
The name used in py/mpconfig.h is MICROPY_FLOAT_IMPL so rename this
Makefile variable to mirror that.
2017-06-28 15:42:40 +10:00
Damien George 4d47e6c0db travis: Build STM32F769DISC board instead of F7DISC to test dbl-prec FP. 2017-06-28 15:12:05 +10:00
Damien George 535804a0ed stmhal/Makefile: Use hardware double-prec FP for MCUs that support it. 2017-06-28 15:12:05 +10:00
Damien George d20f8fb893 stmhal/boards: Enable double-prec FP on F76x boards. 2017-06-28 15:12:04 +10:00
Damien George ebfdd96cb2 stmhal: Add possibility to build with double-precision floating point.
By default the firmware is built with single-precision floating point.
To build a particular board using double precision instead, put the
following line in the mpconfigboard.mk file:

    FLOAT_IMPL = double
2017-06-28 15:12:04 +10:00
Damien George 045116551e lib: Add libm_dbl, a double-precision math library, from musl-1.1.16. 2017-06-28 15:12:04 +10:00
Damien George 409fc8f9c1 tests/import: Update comment now that uPy raises correct exception. 2017-06-28 12:21:29 +10:00
Damien George 3a9445c6b3 tests/import: Add a test for the builtin __import__ function. 2017-06-28 12:21:29 +10:00
Damien George 2f7fad66a2 py/builtinimport: Remove unreachable code for relative imports.
The while-loop that calls chop_component will guarantee that level==-1 at
the end of the loop.  Hence the code following it is unnecessary.

The check for p==this_name will catch imports that are beyond the
top-level, and also covers the case of new_mod_q==MP_QSTR_ (equivalent to
new_mod_l==0) so that check is removed.

There is also a new check at the start for level>=0 to guard against
__import__ being called with bad level values.
2017-06-28 12:21:29 +10:00
Alexander Steffen ebb9396274 esp8266,minimal,pic16bit: Use size_t for mp_builtin_open argument.
py/builtin.h declares mp_builtin_open with the first argument of type
size_t.  Make all implementations conform to this declaration.
2017-06-28 11:45:52 +10:00
Scott Shawcroft a0058e6712 Introduce a random module that is a subset of CPython's random. It
also initializes in the same way where it takes from a true random
source when available through os.urandom(). After initializing, it
produces deterministic results until the seed is set.

This replaces urandom!

Fixes #139.
2017-06-27 17:37:24 -07:00
Scott Shawcroft 265d5dab05 docs: Typos and rename to CircuitPython. 2017-06-27 17:37:03 -07:00
Scott Shawcroft 778e975936 Split uos module into os and storage.
os is a subset of CPython's os. storage contains additional
file system mounting functionality based on UNIX's mount
management.

Fixes #140
2017-06-27 15:17:30 -07:00
Alexander Steffen cd0987f5b7 py/frozenmod.h: Add missing header guards 2017-06-28 00:51:45 +03:00
Paul Sokolovsky f8ac28964d docs/{micropython,sys,uos}: Use markup adhering to the latest docs conventions. 2017-06-28 00:37:47 +03:00
Benjamin Weps 3e82bedf46 stmhal/sdcard: Allow a board to customise the SDIO pins. 2017-06-27 12:42:46 +10:00
Paul Sokolovsky fbd252b77c docs/{esp,pyb,ubinascii}: Use markup adhering to the latest docs conventions. 2017-06-27 00:38:05 +03:00
Paul Sokolovsky 748f493f33 docs: Move all ports docs to the single ToC.
Previously, only "selected chapters" were shown in left-pane ToC (of
Read The Docs theme). These chapters were selected out of order. The
rest of chapters were hidden beyond "Documentation Contents" pseudo-
chapter. This arguably led only to confusion, as many people probably
never tried to open that pseudo-chapter, and those who did, were
confused. Such organization is even worse for PDF output, causing
chapters go in mix-mashed order.

So, instead move to single clean ToC. This will allow readers of HTML
to have access to any doc content at their fingertips (and straight
before their eyes), and will allow to finally have clean PDF docs.
2017-06-27 00:34:27 +03:00
Scott Shawcroft e87a61ffb4 atmel-samd: Fix running off of the new VFS filesystem including
an issue at startup leading to safe mode and mass storage support
not working.
2017-06-26 14:04:22 -07:00
Damien George 683df1c8d5 drivers/onewire: Enable pull-up when init'ing the 1-wire pin.
A previous version of the 1-wire driver (which was recently replaced by the
current one) had this behaviour and it allows to create a 1-wire bus
without any external pull-up resistors.
2017-06-26 17:48:05 +10:00
Damien George 118173013f stmhal/boards/stm32f405.ld: Increase FLASH_TEXT to end of 1MiB flash.
And and FLASH_FS, and use "K" values instead of hex numbers for lengths.

The increase of FLASH_TEXT is to allow more frozen bytecode for a
particular user's project.  It's not used for anything else.
2017-06-26 17:00:06 +10:00
Damien George 02e9337494 README: Improve description of precompiled bytecode; mention mpy-cross. 2017-06-26 15:33:43 +10:00
Damien George 7a4694fc4e docs/library/gc: Fix grammar and improve readability of gc.threshold(). 2017-06-26 15:25:51 +10:00
Damien George 0a54b6dce9 docs/esp8266/tutorial/intro: Fix some grammatical typos. 2017-06-26 15:12:48 +10:00
Damien George caa132a236 esp8266/machine_rtc: Use correct arithmetic for aligning RTC mem len. 2017-06-26 14:29:30 +10:00
Damien George 4a6c0fda78 tests: Auto detect floating point capabilites of the target.
The floating-point precision of the target is detected (0, 30, 32 or 64)
and only those tests which can run on the target will be run.
2017-06-26 13:47:00 +10:00
Damien George c408ed9fb1 py/mpconfig.h: Remove spaces in "Micro Python" and remove blank line. 2017-06-26 12:29:20 +10:00
Paul Sokolovsky a926119099 docs/ref/speed_python: Update and make more hardware-neutral.
Move hardware-specific optimizations to the very end of document, and
add visible note that it gives an example for Pyboard. Remove references
to specific hardware technologies, so the doc can be more naturally
used across ports. Various markup updates to adhere to the latest
docs conventions.
2017-06-26 01:11:17 +03:00
Paul Sokolovsky dd16e21562 docs/network: Use markup adhering to the latest docs conventions. 2017-06-26 00:37:30 +03:00
Paul Sokolovsky 7c0e1f1a08 docs/machine*: Use markup adhering to the latest docs conventions. 2017-06-25 13:30:29 +03:00
Paul Sokolovsky cfce7d784e docs/lcd160cr: Group related constants together. Use full sentences.
Per the latest docs conventions.
2017-06-25 13:28:23 +03:00
Paul Sokolovsky ba33c544bb docs/conf.py: Set default_role = 'any'.
This causes `symbol` syntax to be equivalent to :any:`symbol`, which is
in turn the easiest way to cross-reference an arbitrary symbol in the
docs:

http://www.sphinx-doc.org/en/stable/markup/inline.html#role-any

:any: requires at least Sphinx 1.3 (for reference, Ubuntu 16.03 ships
with 1.3.6, the latest 1.6.3).

Any many of our docs, `symbol` is misused to specify arguments to
functions, etc. Refactoring that is in progress. (CODECONVENTIONS
already specify proper syntax for both arguments and xrefs, based
on CPython conventions).
2017-06-25 00:57:44 +03:00
Paul Sokolovsky 6f87b03e3c docs/utime: Use markup adhering to the latest conventions. 2017-06-25 00:54:38 +03:00
Paul Sokolovsky 1e31d4bdf6 docs/lcd160cr: Use markup adhering to the latest conventions. 2017-06-25 00:46:07 +03:00
Paul Sokolovsky 176aa681f0 CODECONVENTIONS: docs: Markup for None/True/False.
Based on what CPython uses. However, Read The Docs theme styles this
markup in very stand-out way, so we may think what to do about it.
2017-06-25 00:26:44 +03:00
Paul Sokolovsky 7f2bc83dbc docs/btree: Use markup adhering to the latest conventions. 2017-06-25 00:17:18 +03:00