Wykres commitów

349 Commity (master)

Autor SHA1 Wiadomość Data
Paul Sokolovsky f4ed2dfa94 lib/tinytest: Clean up test reporting in the presence of stdout output.
tinytest is written with the idea that tests won't write to stdout, so it
prints test name witjout newline, then executes test, then writes status.
But MicroPython tests write to stdout, so the test output becomes a mess.
So, instead print it like:

    # starting basics/andor.py
    ... test output ...
    basics/andor.py: OK
2017-12-15 19:41:08 +02:00
Paul Sokolovsky 140bbced6f lib/upytesthelper: MicroPython test helper layer on top of tinytest.
Tinytest is classical assert-style framework, but MicroPython tests work
in different way - they produce content, and that content should be matched
against expected one to see if test passes. upytesthelper exactly adds
helper functions to make that possible.
2017-12-13 09:07:51 +02:00
Paul Sokolovsky e9d29c9ba9 lib/tinytest: Move from tools/tinytest.
Tinytest library was misplaced under tools/. By convention, any target
libraries belong to lib/, while tools/ contains host-side tools.
2017-12-08 19:26:15 +02:00
Damien George 4601759bf5 py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str.
This patch simplifies the str creation API to favour the common case of
creating a str object that is not forced to be interned.  To force
interning of a new str the new mp_obj_new_str_via_qstr function is added,
and should only be used if warranted.

Apart from simplifying the mp_obj_new_str function (and making it have the
same signature as mp_obj_new_bytes), this patch also reduces code size by a
bit (-16 bytes for bare-arm and roughly -40 bytes on the bare-metal archs).
2017-11-16 13:17:51 +11:00
Paul Sokolovsky 99bf5448bd axtls: Update, exposes AES functions to implement ECB chiper mode. 2017-11-05 11:37:05 +02:00
Paul Sokolovsky 8f9af63c20 lib/axtls: Update, support for SSL_EAGAIN return code.
A step towards implementing non-blocking stream support for SSL.
2017-10-29 19:53:59 +02:00
Damien George 81a06d2c9c lib/libm: Remove implementation of log2f, use MP_NEED_LOG2 instead. 2017-10-10 16:01:13 +11:00
Damien George f869d6b2e3 lib/libm: Fix tanhf so that it correctly handles +/- infinity args. 2017-10-04 21:14:00 +11:00
Damien George a3dc1b1957 all: Remove inclusion of internal py header files.
Header files that are considered internal to the py core and should not
normally be included directly are:
    py/nlr.h - internal nlr configuration and declarations
    py/bc0.h - contains bytecode macro definitions
    py/runtime0.h - contains basic runtime enums

Instead, the top-level header files to include are one of:
    py/obj.h - includes runtime0.h and defines everything to use the
        mp_obj_t type
    py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h,
        and defines everything to use the general runtime support functions

Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-10-04 12:37:50 +11:00
Damien George d36539df06 lib/embed/abort_: Use mp_raise_msg helper function. 2017-09-22 11:31:00 +10:00
Paul Sokolovsky e41bc3fcbb berkeley-db-1.xx: Update, allow to override MINCACHE, DEFPSIZE. 2017-09-10 13:51:51 +03:00
Damien George 8388ec4e35 stmhal: Update to new STM Cube HAL library.
This upgrades the HAL to the versions:
- F4 V1.16.0
- F7 V1.7.0
- L4 V1.8.1

The main changes were in the SD card driver.  The vendor changed the SD
read/write functions to accept block number intead of byte address, so
there is no longer any need for a custom patch for this in stm32lib.
The CardType values also changed, so pyb.SDCard().info() will return
different values for the 3rd element of the tuple, but this function was
never documented.
2017-08-29 17:03:28 +10:00
Damien George 904eb2d9f3 lib: Add new submodule, stm32lib containing STM32 CMSIS and HAL source.
Linked to https://github.com/micropython/stm32lib
2017-08-29 13:39:09 +10:00
Javier Candeira 35a1fea90b all: Raise exceptions via mp_raise_XXX
- Changed: ValueError, TypeError, NotImplementedError
  - OSError invocations unchanged, because the corresponding utility
    function takes ints, not strings like the long form invocation.
  - OverflowError, IndexError and RuntimeError etc. not changed for now
    until we decide whether to add new utility functions.
