Commit Graph

7453 Commits

Author SHA1 Message Date
Scott Shawcroft 576373552a atmel-samd: Run the VM hook while waiting for the UART read to timeout in case nothing is received. 2016-12-19 16:36:32 -08:00
Damien George 0d32f1aeb3 esp8266: When doing GC be sure to trace the memory holding native code.
Native code can hold pointers to objects on the heap, eg constant objects
like big integers.
2016-12-20 11:20:01 +11:00
Rami Ali 5e1ccddc82 tests/basics: Improve mpz test coverage. 2016-12-20 10:15:48 +11:00
Scott Shawcroft b09a711eb0 Merge pull request #66 from tannewt/uart
Thanks to @turbinenreiter for the first work on this.

I heavily modified it to work with a circular RX buffer of configurable size. The main API is the same as the stream API and is a subset of upstream's machine.UART.

Fixes #46
2016-12-19 14:02:14 -08:00
Scott Shawcroft f2bfbab6a0 atmel-samd: Save space by not creating default files on the FS and by only keeping LED flashing code when LEDs are present. 2016-12-19 13:03:50 -08:00
Sebastian Plamauer 1598e44231 atmel-samd: Add preliminary support for UART 2016-12-19 13:03:50 -08:00
Paul Sokolovsky 91359c8690 tests/struct*: Make skippable. 2016-12-19 19:41:12 +03:00
Damien George de9cd00b39 py/compile: Add an extra pass for Xtensa inline assembler.
It needs an extra pass to compute the size of the constant table for the
l32r instructions.
2016-12-19 17:42:25 +11:00
Paul Sokolovsky bbd0d27a25 zephyr: Enable slice subscription.
Required for the testsuite.
2016-12-18 21:52:52 +03:00
Paul Sokolovsky 56a514c193 zephyr/uart_core: Access console UART directly instead of printk() hack.
This is required to avoid extra level of output "cooking" ("\r\r\n") and
make test infrastructure work. On the other hand, this breaks somewhat
Zephyr console abstraction.
2016-12-17 00:48:56 +03:00
Paul Sokolovsky 0c59c30fde zephyr: Use core-provided keyboard exception object. 2016-12-16 01:07:28 +03:00
Paul Sokolovsky 724b82559d zephyr/main: Initialize sys.path and sys.argv. 2016-12-16 00:33:33 +03:00
Mike Causer 87e426c7c7 esp8266: Add "erase" target to Makefile, to erase entire flash. 2016-12-15 22:29:16 +11:00
Damien George 48d81c6900 esp8266: Use core-provided keyboard exception object. 2016-12-15 15:52:47 +11:00
Damien George a770ba147e stmhal: Use core-provided keyboard exception object. 2016-12-15 15:51:34 +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 7f1da0a03b py: Add MICROPY_KBD_EXCEPTION config option to provide mp_kbd_exception.
Defining and initialising mp_kbd_exception is boiler-plate code and so the
core runtime can provide it, instead of each port needing to do it
themselves.

The exception object is placed in the VM state rather than on the heap.
2016-12-15 13:00:19 +11:00
Damien George 979ab4e126 stmhal/usb: Always use the mp_kbd_exception object for VCP interrupt.
There's no need to store a separate pointer to this object.
2016-12-15 12:45:56 +11:00
Damien George f254cfd3c4 stmhal: Rename mp_const_vcp_interrupt to mp_kbd_exception.
mp_kbd_exception is now considered the standard variable name to hold the
singleton KeyboardInterrupt exception.

This patch also moves the creation of this object from pyb_usb_init() to
main().
2016-12-15 12:32:00 +11:00
Damien George 29b5879613 tools/pyboard.py: Refactor so target is not reset between scripts/cmd.
Previous to this patch pyboard.py would open a new serial connection to
the target for each script that was run, and for any command that was run.
Apart from being inefficient, this meant that the board was soft-reset
between scripts/commands, which precludes scripts from accessing variables
set in a previous one.