2017-08-13 22:52:33 +10:00
Alexander Steffen 55f33240f3 all: Use the name MicroPython consistently in comments
There were several different spellings of MicroPython present in comments,
when there should be only one.
2017-07-31 18:35:40 +10:00
Alexander Steffen 299bc62586 all: Unify header guard usage.
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.

This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.

The rules are as follows.

Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _

In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.

py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
2017-07-18 11:57:39 +10:00
Damien George e66fd56852 py/repl: Change mp_uint_t to size_t in repl helpers. 2017-07-04 23:44:54 +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 4f9858e86d stmhal: Move pybstdio.c to lib/utils/sys_stdio_mphal.c for common use.
It provides sys.stdin, sys.stdout, sys.stderr for bare-metal targets based
on mp_hal functions.
2017-06-15 18:55:34 +10:00
Damien George 3bedff0b3c lib/libm/math: Remove implementations of float conversion functions.
These implementations are incorrect (eg f2d and d2f don't handle special
values like 0.0) and proper versions can be provided by libgcc (or
equivalent depending on the toolchain).

libgcc is now linked with the stmhal port so that library will provide
these functions from now on.
2017-06-14 17:18:23 +10:00
Paul Sokolovsky f01c1c6b35 lib/axtls: Upgrade to axTLS 2.1.3 + MicroPython patchset.
axTLS 2.1.3 brings support for TLS 1.2 and SNI. With MicroPython patchset
on top of it, the code size growth (x86) is ~2K.
2017-06-13 17:39:20 +03:00
Damien George ab954ed513 lib/utils/interrupt_char: Remove support for KBD_EXCEPTION disabled.
If a port is using interrupt_char.c then it must enable
MICROPY_KBD_EXCEPTION.  This is the case for all official ports.
2017-06-02 12:03:57 +10:00
Damien George b53a63517a lib/libm: Use isfinite instead of finitef, for C99 compatibility. 2017-05-31 11:34:29 +10:00
Ville Skyttä ca16c38210 various: Spelling fixes 2017-05-29 11:36:05 +03:00
Tom Collins 288ea06e7c lib/utils/pyexec: Update event-driven REPL to match non-event REPL.
Don't print dupe ">>> " prompt when starting event-driven REPL.  Clear
incomplete line in transition from raw to friendly REPL.
2017-05-05 22:15:47 +10:00
Damien George b6c7e4b143 all: Use full path name when including mp-readline/timeutils/netutils.
This follows the pattern of how all other headers are now included, and
makes it explicit where the header file comes from.  This patch also
removes -I options from Makefile's that specify the mp-readline/timeutils/
netutils directories, which are no longer needed.
2017-03-31 22:29:39 +11:00
Damien George 3022e00bbf lib/netutils: Update for changes to mp_obj_str_get_data. 2017-03-29 12:56: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
Damien George 6e74d24f30 py: Add micropython.schedule() function and associated runtime code. 2017-03-20 15:20:26 +11:00
Damien George 3f7aa330fd lib/utils/pyexec: Fix bug with pyexec_file not setting flag for source. 2017-03-14 21:53:46 +11:00
Damien George 41b1df6046 lib/memzip: Make lexer constructor raise exception when file not found. 2017-03-14 11:52:05 +11:00
Damien George 56b238393b lib/utils/pyexec: Refactor to put lexer constructors all in one place.
The lexer can now raise an exception on construction so it must go within
an nlr handler block.
2017-03-14 11:52:05 +11:00
Damien George 3b2fd4df31 lib/utils/pyexec: Allow to compile when the uPy compiler is disabled. 2017-02-27 15:02:32 +11:00
Andrew Gatt 9d3c0d423e lib/oofatfs/ffconf.h: Add MICROPY_FATFS_NORTC option. 2017-01-31 19:54:20 +11:00
Damien George b039d93d7e lib/oofatfs/ffconf.h: Allow to configure FS_EXFAT option.
Using MICROPY_FATFS_EXFAT.  Enabling this has licensing implications;
see https://www.microsoft.com/en-us/legal/intellectualproperty/mtl/exfat-licensing.aspx
2017-01-31 12:32:24 +11:00
Damien George 9425bf5b2b lib/fatfs: Remove old fatfs library component, it's replaced by oofatfs. 2017-01-30 12:26:08 +11:00
Damien George 28899cd971 lib/oofatfs: Update oofatfs library.
From https://github.com/micropython/oofatfs, branch work-R0.12b,
commit 46fb53331e7a583c29a41d37ce4b53f2718597e5.
2017-01-30 12:07:40 +11:00
Damien George 0390bc97ea lib/oofatfs: Update oofatfs library.
From https://github.com/micropython/oofatfs, branch work-R0.12b,
commit 1e295b40550664bbaac18d95a4b6a58154464d31.
2017-01-27 23:22:15 +11:00
Damien George 9b08faf3ae lib/oofatfs: Add OO version of FatFS library.
From https://github.com/micropython/oofatfs, branch work-R0.12b,
commit a346ccec123c2e4d887e2751d64156208d03bff4.
2017-01-27 13:19:10 +11:00
Damien George 211244d1f3 lib/utils/pyexec: Only print help prompt if HELP feature is enabled. 2017-01-22 12:33:19 +11:00
Damien George 895807137e lib/utils: Remove old pyhelp helper, replaced with py/builtinhelp.c.
Ports should no longer use pyhelp_print_obj but instead should define
MICROPY_PY_BUILTINS_HELP to 1 and then specify their help text using
MICROPY_PY_BUILTINS_HELP_TEXT.
2017-01-22 11:56:16 +11:00
Damien George d89cafd5c3 lib/utils/interrupt_char: Use core-provided mp_kbd_exception if enabled.
Ultimately all ports that use lib/utils/interrupt_char would enable
MICROPY_KBD_EXCEPTION, so this is an interim solution.
2016-12-15 13:35:54 +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
Paul Sokolovsky 3cdccb9b14 zephyr: Fix mp_hal_set_interrupt_char() declaration to be compatible.
With other ports. Other ports declare it in mphalport.h, it can be
inline or macro.
2016-10-26 17:53:28 +03:00
Paul Sokolovsky 6832cbd69d lib/utils/pyexec: Fix compilation warning of type vs format mismatch.
This happens with some compilers on some architectures, which don't define
size_t as unsigned int. MicroPython's printf() dooesn't support obscure
format specifiers for size_t, so the obvious choice is to explicitly cast
to unsigned, to match %u used in printf().
2016-10-26 13:45:03 +03:00
Vincenzo Frascino c38ea32810 lib/utils/pyexec: Add mp_hal_set_interrupt_char() prototype.
This patch removes a compilation warning in pyexec.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-10-26 13:42:27 +03:00
Erik Moqvist f64e806f50 lib/utils/pyhelp.c: Use mp_printf() instead of printf()
This patch introduces MP_PYTHON_PRINTER for general use.
2016-10-21 18:30:58 +11:00
Damien George 4ebdb1f2b2 py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros.
In order to have more fine-grained control over how builtin functions are
constructed, the MP_DECLARE_CONST_FUN_OBJ macros are made more specific,
with suffix of _0, _1, _2, _3, _VAR, _VAR_BETEEN or _KW.  These names now
match the MP_DEFINE_CONST_FUN_OBJ macros.
2016-10-21 16:26:01 +11:00
Damien George ad3724e0bc lib/utils/pyexec: Allow behaviour of SystemExit to be configurable.
Setting the pyexec_system_exit variable to PYEXEC_FORCED_EXT allows
SystemExit exceptions to terminate the pyexec functions.
2016-10-17 13:14:59 +11:00
Damien George 824f5c5a32 py/vstr: Combine vstr_new_size with vstr_new since they are rarely used.
Now there is just one function to allocate a new vstr, namely vstr_new
(in addition to vstr_init etc).  The caller of this function should know
what initial size to allocate for the buffer, or at least have some policy
or config option, instead of leaving it to a default (as it was before).
2016-10-14 16:46:34 +11:00
Paul Sokolovsky 4021b1e1b8 lib/utils/pyexec: Don't treat SystemExit as "forced exit".
"Forced exit" is treated as soft-reboot (Ctrl+D). But expected effect of
calling sys.exit() is termination of the current script, not any further
and more serious actions like mentioned soft reboot.
2016-10-12 18:00:32 +03:00
Krzysztof Blazewicz b04d4a5b13 lib/cmsis: upgrade CMSIS-CORE to V4.30 2016-09-30 16:19:03 +10:00
Krzysztof Blazewicz fa6f774b2c lib/cmsis: remove CMSIS-DSP headers, they are unused 2016-09-30 16:19:03 +10:00
Krzysztof Blazewicz 6aea34ad89 lib/cmsis: move CMSIS headers to lib/
Files in lib/cmsis are generic for all Cortex-M MCU's
files left in stmhal/cmsis are all STM32 specific.
2016-09-30 16:19:03 +10:00
Paul Sokolovsky 6ab2c5e6cc lib/interrupt_char: Factor out typical Ctrl+C handling from esp8266 port.
Utility functions for keyboard interrupt handling, to be reused across
(baremetal) ports.
2016-09-29 10:15:38 -07:00
Delio Brignoli e2ac8bb3f1 py: Add MICROPY_USE_INTERNAL_PRINTF option, defaults to enabled.
This new config option allows to control whether MicroPython uses its own
internal printf or not (if not, an external one should be linked in).
Accompanying this new option is the inclusion of lib/utils/printf.c in the
core list of source files, so that ports no longer need to include it
themselves.
2016-09-05 12:18:53 +10:00
Paul Sokolovsky bae62d9abe lib/utils/pyexec: qstr_pool_info() requires size_t* parameters. 2016-08-30 00:58:42 +03:00
Paul Sokolovsky b0e2106fb8 lib/berkeley-db-1.xx: Update to upstream, fixes MacOSX build. 2016-08-25 21:30:20 +03:00
Paul Sokolovsky 9897bcaa73 lib/utils/stdout_helpers: Fix function signature to match py/mphal.h. 2016-08-25 15:23:50 +03:00
Paul Sokolovsky 6d11918d49 lib/berkeley-db-1.xx: Update, sets default page size to 4096.
This both good default for 4096 and makes less chance to see overflow page
issues.
2016-08-09 02:09:59 +03:00
Paul Sokolovsky 2ec943284a lib/berkeley-db-1.xx: Switch to "embedded" branch.
It allows to access files via a virtual method tables and thus can integrate
with MicroPython's stream objects.
2016-07-31 00:36:38 +03:00
Paul Sokolovsky 58d9d85a56 lib/abort_.c: Add prototype to make coverage build happy. 2016-07-30 17:52:06 +03:00
Paul Sokolovsky c8b80e4740 lib/embed/abort_: Implementation of abort_() function raising uPy exception.
Helpful when porting existing C libraries to MicroPython. abort()ing in
embedded environment isn't a good idea, so when compiling such library,
-Dabort=abort_ option can be given to redirect standard abort() to this
"safe" version.
2016-07-30 00:35:50 +03:00
Paul Sokolovsky 43473372e6 lib/utils/stdout_helpers: Move from minimal/uart_extra.c for reuse. 2016-07-22 19:56:27 +03:00
Paul Sokolovsky 04c27e5eaa lib/utils/pyexec: Use full path to readline.h header, per latest conventions. 2016-07-21 00:14:10 +03:00
Paul Sokolovsky 26d5e91bf3 lib/axtls: Update, fixes esp8266 build. 2016-07-11 17:00:42 +03:00
Paul Sokolovsky 7711d87563 lib/axtls: Upgrade to axTLS 1.5.4 + MicroPython patchset. 2016-07-10 23:24:43 +03:00
Damien George 7ddd85f933 lib/libm: Remove unused definition of "one". 2016-06-25 22:30:40 +01:00
Damien George 873853f1a8 lib/libm: Format code to pass gcc v6.1.1 warning.
gcc 6.1.1 warns when indentation is misleading, and in this case the
formatting of the code really is misleading.  So adjust the formatting
to be clear of the meaning of the code.
2016-06-25 22:28:43 +01:00
Paul Sokolovsky d402bf299d lib/fatfs/option/ccsbcs: Follow uPy optional features model.
Don't error out when options is not what you support, just skip your code.
This allows to make FatFs support properly configurable.
2016-06-15 23:53:26 +03:00
Paul Sokolovsky a1eab98eaf lib/berkeley-db-1.xx: Update to upstream which builds for uPy.
Applied "official" patches and fixed various warnings when built with uPy's
compile options.
2016-06-15 04:09:29 +03:00
Paul Sokolovsky 06b783cf58 lib/berkeley-db-1.xx: Add Berkeley DB 1.85 as a submodule.
From https://github.com/pfalcon/berkeley-db-1.xx, which so far contains
pristine 1.85, but will get patches and compile warning fixes going
forward.

Berkeley DB 1.xx is BSD-licensed, and will form the basis of "btree"
simple database module.
2016-06-14 22:20:18 +03:00
Paul Sokolovsky 1bc8aa85a4 lib/timeutils/timeutils: Fix pedantic warning in coverage build. 2016-06-03 10:46:15 +03:00
Paul Sokolovsky 993cc3611a lib/timeutils/timeutils: timeutils_mktime may accept negative time values.
And will normalize them.
2016-06-02 22:52:42 +03:00
Paul Sokolovsky c6923f52f0 lib/libc/string0: Remove better-than-standard strncpy() implementation.
ANSI C doesn't require that strncpy() produced null-terminated string, so
it's basicly useless for string manipulation.
2016-05-02 18:53:21 +03:00
Paul Sokolovsky bd9de5ec90 lib/libc/string0: Add strncpy() implementation. 2016-05-02 18:38:19 +03:00
Paul Sokolovsky 1f0dfe37a1 lib/axtls: Update to the latest upstream, fix reported MacOSX build issue. 2016-05-01 22:19:14 +03:00
Paul Sokolovsky 50ef851bee lib/timeutils/timeutils: Typo fix in comment. 2016-04-27 18:52:57 +03:00
Colin Hogben 2b46da234c lib/utils/pyhelp: Extract implementation of help(obj) to a library function.
Several ports use identical code for the 1-argument form of the builtin
help function.  Move this code to a library function to allow easier
re-use by ports.
2016-04-25 18:54:09 +03:00
Colin Hogben 8aa3cbf153 lib/utils/pyexec: Condition-out GC calls from pyexec.
A port which uses lib/utils/pyexec.c but which does not enable garbage
collection should not need to implement the gc_collect function.