This patch changes the behaviour of pyboard.py so that the connection to
the target is created only once, and it's not reset between scripts or any
command that is sent with the -c option.
2016-12-15 11:29:33 +11:00
Damien George 1b02565316 stmhal/mpconfigport: Add weak-module links for io, collections, random. 2016-12-15 11:23:20 +11:00
Damien George 7081ea4119 tests/micropython: Get heapalloc_traceback test running on baremetal.
When printing exceptions from files sent to a target by pyboard.py the
filename in the exception is <stdin>, which differs to when running the
script on the PC.  So we strip out the filename to make the outputs the
same on all targets (see also misc/print_exception.py test).
2016-12-15 11:11:57 +11:00
Lorenz Schmid a5b3c7e7f9 docs/library/pyb.UART: Moved writechar doc to sit with other writes. 2016-12-15 09:59:45 +11:00
Lorenz Schmid 0caac94b98 docs/library/pyb.UART: Added clarification about timeouts. 2016-12-15 09:59:32 +11:00
Paul Sokolovsky c16e7eae5e zephyr: Implement soft reset feature. 2016-12-15 01:10:08 +03:00
Paul Sokolovsky 95fe7a40b3 zephyr: Support raw REPL. 2016-12-15 00:58:08 +03:00
Paul Sokolovsky 403c93053e py/mpconfig.h: Enable MICROPY_PY_SYS_EXIT by default.
sys.exit() is an important function to terminate a program. In particular,
the testsuite relies on it to skip tests (i.e. any other functionality may
be disabled, but sys.exit() is required to at least report that properly).
2016-12-14 21:22:05 +03:00
Paul Sokolovsky ee7ad7e8be esp8266: Add "ota" target to produce firmware binary for use with yaota8266.
https://github.com/pfalcon/yaota8266 is a (WIP) OTA-enabled bootloader
which doesn't require reserving space 2x size of a firmware.
2016-12-14 17:44:05 +03:00
Scott Shawcroft af17b64a58 atmel-samd: Add samd module for atmel-samd specific configuration.
Fixes #49
2016-12-13 18:04:50 -08:00
Damien George e8f2db7da3 py/runtime: Zero out fs_user_mount array in mp_init.
There's no need to force ports to copy-and-paste this initialisation
code.  If FSUSERMOUNT is enabled then this zeroing out must be done.
2016-12-14 11:40:11 +11:00
Scott Shawcroft 78a807cc26 atmel-samd: Commit QTouch library. Missed because .a files are usually ignored. 2016-12-13 16:11:19 -08:00
Scott Shawcroft 18c1210e87 atmel-samd: Remove debug output. 2016-12-13 16:10:42 -08:00
Scott Shawcroft 781633c716 Fix up Analog classes: unify them at 16 bits and adds reference_voltage member
to make for easy conversion. Fixes #14.
2016-12-13 16:09:00 -08:00
Damien George e83f140463 py/mpz: Remove unreachable code in mpn_or_neg functions. 2016-12-14 10:39:41 +11:00
Rami Ali 9112b0b62b tests/extmod: Improve modframebuf test coverage. 2016-12-13 16:29:21 +11:00
Damien George 0f408bc1ff stmhal: Move PY_SYS_PLATFORM config from board to general config file.
It can be overridden by a board if needed.
2016-12-13 16:26:45 +11:00
Rami Ali 8001918a89 stmhal: Add STM32F769DISC board files.
With minor changes to adc.c and storage.c to support the F769.
2016-12-13 16:26:13 +11:00
Rami Ali 3dd04dee3e stmhal/cmsis: Add CMSIS file stm32f769xx.h, V1.1.2. 2016-12-13 16:25:56 +11:00
Rami Ali e9fbc555fc stmhal: Add NUCLEO_F767ZI board, with openocd config for stm32f7. 2016-12-13 16:25:31 +11:00
Rami Ali 517f347f6f stmhal/cmsis: Add CMSIS file stm32f767xx.h, V1.1.2. 2016-12-13 16:24:24 +11:00
Damien George d9047d3c8a py/builtinimport: Support importing packages from compiled .mpy files.
This patch ensures that __init__.mpy files are imported if their
containing directory is imported as a package.
2016-12-13 15:09:48 +11:00
Scott Shawcroft 9ad0da6134 esp8266: Fix pyexec calls. 2016-12-12 17:11:07 -08:00
Scott Shawcroft 52f8e1cbf3 atmel-samd: Use bootloader again on the Metro M0 2016-12-12 17:09:42 -08:00
Scott Shawcroft 3972bc19c7 atmel-samd: Basic capacitive touch button support.
Currently only works on a single channel and is only enabled for boards with
SPI flash. Only really designed for hardware testing at this point.
2016-12-12 15:11:25 -08:00
Rami Ali d22762017e tests/extmod: Improve moductypes test coverage. 2016-12-12 17:09:14 +11:00
Damien George a3c61004c2 py/binary: Do zero extension when storing a value larger than word size. 2016-12-12 15:00:06 +11:00
Scott Shawcroft cd09726904 Fix pyexec_file calls. 2016-12-09 22:49:44 -08:00
Scott Shawcroft b6f1eebab3 atmel-samd: Add APA102 support and flash more advanced status.
The new sequence is as follows:
* Solid blue during the boot/settings script.
* Solid green during the main/code script.
* After main while waiting to enter repl or reset:
  * Fading green once main is done successfully.
  * On error produce a series of flashes:
    * Long flash color of script.
    * Long flash color of error:
      * Green = IndentationError
      * Cyan = SyntaxError
      * White = NameError
      * Orange = OSError
      * Yellow = Other error
    * Line number of the exception by digit. Number of flashes represents value.
      * Thousands = White
      * Hundreds = Blue
      * Tens = Yellow
      * Ones = Cyan
    * Off for a period and then repeats.

At any point a write to the flash storage will flicker red.

Fixes #63
2016-12-09 19:35:56 -08:00
Paul Sokolovsky aee13ef3f2 tests: Update for required byteorder arg for int.from_bytes()/to_bytes(). 2016-12-09 22:53:30 +03:00
Paul Sokolovsky 9d787de2a1 py/objint: from_bytes, to_bytes: Require byteorder arg, require "little".
CPython requires byteorder arg, make uPy compatible. As we support only
"little", error out on anything else.
2016-12-09 21:15:16 +03:00