This patch also moves the gc_collect call to after printing the qstr
info.  Since qstrs cannot be collected it should not make any difference
to the printed statistics.
2016-04-19 09:22:40 +01:00
Damien George 0a2e9650f5 py: Add ability to have frozen persistent bytecode from .mpy files.
The config variable MICROPY_MODULE_FROZEN is now made of two separate
parts: MICROPY_MODULE_FROZEN_STR and MICROPY_MODULE_FROZEN_MPY.  This
allows to have none, either or both of frozen strings and frozen mpy
files (aka frozen bytecode).
2016-04-13 16:07:47 +01:00
Paul Sokolovsky 47442d9f52 lib/utils/printf: Rework overriding printer of DEBUG_printf().
By default it uses mp_plat_print, but a port may override it to another
value with MICROPY_DEBUG_PRINTER_DEST.
2016-04-13 11:53:12 +03:00
Paul Sokolovsky 5e919b7ef8 lib/axtls: Update to the latest upstream master. 2016-04-08 15:19:57 +03:00
Paul Sokolovsky 777232c9a5 esp8266: Disallow recursive calls to REPL.
Before this change, if REPL blocked executing some code, it was possible
to still input new statememts and excuting them, all leading to weird,
and portentially dangerous interaction.

TODO: Current implementation may have issues processing input accumulated
while REPL was blocked.
2016-04-01 12:53:50 +03:00
Paul Sokolovsky 2e75a17bab esp8266: Fix issue when current repl line was garbage-collected.
Reference it from root pointers section.
2016-03-30 18:13:03 +03:00
Damien George 13a4c120ce lib/fatfs: Add support for sector sizes larger than 512 bytes.
If MICROPY_FATFS_MAX_SS is defined to power of 2 value between 1024 and
4096, support for dynamic sector size in FatFs will be enabled.  Note
that FatFs reserves static buffer of MICROPY_FATFS_MAX_SS size for each
filesystem in use, so that value should be set sparingly.

Initial patch provided by @pfalcon.
2016-02-10 08:59:58 +00:00
Damien George 64ececb72f lib/libc/string0: Use uintptr_t instead of uint32_t.
This makes the code portable to non-32-bit architectures.
2015-12-31 14:11:18 +00:00
Damien George 84b245f187 lib/utils: Add pyexec_frozen_module to load and execute frozen module.
This is a convenience function similar to pyexec_file.  It should be used
instead of raw mp_parse_compile_execute because the latter does not catch
and report exceptions.
2015-12-26 12:32:33 +00:00
Damien George a67651406d lib/libm: Allow math funcs to be used by non-Thumb archs.
Requires addition of software implementation of sqrtf function.
2015-12-18 21:05:44 +00:00
Paul Sokolovsky f2ed736b29 lib/utils/printf: Add vsnprintf alias for Clang.
Was reported to break MacOSX build.
2015-12-12 20:19:42 +02:00
Paul Sokolovsky 1f0aaece3a lib/utils/printf: Apply workaround for static linking with uclibc.
uclibc objects call __GI_vsnprintf().
2015-12-10 14:42:01 +02:00
Damien George 4e7107a572 py: Change mp_print_strn_t func type to use size_t for the str length. 2015-11-29 14:25:04 +00:00
Paul Sokolovsky 4892e4c5fc lib/utils/printf: Use more conservative check for MICROPY_DEBUG_STDERR. 2015-11-23 22:38:48 +02:00
Paul Sokolovsky 1818da2ef3 lib/utils/printf: Fix issue with putchar define for some ports. 2015-11-22 02:46:32 +02:00
Paul Sokolovsky 8ee43e24f3 lib/utils/printf: Add extra prototypes. 2015-11-22 00:59:24 +02:00
Paul Sokolovsky c3280d83e7 unix: Use printf() implementation in terms of mp_printf().
In other words, unix port now uses overriden printf(), instead of using
libc's. This should remove almost all dependency on libc stdio (which
is bloated).
2015-11-22 00:44:41 +02:00
Paul Sokolovsky 295ea12411 py/emitglue: Host definition of mp_verbose_flag.
This may not seem like the ideal place, but is actually the only place
in py/ where it gets referenced, so is just right.
2015-11-21 16:54:15 +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
Damien George 40274fec9c lib/pyexec: Move header pyexec.h from stmhal directory. 2015-11-09 13:13:09 +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
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
Dave Hylands 074d713bfb lib/memzip: Factor out memzip from teensy/ into lib/memzip. 2015-11-04 14:21:10 +00:00
Damien George dde0c204e7 lib/pyexec: For paste mode use "Ctrl" as the name of the key, not "CTRL". 2015-11-03 00:33:56 +00:00
Paul Sokolovsky 0ec51441de stmhal: pyexec.c is common module, move to lib/utils/ . 2015-10-31 19:35:10 +03:00
Damien George 731f359292 all: Add py/mphal.h and use it in all ports.
py/mphal.h contains declarations for generic mp_hal_XXX functions, such
as stdio and delay/ticks, which ports should provide definitions for.  A
port will also provide mphalport.h with further HAL declarations.
2015-10-31 19:14:30 +03:00
stijn 12fab63928 lib: Replace tabs with spaces in readline.c 2015-10-26 11:38:12 +00:00
Galen Hazelwood 22cb7cd953 lib/lwip: Add LwIP stack as a submodule in the library directory 2015-10-23 00:35:20 +03:00
Damien George f961456b29 lib/mp-readline: Add n_chars argument to mp_hal_erase_line_from_cursor.
If VT100 support is not available then a given implementation of
mp_hal_erase_line_from_cursor might need to know the number of characters
to erase.

This patch does not change generated code when VT100 is supported, since
compiler can optimise away the argument.
2015-10-20 13:27:14 +01:00
Paul Sokolovsky c13be69a8e lib/libffi: Add libffi as a submodule.
This allows to build libffi from source together with micropython, and is
useful for cross-compilation. Support for this was already merged
previously, to use:

make libffi
make MICROPY_STANDALONE=1

(To both commands appropriate cross-compilition flags can be added).
2015-10-17 15:52:35 +03:00
Damien George 46a1102852 repl: Add paste mode to friendly REPL, entered via CTRL-E.
Use CTRL-E to enter paste mode.  Prompt starts with "===" and accepts
all characters verbatim, echoing them back.  Only control characters are
CTRL-C which cancels the input and returns to normal REPL, and CTRL-D
which ends the input and executes it.  The input is executed as though
it were a file.  The input is not added to the prompt history.
2015-10-11 23:30:22 +01:00
Paul Sokolovsky f4d55c91fe lib/axtls: Update submodule, adds .gitignore . 2015-10-04 15:55:37 +03:00
Paul Sokolovsky 90a36942b4 lib/axtls: Add axtls git submodule, dependency of modussl.
From https://github.com/pfalcon/axtls , branch micropython.
2015-10-04 02:39:00 +03:00
Damien George 0af73014cc lib/mp-readline: Add auto-indent support.
4 spaces are added at start of line to match previous indent, and if
previous line ended in colon.

Backspace deletes 4 space if only spaces begin a line.

Configurable via MICROPY_REPL_AUTO_INDENT.  Disabled by default.
2015-09-12 22:07:23 +01:00
Tom Soulanille 7d588b0c7c lib/mp-readline: Add emacs-style control characters for cursor movement.
Disabled by default.  Adds 108 bytes to Thumb2 arch when enabled.
2015-07-26 15:22:13 +01:00
stijn 278d22ce8f lib/mp-readline: Allow overriding implementation of cursor functions
Default implementation uses VT100-style sequences which are not implemented
by all terminals out there
2015-05-30 13:38:34 +03:00
stijn 9a522dda6e lib/mp-readline: Add implementation for deleting a character
xterm and others use the ESC[~3 sequence when pressing the delete key
2015-05-30 13:38:24 +03:00
Damien George 2acfb7c002 lib/mp-readline: Export readline_push_history function. 2015-05-27 15:06:17 +01:00
Dave Hylands a3a14b9db7 lib: Fix some issues in timeutils
In particular, dates prior to Mar 1, 2000 are screwed up.

The easiest way to see this is to do:

>>> import time
>>> time.localtime(0)
(2000, 1, 1, 0, 0, 0, 5, 1)
>>> time.localtime(1)
(2000, 1, 2, 233, 197, 197, 6, 2)

With this patch, we instead get:
>>> import time
>>> time.localtime(1)
(2000, 1, 1, 0, 0, 1, 5, 1)

Doh - In C % is NOT a modulo operator, it's a remainder operator.
2015-05-21 23:31:50 +03:00
Josef Gajdusek 1db4253886 lib: Move time utility functions to common library. 2015-05-13 00:12:54 +01:00
Josef Gajdusek 04ee5983fe lib: Move some common mod_network_* functions to lib/netutils. 2015-05-04 11:48:40 +01:00
Damien George a1a2c411b2 py, readline: Add tab autocompletion for REPL.
Can complete names in the global namespace, as well as a chain of
attributes, eg pyb.Pin.board.<tab> will give a list of all board pins.

Costs 700 bytes ROM on Thumb2 arch, but greatly increases usability of
REPL prompt.
2015-04-29 00:46:26 +01:00
Damien George b7a4f15b34 mp-readline: Save "prompt" string in readline state. 2015-04-29 00:32:35 +01:00
Daniel Campora abea1c38a9 lib/libc: Add memchr. We already have strchr, but memchr is useful too. 2015-04-28 16:48:20 +02:00
Damien George f53a8e712f lib/libc/string0.c: Remove include of std.h, replace with string.h.
Much more portable this way.
2015-04-18 14:27:55 +01:00
Damien George d07ccc5a39 lib/fatfs: Space optimise the ff_wtoupper function.
Saves 768 bytes code space on Thumb2 archs.
2015-04-11 15:17:04 +01:00
Paul Sokolovsky 3a84c8b58d string0.c: Move from stmhal/ to lib/. 2015-04-05 21:57:55 +03:00
Daniel Campora 7b19e99edd lib: Update FatFs to R0.11.
There are lots of cosmetic changes, but this release brings a  very
important bug fix:
 - Fixed f_unlink() does not remove cluster chain of the file.

With R0.10c if you try to write a file that is too large to fit in the
free space of the drive, the operation fails, you delete the incomplete
file, and it seems to be erased, but the space is not really freed,
because any subsequent write operations fail because the drive is
"still" full. The only way to recover from this is by formatting the
drive. I can confirm that R0.11 fixes the problem.
2015-03-29 22:12:14 +01:00
Damien George 9ab94c468c lib/libm: Add implementations of erf, erfc, lgamma, tgamma. 2015-02-22 14:47:11 +00:00
Damien George 601c814603 minimal: Allow to compile without defining MICROPY_HAL_H. 2015-02-13 15:26:53 +00:00
Damien George 0b32e50365 stmhal: Make pybstdio usable by other ports, and use it.
Now all ports can use pybstdio.c to provide sys.stdin/stdout/stderr, so
long as they implement mp_hal_stdin_* and mp_hal_stdout_* functions.
2015-02-13 15:04:53 +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 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
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 6d1f5070ce lib/libm: Add frexp and modf functions; use in stmhal; add tests.
Addresses issue #1081.
2015-01-22 13:48:29 +00:00
Damien George bbf5cd01e3 py: Allow to compile with -Wstrict-prototypes. 2015-01-12 22:45:35 +00:00
Damien George abc1959e2c py, unix, lib: Allow to compile with -Wold-style-definition. 2015-01-12 22:34:38 +00:00
Paul Sokolovsky 3f9f9cac75 lib/mp-readline: Refactor to support coroutine/event-driven usage.
readline_process_char() can be fed character by character, for example,
received from external event loop. This will allow to integrate MicroPython
into cooperative multitasking systems.
2015-01-12 04:36:57 +02:00
Paul Sokolovsky a7bcb218fe stmhal: Move readline code to lib/mp-readline/. 2015-01-12 04:15:35 +02:00
Paul Sokolovsky 8a2cc1c7e4 stmhal: Add fake implementation of __aeabi_f2lz().
To make mp_obj_new_int_from_float() somehow work.
2014-12-30 00:52:41 +02:00
Damien George e2745b307b lib/fatfs: Allow a smaller minimum sector count for fatfs to be created. 2014-12-27 20:20:08 +00:00
Damien George 6b755d827a lib/fatfs: Support our volume names; make some funcs static. 2014-12-27 17:36:16 +00:00
Damien George c546b66bab lib/fatfs: Upgrade to new FatFs driver, put in lib/ for common use.
Patches to fatfs for our use will follow.
2014-12-27 17:36:16 +00:00
Damien George f04329e93b lib/libm: Add acosh, asinh, atanh, tan; get working with stmhal.
acoshf, asinhf, atanhf were added from musl.  mathsincos.c was
split up into its original, separate files (from newlibe-nano-2).
tan was added.

All of the important missing float functions are now implemented,
and pyboard now passes tests/float/math_fun.py (finally!).
2014-12-18 14:44:02 +00:00
Damien George 1559a97810 py: Add builtin round function.
Addresses issue #934.
2014-10-31 11:28:50 +00:00
Damien George 8bb44f69f2 lib: Add basic README. 2014-09-18 00:13:03 +01:00
Damien George 8594ce2280 py: Implement divmod, % and proper // for floating point.
Tested and working on unix and pyboard.
2014-09-13 18:43:09 +01:00
Damien George 20beff9ae3 py and libm: Add asinf,acosf; print higher precision for float.
Also use less stack space when printing single precision float.

Addition of asinf and acosf addresses issue #851.
2014-09-11 22:24:45 +01:00
Damien George 4d3fc46326 lib, libm: Add back dummy definition of tanf. 2014-08-29 23:24:00 +01:00
Damien George 8707ea3421 lib: Add lib and libm, moving current files from stmhal.
Top-level lib directory is for standard C libraries that we want to
provide our own versions of (for efficiency and stand-alone reasons).
It currently has libm in it for math functions.

Also add atanf and atan2f, which addresses issue #837.
2014-08-29 22:42:26 +01:00