Wykres commitów

4091 Commity (master)

Autor SHA1 Wiadomość Data
Peter D. Gray 1ed2c23efb stm32/modmachine: Handle case of no MICROPY_PY_MACHINE_I2C. 2018-01-31 15:59:04 +11:00
stijn b184b6ae53 py/nlr: Fix nlr functions for 64bit ports built with gcc on Windows
The number of registers used should be 10, not 12, to match the assembly
code in nlrx64.c. With this change the 64bit mingw builds don't need to
use the setjmp implementation, and this fixes miscellaneous crashes and
assertion failures as reported in #1751 for instance.

To avoid mistakes in the future where something gcc-related for Windows
only gets fixed for one particular compiler/environment combination,
make use of a MICROPY_NLR_OS_WINDOWS macro.

To make sure everything nlr-related is now ok when built with gcc this
has been verified with:
- unix port built with gcc on Cygwin (i686-pc-cygwin-gcc and
  x86_64-pc-cygwin-gcc, version 6.4.0)
- windows port built with mingw-w64's gcc from Cygwin
 (i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc, version 6.4.0)
 and MSYS2 (like the ones on Cygwin but version 7.2.0)
2017-12-29 22:24:46 +11:00
stijn 8041de59fe windows/mpconfigport: Enable some features, including the Python stack
Add some features which are already enabled in the unix port and
default to using the Python stack for scoped allocations: this can be
more performant in cases the heap is heavily used because for example
the memory needed for storing *args and **kwargs doesn't require
scanning the heap to find a free block.
2017-12-29 22:14:16 +11:00
stijn 6fc58db5d8 windows/mpconfigport: Provide off_t definition for MSVC port
For MSVC off_t is defined in sys/types.h but according to the comment
earlier in mpconfigport.h this cannot be included directly.
So just make off_t the same as mp_off_t.
This fixes the build for MSVC with MICROPY_STREAMS_POSIX_API
enabled because stream.h uses off_t.
2017-12-29 22:14:16 +11:00
Peter D. Gray dfe8980acf stm32/spi: If MICROPY_HW_SPIn_MISO undefined, do not claim pin on init.
This permits output-only SPI use.
2017-12-28 18:00:20 +11:00
Paul Sokolovsky 7a9a73ee84 zephyr/main: Remove unused do_str() function.
The artifact of initial porting effort.
2017-12-26 20:16:08 +02:00
Paul Sokolovsky d9977a8ad9 zephyr/Makefile: clean: Clean libmicropython.a too. 2017-12-26 14:46:16 +02:00
Damien George b806889512 stm32/i2c: Support more I2C baudrates for F746, and more F7 MCUs. 2017-12-23 19:24:24 +11:00
Damien George 008e1788e8 stm32/i2c: Fix bug with I2C4 initialisation. 2017-12-23 19:22:52 +11:00
Damien George d32417c096 stm32/uart: Support board configs with CTS/RTS on UART6. 2017-12-23 19:03:16 +11:00
Damien George 9bcdb0acd1 esp8266/Makefile: Remove commented-out unused lines.
These were copied from the stm32 port (then stmhal) at the very beginning
of this port, with the anticipation that the esp8266 port would have board
definition files with a list of valid pins and their names.  But that has
not been implemented and likely won't be, so remove the corresponding lines
from the Makefile.
2017-12-22 17:16:42 +11:00
Ayke van Laethem f16c775a07 esp32/README: Update toolchain setup. 2017-12-22 16:27:24 +11:00
Peter D. Gray 7a46d9ae73 stm32/uart: Add support for 7-bit modes: 7N1 and 7N2. 2017-12-22 15:37:17 +11:00
Damien George c73360bfdb stm32: Allow to build a board without any hardware I2C ports defined.
This patch adds in internal config value MICROPY_HW_ENABLE_HW_I2C that is
automatically configured, and enabled only if one or more hardware I2C
ports are defined in the mpconfigboard.h file.  If none are defined then
the pyb.I2C class is excluded from the build, along with all supporting
code.  The machine.I2C class will still be available for software I2C.

Disabling all hardware I2C on an F4 board saves around 10,000 bytes of code
and 200 bytes of RAM.
2017-12-22 15:20:42 +11:00
Peter D. Gray 82dc5c1d8c stm32: Use corrected capitalization of HAL_SD_CardStateTypedef.
It was originally TypeDef.  STM32L4 only supports Typedef and F4/F7 have
legacy macros in stm32_hal_legacy.h to support both.
2017-12-22 14:49:31 +11:00
Damien George d7a52e1539 qemu-arm/test_main: Include setjmp.h because it's used by gc_collect.
And it's no longer unconditionally included by nlr.h, only if NLR_SETJMP
is defined.
2017-12-20 15:42:06 +11:00
Damien George d8d633f156 unix/mpconfigport_coverage.h: Enable MICROPY_PY_IO_RESOURCE_STREAM.
Where possible it's important to test all code in the code base.
2017-12-19 17:04:55 +11:00
Damien George e800e4463d tests/unix: Add test for printf with %lx format. 2017-12-19 15:01:17 +11:00
Damien George d1fd889ad0 esp32/machine_hw_spi: Remove unnecessary white space for consistency. 2017-12-18 15:46:08 +11:00
Eric Poulsen 9123c8d946 esp32/machine_hw_spi: Fix large HW SPI transfers by splitting them up.
Breaks up HW SPI transfers into maximum chunks of 32736 bits (4092 bytes),
because this is the maximum that the underlying ESP IDF will accept.
2017-12-18 15:44:35 +11:00
Paul Sokolovsky ea742085ed unix/mpconfigport.h: Allow to override stackless options from commandline. 2017-12-16 20:43:04 +02:00
Paul Sokolovsky 7f9a62408d unix/Makefile: coverage: Allow user to pass CFLAGS_EXTRA.
This build sets CFLAGS_EXTRA itself, but preserve user's value as passed
on make command line/etc.
2017-12-16 20:23:12 +02:00
Paul Sokolovsky dd35fe7ca0 zephyr/prj_base.conf: Bump MAIN_STACK_SIZE to let builtin testsuite run. 2017-12-15 18:17:00 +02:00
Paul Sokolovsky 6b19520a74 zephyr: Add support for binary with builtin testsuite.
If TEST is defined, file it refers to will be used as the testsuite
source (should be generated with tools/tinytest-codegen.py).

"make-bin-testsuite" script is introduce to build such a binary.
2017-12-15 12:10:39 +02:00
Damien George badaf3ecfe esp8266/machine_hspi: After an SPI write wait for last byte to transfer.
Because otherwise the function can return with data still waiting to be
clocked out, and CS might then be disabled before the SPI transaction is
complete.  Fixes issue #3487.
2017-12-14 10:43:18 +11:00
Damien George 3f6d3ccc11 stm32/usbdev: Pass thru correct val for SCSI PreventAllowMediumRemoval.
This value is "1" when the medium should not be removed, "0" otherwise.
2017-12-13 18:33:39 +11:00
Paul Sokolovsky ea6bddbf81 ports/qemu-arm: Rework "test" target using upytesthelper.
The way tinytest was used in qemu-arm test target is that it didn't test
much. MicroPython tests are based on matching the test output against
reference output, but qemu-arm's implementation didn't do that, it
effectively tested just that there was no exception during test
execution. "upytesthelper" wrapper was introduce to fix it, so switch
test implementation to use it.

This requires passing different CFLAGS when building the firmware, so
split out test-related parts to Makefile.test.
2017-12-13 09:07:51 +02:00
Eric Poulsen 19c7098e18 esp32: Add custom partitions.csv file with uPy specific size. 2017-12-13 15:51:04 +11:00
Damien George 0593d6f562 esp32/Makefile: Support using IDF_PATH as the env var to the IDF source. 2017-12-13 14:56:28 +11:00
Alex King 78302f7bb2 esp32/modesp: Add osdebug() function to disable or change IDF logging.
Code lineage:
osdebug() is based loosely on the version in esp8266, but there didn't
seem to be an obvious way of choosing a particular UART. The basic
behavior is the same, though: provide None, and logging is disabled;
provide an integer and logging is restored to the default level.

To build on that, and because the IDF provides more functionality, a
second parameter has now been implemented which allows the active log
level to be set:

   esp.osdebug(uart[, level])

The module has a corresponding set of LOG_ values to set this accordingly.
2017-12-13 14:48:53 +11:00
Damien George 9acd590675 esp32/mpconfigport.h: Enable websocket module. 2017-12-13 14:48:53 +11:00
Eric Poulsen 29dd6a7678 esp32: Implement wired Ethernet via network.LAN().
Updates to Makefile, modnetwork.c, and addition of network_lan.c to
implement `network.LAN()` object for wired PHY objects.
2017-12-13 14:48:53 +11:00
Damien George 1c52d3e8c6 esp32/mpconfigport.h: Enable ussl finaliser. 2017-12-13 14:48:53 +11:00
Eric Poulsen b0853b5a39 esp32/modnetwork.c: Fix for setting DNS with network.WLAN.ifconfig().
When configuring a static set of values with ifconfig() the DNS was not
being set.  This patch fixes that, and additionally uses the tcpip_adapter
API to ensure it is thread safe.

Further discussion is here:
https://github.com/micropython/micropython-esp32/issues/210/
2017-12-13 14:48:53 +11:00
Damien George 934abc9b9d esp32/modules: Symlink in ntptime.py from esp8266/modules. 2017-12-13 14:48:53 +11:00
Damien George 48613b6011 esp32: Update to latest ESP IDF.
This update requires the xtensa-esp32-elf to be upgraded to the latest
version, 1.22.0-73-ge28a011-5.2.0.
2017-12-13 14:48:53 +11:00
Damien George a5808e2fca esp32/machine_pwm: Always set the channel in the PWM object. 2017-12-13 14:48:53 +11:00
Nick Moore f0628f5499 esp32/modutime.c: Add localtime and mktime functions. 2017-12-13 14:48:53 +11:00
Damien George ba2d960276 esp32/README: Update general description of port to add avail features. 2017-12-13 14:48:53 +11:00
Eric Poulsen 31747fe266 esp32: Implement machine.WDT() class. 2017-12-13 14:48:53 +11:00
Nick Moore 5f8ad6072f esp32: Call initialization function on sha1 and sha256.
Add in calls to mbedtls_sha1_starts() and mbedtls_sha256_starts().
2017-12-13 14:48:53 +11:00
Eric Poulsen 5adc133f05 esp32/mphalport.h: Make mp_hal_pin_<dir> select gpio on the pad.
Otherwise interfaces like software I2C and SPI don't initialise correctly.
2017-12-13 14:48:53 +11:00
Nick Moore b74809c70a esp32/mpconfigport.h: Add missing uhashlib. 2017-12-13 14:48:53 +11:00
Timmenem 6cc716c4aa esp32/modsocket: Implement setsockopt(IP_ADD_MEMBERSHIP).
Allows to join multicast groups.
2017-12-13 14:48:53 +11:00
Damien George bfc9845d00 esp32/modnetwork: Give better error msgs for AP timeout and not-found. 2017-12-13 14:48:53 +11:00
Damien George bc08c884a2 esp32: Add new port to Espressif ESP32 SoC.
This commit is a combination of 216 commits from the initial stages of
development of this port, up to and including the point where the code was
moved to the ports/esp32 directory.  These commits were mostly concerned
with setting up the build system and getting a reliable port working with
basic features.  The following is a digest of the original commits in their
original order (most recent listed first), grouped where possible per
author.  The list is here to give credit for the work and provide some
level of traceability and accountability.  For the full history of
development please consult the original repository.

All code is MIT licensed and the relevant copyright holders are listed in
the comment-header of each file.

Damien George <damien.p.george@gmail.com>
  esp32: Update to latest ESP IDF.
  esp32: Update module symlinks now that code lives under the ports dir.
  esp32: Update to compile with new ports/esp32 directory structure.
  esp32: Move it to the ports/ directory.
  esp32/machine_uart: Don't save baudrate but compute it instead.
  esp32/modsocket: Add socket.readinto() method.
  esp32/modesp: Add esp.gpio_matrix_in and esp.gpio_matrix_out functions.
  esp32/machine_uart: Wait for all data to be tx'd before changing config.

NyxCode <moritz.bischof1@gmail.com>
  esp32: Add note to README.md about updating the submodules of ESP IDF.

Anthony Briggs <anthony.briggs@gmail.com>
  esp32: Update README.md installation and flashing instructions.

Javier Candeira <javier@candeira.com>
  esp32: Raise error when setting input-only pin to output.

  With help from Adrian Smith (fon@thefon.net)

Javier Candeira <javier@candeira.com>
  esp32: Replace exception raising with corresponding mp_raise_XXX funcs.

Tisham Dhar <whatnickd@gmail.com>
  esp32: Add some specific notes about building on Windows using WSL.

Ben Gamari <ben@smart-cactus.org>
  esp32: Provide machine.Signal class.

Damien George <damien.p.george@gmail.com>
  esp32/modnetwork: Implement AP version of network.isconnected().

Eric Poulsen <eric@zyxod.com>
  esp32/README.md: Add note about btree submodule initialization.

Damien George <damien.p.george@gmail.com>
  esp32: Make firmware.bin start at 0x1000 to allow flash size autodetect.
  esp32: Changes to follow latest version of upstream uPy.
  esp32/Makefile: Separate ESP-specific inc dirs to avoid header clashes.
  esp32: Enable "btree" database module.
  esp32: Update to latest ESP IDF.

Roosted7 <thomasroos@live.nl>
  esp32: Update to latest ESP-IDF.

Alex King <alex_w_king@yahoo.com>
  esp32/machine_timer: Add support for esp32 hardware timer.

  Code lineage:
  Timer() is based loosely on the version in esp8266, although the
  implementation is differs significantly because of the change in
  the underlying platform.

Damien George <damien.p.george@gmail.com>
  esp32/machine_uart: Increase UART TX buffer size to 64.
  esp32/modules: Update dht symlink.
  esp32/mpconfigport.h: Enable utimeq module, needed for uasyncio.
  esp32: Changes to follow latest version of upstream uPy.
  esp32: Update to latest ESP-IDF.
  esp32/machine_uart: Add uart.any() method.
  esp32/machine_uart: Uninstall the UART driver before installing it.

Thomas Roos <mail@thomasroos.nl>
  esp32: Update to latest ESP-IDF.

Eric Poulsen <eric@zyxod.com>
  esp32/modsocket: Make read/write return None when in non-blocking mode.
  esp32/modsocket.c: Fix send/sendto/write for non-blocking sockets.

Odd Stråbø <oddstr13@openshell.no>
  esp32: Initial working implementation of machine.UART.

  Code lineage (as seen by previous commits): I copied the ESP8266 code,
  renamed pyb -> machine, and used esp-idf as a reference while implementing
  minimal functionality.  I provide all of my changes under the MIT license.

Odd Stråbø <oddstr13@openshell.no>
  esp32/machine_uart: Rename pyb to machine.
  esp32: Copy machine_uart.c from esp8266 port.

Damien George <damien.p.george@gmail.com>
  esp32/moduos: Add uos.ilistdir() function.
  esp32: Mount filesystem at the root of the VFS, following esp8266.

Andy Valencia <vandyswa@gmail.com>
  esp32: Add hardware SHA1/SHA256 support via mbedtls API.

  Code lineage: a copy of extmod/moduhashlib with the API invocation details
  edited.  Total derivative work.

Andy Valencia <vandyswa@gmail.com>
  esp32: Add PWM support via machine.PWM class.

  Code lineage:
  I started by copying the esp8266 machine_pwm.c. I used information from the
  ESP32 Technical Reference Manual, the esp-idf documentation, and the SDK's
  sample ledc example code (but I did not copy that code, just studied it to
  understand the SDK's API for PWM). So aside from the code copied from the
  esp8266 PWM support, everything else you see is just new code I wrote.

  I wasn't an employee of anybody when I wrote it, and I wrote it with the
  understanding and intention that it's simply a derivative work of the
  existing micropython code. I freely and willingly contribute it to the
  project and intend that it not change the legal status of the micropython
  code base in any way, even if it is included in that base in whole or part.

Damien George <damien.p.george@gmail.com>
  esp32/modules: Add symlinks for upysh and upip.

Eric Poulsen <eric@zyxod.com>
  esp32/modmachine: Add unique_id() function to machine module.

Damien George <damien.p.george@gmail.com>
  esp32: Change dac_out_voltage to dac_output_voltage for new IDF API.
  esp32: Update esp32.custom_common.ld to align with changes in ESP IDF.

Eric Poulsen <eric@zyxod.com>
  esp32: Update to latest ESP IDF.

Damien George <damien.p.george@gmail.com>
  esp32/modsocket: When resolving IP addr handle the case of host=''.
  esp32: Update to latest ESP IDF.

Eric Poulsen <eric@zyxod.com>
  esp32/Makefile: Change default FLASH_MODE to dio for WROOM-32 module.
  esp32: Move FAT FS to start at 0x200000 and increase size to 2MiB.

Damien George <damien.p.george@gmail.com>
  esp32: Remove enable_irq/disable_irq and use ATOMIC_SECTION instead.
  esp32/mpconfigport.h: Provide ATOMIC_SECTION macros.
  esp32/main: Restart the MCU if there is a failed NLR jump.

Daniel Campora <daniel@pycom.io>
  esp32: Enable threading; be sure to exit GIL when a thread will block.
  esp32: Trace the registers when doing a gc collect. Also make it thread ready.
  esp32: Add threading implementation, disabled for the time being.

Damien George <damien.p.george@gmail.com>
  esp32: Update to latest ESP IDF.
  esp32/uart: Use high-level function to install UART0 RX ISR handler.
  esp32/Makefile: Make FreeRTOS private include dir really private.

Eric Poulsen <eric@zyxod.com>
  esp32: Add support for hardware SPI peripheral (block 1 and 2).

Sergio Conde Gómez <skgsergio@gmail.com>
  esp32/modules/inisetup.py: Mount filesystem at /flash like ESP8266

Damien George <damien.p.george@gmail.com>
  esp32: Convert to use core-provided KeyboardInterrupt exception.
  esp32: Pump the event loop while waiting for rx-chr or delay_ms.
  esp32: Implement Pin.irq() using "soft" scheduled interrupts.
  esp32: Update to latest ESP IDF version.

Eric Poulsen <eric@zyxod.com>
  esp32/README: Add troubleshooting section to the end.

tyggerjai <tyggerjai@gmail.com>
  esp32: Add support for WS2812 and APA106 RGB LEDs.

Damien George <damien.p.george@gmail.com>
  esp32: Add makeimg.py script to build full firmware; use it in Makefile.
  esp32/modsocket: Make socket.read return when socket closes.
  esp32/modsocket: Initialise the timeout on an accepted socket.
  esp32/mphalport: Provide proper implementations of disable_/enable_irq.
  esp32/modmachine: Add disable_irq/enable_irq functions.

Nick Moore <nick@zoic.org>
  esp32/modsocket.c: add comment explaining timeout behaviour
  esp32/modsocket.c: clean up send methods for retries too
  esp32/modsocket.c: sockets always nonblocking, accept timeout in modsocket
  esp32: Update to latest ESP IDF version.
  esp32/modsocket.c: remove MSG_PEEK workaround on select ioctl.
  esp32/modsocket.c: Initialize tcp when modsocket loads.

Damien George <damien.p.george@gmail.com>
  esp32/main: Bump heap size from 64k to 96k.
  esp32/modutime: Add time.time() function.
  esp32/modsocket: Convert lwip errnos to uPy ones.
  esp32/modules: Provide symlink to ds18x20 module.
  esp32: Add support for onewire protocol via OneWire module.
  esp32: Add support for DHT11 and DHT22 sensors.
  esp32/mphalport: Improve delay and ticks functions.
  esp32: Update to latest ESP IDF.
  esp32/modules: Provide symlink to urequests from micropython-lib.
  esp32: Populate sys.path.

Nick Moore <nick@zoic.org>
  esp32/machine_dac.c: implement DAC pins as well
  esp32/machine_adc.c: also machine.ADC
  esp32/machine_touchpad.c: add support for touchpad

Damien George <damien.p.george@gmail.com>
  esp32/README: Add hint about using GNUmakefile on case-insensitive FS.
  esp32/mpconfigport.h: Enable maximum speed software SPI.
  esp32: Provide improved version of mp_hal_delay_us_fast.
  esp32/mpconfigport.h: Enable MICROPY_PY_BUILTINS_POW3 option.
  esp32: Update to latest ESP IDF.
  esp32: Convert to use new oofatfs library and generic VFS sub-system.
  esp32: Enable help('modules') to list builtin modules.
  esp32: Convert to use new builtin help function.

Aaron Kelly <AaronKelly@email.com>
  esp32/README: Add comment about ESP-IDF version

Damien George <damien.p.george@gmail.com>
  esp32: Consistently use size_t instead of mp_uint_t.
  esp32: Change "Micro Python" to "MicroPython" in license comments.
  esp32/Makefile: Use -C argument to git instead of cd'ing.
  esp32/help: Add section to help about using the network module.
  esp32/README: Add section about configuring and using an ESP32 board.
  esp32/README: Remove paragraph about buggy toolchain, it's now fixed.
  esp32/modnetwork: Change network init logging from info to debug.
  esp32/modnetwork: Don't start AP automatically when init'ing wifi.
  esp32/modsocket: Implement socket.setsockopt, to support SO_REUSEADDR.
  esp32: Update to latest ESP IDF.
  esp32/sdkconfig.h: Remove unused CONFIG_ESPTOOLPY_xxx config settings.
  esp32/modsocket: Add support for DGRAM and RAW, and sendto/recvfrom.
  esp32/modsocket: Fix return value of "port" in socket.accept.
  esp32/modsocket: Make socket.recv take exactly 2 args.
  esp32: Enable ussl module, using mbedtls component from ESP IDF.
  esp32/modsocket: Rename "socket" module to "usocket".
  esp32/sdkconfig: Increase max number of open sockets from 4 to 8.
  esp32/modsocket: Add error checking for creating and closing sockets.
  esp32/modsocket: Use _r (re-entrant) versions of LWIP socket API funcs.
  esp32/modsocket: Raise an exception if socket.connect did not succeed.
  esp32/modsocket: Make socket.accept return a tuple: (client, addr).
  esp32/modsocket: Use m_new_obj_with_finaliser instead of calloc.
  esp32/Makefile: Add check for IDF version, and warn if not supported.
  esp32/esp32.custom_common.ld: Update to follow changes in IDF.
  esp32: Update to latest ESP IDF.

nubcore <x@nubcore.com>
  esp32: add #define CONFIG_ESP32_WIFI_RX_BUFFER_NUM 25

Nick Moore <nick@zoic.org>
  esp32/modsocket.c: add in sendall and makefile methods #10
  esp32/modsocket.c: fixups for #10
  esp32/modsocket.c: fix copyright, socket_recv gets param and exception
  esp32/modnetwork.c: fix copyright, network.active param to bool

Damien George <damien.p.george@gmail.com>
  esp32/modnetwork: Implement wlan.isconnected() method.
  esp32/modnetwork: Add initial implementation of wlan.config().
  esp32/modnetwork: Simplify event_handler messages.

Nick Moore <nick@zoic.org>
  esp32/modsocket.c: support for ioctl, settimeout, setblocking, getaddrinfo

Damien George <damien.p.george@gmail.com>
  esp32/README: Add comment about FLASH_MODE being dio.
  esp32: Update to latest ESP IDF.
  esp32/modnetwork: Remove unnecessary indirection variable for scan list.
  esp32/modnetwork: Check that STA is active before trying to scan.
  esp32/mphalport: Replace portTICK_RATE_MS with portTICK_PERIOD_MS.
  esp32/README: Add comment about using $(HOME) in makefile.
  esp32/modnetwork: Use memset instead of bzero, the latter is deprecated.
  esp32/modnetwork: Improve error handling when STA is connecting to AP.
  esp32/Makefile: Use tab instead of spaces, and use shorter variable.

Nick Moore <nick@zoic.org>
  esp32/modsocket.c: AF_*, SOCK_* and IPPROTO_* constants
  esp32/modsocket.c: socket.settimeout implementation

Damien George <damien.p.george@gmail.com>
  esp32/Makefile: Update to latest ESP IDF.

Nick Moore <nick@zoic.org>
  esp32/modsocket.c: use mp streams for sockets
  esp32: network.WLAN.ifconfig based on esp8266 version
  esp32: Fix up exception handling
  esp32: sketchy modsocket ... revisit this once modnetwork is sorted
  esp32: First cut at modnetwork, manually rebased from prev. version

Damien George <damien.p.george@gmail.com>
  esp32/help: Update help text.
  esp32: Add info about Microbric Pty Ltd being the sponsor of this port.
  esp32: Add README.md file.
  esp32/mpconfigport.h: Add weak links to many of the builtin modules.
  esp32: Enable soft implementation of machine.SPI class.
  esp32/Makefile: Simplify APP_LD_ARGS by using OBJ variable.
  esp32/Makefile: Reorganise Makefile and add some comments.
  esp32/Makefile: Clean up CFLAGS for ESP IDF components.
  esp32/Makefile: Tidy up names of ESP IDF components, to match dir name.
  esp32/Makefile: Define and use ESPCOMP variable.
  esp32: Update to latest ESP IDF.
  esp32/main: Enable filesystem support.
  esp32: Use custom ld script to ensure correct code get placed in iram.
  esp32: Update to latest ESP IDF.
  esp32/main: Pin the uPy task to core 0.
  esp32: Update to use latest ESP IDF.
  esp32: Disable boot-up scripts, spi_flash_erase_sector no longer works.
  esp32: Add scripts to init and mount filesystem.
  esp32: Enable frozen bytecode, with scripts stored in "modules/" dir.
  esp32/modesp: Increase flash_user_start position to 1Mbyte.
  esp32/Makefile: Add "erase" target for convenient erasure.
  esp32/sdkconfig: Reorder config settings to put common things together.
  esp32/sdkconfig: Change to use single core only.
  esp32: Add esp module.
  esp32/uart.c: Make sure uart ISR handler is all in iram.
  esp32/main.c: Use ESP_TASK_PRIO_MIN + 1 for mp_task's priority.
  esp32/Makefile: Use only bare-minimum flags when compiling .S files.
  esp32/Makefile: Rename "firmware" to "application".
  esp32: Update ESP IDF version.
  esp32/Makefile: Add declarations to build bootloader and partitions.
  esp32/Makefile: When deploying, write the application last.
  esp32/Makefile: Use $(INC) variable instead of listing include dirs.
  esp32/Makefile: Use locally built versions of freertos and newlib libs.
  esp32: Add low-level uart handler with ISR and ringbuf for stdin.
  esp32: Add machine.idle() function.
  esp32: Add machine.I2C class.
  esp32: Enable machine.time_pulse_us.
  esp32: Add initial implementation of machine.Pin class.
  esp32: Prepare main.c for using xTaskCreateStatic.
  esp32: Clean up mphalport.h.
  esp32: Add initial uos module.
  esp32: Clean up mpconfigport.h, enable more features.
  esp32: Use new reset function.
  esp32: Update to latest ESP IDF.
  esp32: Add idf-version target to Makefile, to track IDF commit.
  esp32: Initial port to ESP32.
2017-12-13 14:48:53 +11:00
Damien George 971699abe7 stm32: Add support for using the Python stack. 2017-12-11 13:49:09 +11:00
Damien George 357486d9b4 unix: Add support for using the Python stack. 2017-12-11 13:49:09 +11:00
Paul Sokolovsky e7fc765880 unix/mpconfigport: Disable uio.resource_stream().
This function was implemented as an experiment, and was enabled only in
unix port. To remind, it allows to access arbitrary files frozen as
source modules (vs bytecode).

However, further experimentation showed that the same functionality can
be implemented with frozen bytecode. The process requires more steps, but
with suitable toolset it doesn't matter patch. This process is:

1. Convert binary files into "Python resource module" with
tools/mpy_bin2res.py.
2. Freeze as the bytecode.
3. Use micropython-lib's pkg_resources.resource_stream() to access it.

In other words, the extra step is using tools/mpy_bin2res.py (because
there would be wrapper for uio.resource_stream() anyway).

Going frozen bytecode route allows more flexibility, and same/additional
efficiency:

1. Frozen source support can be disabled altogether for additional code
savings.
2. Resources could be also accessed as a buffer, not just as a stream.

There're few caveats too:

1. It wasn't actually profiled the overhead of storing a resource in
"Python resource module" vs storing it directly, but it's assumed that
overhead is small.
2. The "efficiency" claim above applies to the case when resource
file is frozen as the bytecode. If it's not, it actually will take a
lot of RAM on loading. But in this case, the resource file should not
be used (i.e. generated) in the first place, and micropython-lib's
pkg_resources.resource_stream() implementation has the appropriate
fallback to read the raw files instead. This still poses some distribution
issues, e.g. to deployable to baremetal ports (which almost certainly
would require freezeing as the bytecode), a distribution package should
include the resource module. But for non-freezing deployment, presense
of resource module will lead to memory inefficiency.

All the discussion above reminds why uio.resource_stream() was implemented
in the first place - to address some of the issues above. However, since
then, frozen bytecode approach seems to prevail, so, while there're still
some issues to address with it, this change is being made.

This change saves 488 bytes for the unix x86_64 port.
2017-12-10 02:38:23 +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
Paul Sokolovsky 24c641c4e3 qemu-arm/test_main: Clean up invocation of tinytest_main().
Command-line argc and argv should be passed, and as we don't have them,
placeholders were passed, but incorrectly. As we don't have them, just
pass 0/NULL. Looking at the source, this migh lead to problems under
Windows, but this test doesn't run under Windows.

Also, use "%d" printf format consistently with the rest of the codebase.
2017-12-08 19:15:45 +02:00
Paul Sokolovsky 55d33d5897 zephyr/main: Move var declarations to the top of file. 2017-12-08 12:39:57 +02:00
Paul Sokolovsky ada1dc1c03 zephyr/CMakeLists.txt: Properly separate CFLAGS parts gotten from CMake.
Lack of spaces between them led to weird option artifacts like -Ifoo-Dbar.
2017-12-06 16:45:27 +02:00
Paul Sokolovsky ccec4ee7ad zephyr/CMakeLists.txt: Update for latest Zephyr buildsys changes. 2017-12-06 15:31:07 +02:00
Paul Sokolovsky 3a431fba50 esp8266/modnetwork: Make sure to intern string passed to .config("param").
This is the proper fix for
https://github.com/micropython/micropython/issues/3442.
2017-12-04 00:13:10 +02:00
Paul Sokolovsky bb047558da zephyr/Makefile: syscall_macros.h generation was moved from CMake to make.
Required for #include <zephyr.h> to work.
2017-12-01 13:45:03 +02:00
Damien George 6515acca70 stm32/boards/*_af.csv: Make consistent use of JTMS, JTCK, SWDIO, SWCLK.
5-pin JTAG and 2-pin SWD are logically separate interfaces so encode them
in the AF tables as separate entries (separated by /, not -).
2017-12-01 14:51:36 +11:00
Damien George 8f20231909 stm32/boards/stm32f767_af.csv: Update AF table based on datasheet.
Based on ST datasheet, DocID029041 Rev 3, DM00273119.pdf.
2017-12-01 14:48:17 +11:00
Damien George 4e056d82cc esp8266/modules/webrepl_setup: Fix first-time enable of WebREPL.
Prior to this fix, enabling WebREPL for the first time via webrepl_setup
did not work at all because "boot.py" did not contain any lines with
"webrepl" in them that could be uncommented.
2017-11-30 10:54:33 +11:00
Paul Sokolovsky b369c1bb96 zephyr/Makefile: Make prj_$(BOARD).conf optional, again.
This time hopefully should work reliably, using make $(wildcard) function,
which in this case either expands to existing prj_$(BOARD).conf file, or to
an empty string for non-existing one.
2017-11-28 18:19:48 +02:00
Paul Sokolovsky a036554a77 zephyr/Makefile: Convert to new CMake-based Zephyr build system.
Zephyr 1.10 switches to CMake-based build system (already in master).
2017-11-28 16:37:51 +02:00
Paul Sokolovsky 25b7c7d7c6 zephyr/prj_base.conf: Force zephyr.bin build output.
As useful for CI systems. 1.10 doesn't build .bin for qemu_* for example.

Also, remove deprecated CONFIG_LEGACY_KERNEL option.
2017-11-28 14:11:46 +02:00
Paul Sokolovsky 53e06e05c9 zephyr/Makefile: clean: Remove generated prj_*_merged.conf. 2017-11-28 13:37:26 +02:00
Damien George 811ddcc65f stm32/led: Remove unused LED enum constants. 2017-11-20 15:28:04 +11:00
Damien George 6906255dcd stm32/boards: Remove obsolete and unused board-specific defines.
These board-level macros have been completely replaced by feature-level
config options.
2017-11-20 15:25:28 +11:00
Jaroslav Sykora 3e9e9b07ba stm32/boards: Add support for NUCLEO-F746ZG evaluation board.
This is a low-cost evaluation kit board from ST based on the STM32
Nucleo-144 form factor.  It uses the STM32F746ZG MCU in the LQFP144
package.  The MCU has 1MB of flash and 320kB of System RAM.
Cortex-M7 runs at up to 216MHz.
2017-11-20 14:42:05 +11:00
Damien George bbac2df0cf stm32/boards/stm32f746_af.csv: Fix typos in AF table. 2017-11-20 14:19:12 +11: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
Damien George 2cafef857e stm32/boards/NUCLEO_F429ZI: Incr CPU freq to 168MHz to get USB working.
At the original frequency of 90MHz there's no way to get a 48MHz USB clock.
These new setting mirror those of the STM32F429DISC board.
2017-11-15 12:23:29 +11:00
Paul Sokolovsky 964bf935a3 esp8266/esp8266_common.ld: Put .text of more libs into .irom0.text .
Recent vendor SDKs ship libs with code in .text section, which previously
was going into .irom0.text. Adjust the linker script to route these
sections back to iROM (follows upstream change).
2017-11-14 09:24:33 +02:00
Christopher Cooper 7413b3ce3e extmod/moduhashlib: Enable SHA1 hashing when using "mbedtls" library.
The SHA1 hashing functionality is provided via the "axtls" library's
implementation, and hence is unavailable when the "axtls" library is not being
used.  This change provides the same SHA1 hashing functionality when using the
"mbedtls" library by using its implementation instead.
2017-11-12 21:46:23 +02:00
Paul Sokolovsky 0535d03370 esp8266/README: Add section on using upip. 2017-11-12 18:34:56 +02:00
Paul Sokolovsky 9c209e4d09 esp8266/README: Emphasize the need to change default WiFi password. 2017-11-12 18:34:46 +02:00
stijn 79ed58f87b py/objnamedtuple: Add _asdict function if OrderedDict is supported 2017-11-12 14:16:54 +02:00
Paul Sokolovsky 1b146e9de9 py/mpconfig: Introduce reusable MP_HTOBE32(), etc. macros.
Macros to convert big-endian values to host byte order and vice-versa.
These were defined in adhoc way for some ports (e.g. esp8266), allow
reuse, provide default implementations, while allow ports to override.
2017-11-08 19:47:37 +02:00
Paul Sokolovsky b9580b85a8 unix/moduselect: Fix nanbox build after adding .dump() method. 2017-11-07 01:13:19 +02:00
Paul Sokolovsky cb910c6a0c unix/moduselect: Add .dump() method for debugging.
Commented out by default.
2017-11-07 00:43:21 +02:00
Paul Sokolovsky e766a4af4a esp8266/etshal.h: Make function prototypes compatible with ESP SDK 2.1.0+.
In the vendor SDK 2.1.0, some of the functions which previously didn't
have prototypes, finally acquired them. Change prototypes on our side
to match those in vendor headers, to avoid warnings-as-errors.
2017-11-05 00:29:33 +02:00
Paul Sokolovsky 3a9b15fd79 zephyr/README: "make qemu" was replaced with "make run". 2017-11-01 15:16:01 +02:00
Damien George 5ae9586541 teensy: Get port compiling without any warnings. 2017-11-01 11:00:30 +11:00
Paul Sokolovsky 24c8eda744 unix: Enable MICROPY_PY_REVERSE_SPECIAL_METHODS.
With inplace methods now disabled by default, it makes sense to enable
reverse methods, as they allow for more useful features, e.g. allow
for datetime module to implement both 2 * HOUR and HOUR * 2 (where
HOUR is e.g. timedelta object).
2017-10-28 13:05:57 +03:00
Paul Sokolovsky 9a7e3469b2 unix/modusocket: Remove #if MICROPY_SOCKET_EXTRA code blocks.
These defined couple of functions added during initial experimentation,
which aren't part of MicroPython API and no longer used or needed.
2017-10-24 23:13:19 +03:00
Damien George f4059dcc0c all: Use NULL instead of "" when calling mp_raise exception helpers.
This is the established way of doing it and reduces code size by a little
bit.
2017-10-24 22:39:36 +11:00
Paul Sokolovsky cfff12612f unix: Rename modsocket.c to modusocket.c.
Unix naming is historical, before current conventions were established.
All other ports however have it as "modusocket.c", so rename for
consistency and to avoid confusion.
2017-10-23 12:09:37 +03:00
Damien George d6bf3658f4 stm32: Make uos.dupterm() conform to specs by using extmod version.
The legacy function pyb.repl_uart() is still provided and retains its
original behaviour (it only accepts a UART object).  uos.dupterm() will now
accept any object with write/readinto methods.  At the moment there is just
1 dupterm slot.
2017-10-19 14:16:42 +11:00
Damien George 0eb333e3cf stm32/mphalport: Improve efficiency of mp_hal_stdout_tx_strn_cooked.
Also simplifies the code by removing the specialised (and inefficient)
cooked functions from UART and USB_VCP.
2017-10-19 14:15:32 +11:00
Damien George 8fa3d2996c stm32/modnwwiznet5k: Implement stream ioctl for the Wiznet driver.
Now supports polling for read and write ability.
2017-10-17 16:34:10 +11:00
Damien George 285ac58532 stm32/modnwwiznet5k: Increase SPI bus speed to 42MHz.
The W5200 and W5500 can support up to 80MHz so 42MHz (the maximum the
pyboard can do in its standard configuration) should be safe.

Tested to give around 1050000 kbytes/sec TCP download speed on a W5500,
which is about 10% more than with the previous SPI speed of 21MHz.
2017-10-17 16:31:12 +11:00
Damien George e36821a766 stm32/modnwwiznet5k: Add support for W5500 Ethernet chip.
Which Wiznet chip to use is a compile-time option: MICROPY_PY_WIZNET5K
should be set to either 5200 or 5500 to support either one of these
Ethernet chips.  The driver is called network.WIZNET5K in both cases.

Note that this commit introduces a breaking-change at the build level
because previously the valid values for MICROPY_PY_WIZNET5K were 0 and 1
but now they are 0, 5200 and 5500.
2017-10-16 15:36:57 +11:00
Li Weiwei 5c437963d7 stm32/mpconfigport.h: Add MICROPY_THREAD_YIELD() macro. 2017-10-16 13:32:26 +11:00
Damien George 0a30ad96c8 stm32/modusocket: Return OSError(-2) if getaddrinfo fails.
This matches the behaviour of getaddrinfo in extmod/modlwip.c.
2017-10-16 13:19:11 +11:00
Damien George 5d7b0b237b stm32/modusocket: Make getaddrinfo() work when passed an IP address. 2017-10-16 13:17:15 +11:00
Damien George 65ba481cb0 stm32/modnwwiznet5k: Implement WIZNET5K.isconnected() method. 2017-10-16 13:16:00 +11:00
Damien George 37282f8fc1 extmod/uos_dupterm: Update uos.dupterm() and helper funcs to have index.
The uos.dupterm() signature and behaviour is updated to reflect the latest
enhancements in the docs.  It has minor backwards incompatibility in that
it no longer accepts zero arguments.

The dupterm_rx helper function is moved from esp8266 to extmod and
generalised to support multiple dupterm slots.

A port can specify multiple slots by defining the MICROPY_PY_OS_DUPTERM
config macro to an integer, being the number of slots it wants to have;
0 means to disable the dupterm feature altogether.

The unix and esp8266 ports are updated to work with the new interface and
are otherwise unchanged with respect to functionality.
2017-10-13 20:01:57 +11:00
Li Weiwei e39fcda8eb stm32/usbd_cdc_interface.h: Fix code comments after recent refactor. 2017-10-13 12:45:16 +11:00
Damien George 7c7c7b161d stm32/usbd_cdc_interface: Don't reset CDC output buf on initialisation.
So that characters can be buffered before the USB device is connected
(restoring behviour of the driver before recent state refactoring).
2017-10-13 12:00:47 +11:00
Vitor Massaru Iha 1b7d6a7951 esp8266/modules/webrepl_setup: Add info about allowed password length.
This patch also makes the code more concise by combining the checks for the
password length.
2017-10-11 11:37:01 +11: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 6db132e130 esp8266/modnetwork: Add "bssid" keyword arg to WLAN.connect() method. 2017-10-09 23:09:06 +11:00
Paul Sokolovsky 4514f073c1 zephyr: Switch to interrupt-driven pull-style console.
While this console API improves handling on real hardware boards
(e.g. clipboard paste is much more reliable, as well as programmatic
communication), it vice-versa poses problems under QEMU, apparently
because it doesn't emulate UART interrupt handling faithfully. That
leads to inability to run the testsuite on QEMU at all. To work that
around, we have to suuport both old and new console routines, and use
the old ones under QEMU.
2017-10-07 17:36:16 +03:00
Paul Sokolovsky 58ea239510 zephyr: Use CONFIG_NET_APP_SETTINGS to setup initial network addresses.
Ideally, these should be configurable from Python (using network module),
but as that doesn't exist, we better off using Zephyr's native bootstrap
configuration facility.
2017-10-07 14:08:50 +03:00
Damien George 6f1a615427 stm32/boards: Fix typos in stm32f767_af.csv table. 2017-10-06 14:32:42 +11:00
Li Weiwei 8c7db42ee3 stm32/modnwwiznet5k: Get the IP address of an established socket.
When wiznet5k_socket_accept is called, if a socket is established, get the
IP address of the socket.
2017-10-05 11:09:07 +11:00
Damien George ff93fd4f50 py/persistentcode: Bump .mpy version number to version 3.
The binary and unary ops have changed bytecode encoding.
2017-10-05 10:49:44 +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 b00040c43c esp8266/esp_mphal: Send data in chunks to mp_uos_dupterm_tx_strn.
Sending byte-by-byte is inefficient and leads to errors in the WebSocket
protocol when sending utf-8 encoded characters.
2017-10-03 23:24:24 +11:00
David Lechner 62849b7010 py: Add config option to print warnings/errors to stderr.
This adds a new configuration option to print runtime warnings and errors to
stderr. On Unix, CPython prints warnings and unhandled exceptions to stderr,
so the unix port here is configured to use this option.

The unix port already printed unhandled exceptions on the main thread to
stderr. This patch fixes unhandled exceptions on other threads and warnings
(issue #2838) not printing on stderr.

Additionally, a couple tests needed to be fixed to handle this new behavior.
This is done by also capturing stderr when running tests.
2017-09-26 11:59:11 +10:00
Damien George d29b709642 stm32/timer: Enable ARPE so that timer freq can be changed smoothly.
The timer prescaler is buffered by default, and this patch enables ARPE
which buffers the auto-reload register.  With both of these registers
buffered it's now possible to smoothly change the timer's frequency and
have a smoothly varying PWM output.
2017-09-25 15:25:08 +10:00
Damien George f7f4bf0321 stm32/usbdev: Move all the USB device descriptor state into its struct. 2017-09-22 10:57:21 +10:00
Damien George db7f4aa2cb stm32/usbdev: Make device descriptor callbacks take a state pointer. 2017-09-22 10:28:56 +10:00
Damien George dbff0164b3 stm32/usbdev: Merge all global USB device state into a single struct.
This is the final piece of USB device refactoring to support multiple
USB device instances.
2017-09-21 21:51:15 +10:00
Damien George 0ea73d2da7 stm32/usbdev: Simplify pointers to MSC state and block dev operations. 2017-09-21 21:51:12 +10:00
Damien George f8f17f48c5 stm32/usbdev: Put all state for the USB device driver in a struct. 2017-09-21 21:51:04 +10:00
Damien George 35e3435f6e stm32/usbdev/core: Add state parameter to all callback functions. 2017-09-21 21:51:02 +10:00
Damien George b3b922f177 stm32/usbdev: Simplify HID tx/rx buffer passing. 2017-09-21 21:50:56 +10:00
Damien George e04b478050 stm32/usbdev: Simplify CDC tx/rx buffer passing. 2017-09-21 21:50:48 +10:00
Damien George 77e1da40e2 stm32/usbdev: Put all HID state in a struct. 2017-09-21 21:50:37 +10:00
Damien George 980b33177b stm32/usbdev: Put all CDC state in a struct. 2017-09-21 21:48:28 +10:00
Damien George ede8a0235b py/vstr: Raise a RuntimeError if fixed vstr buffer overflows.
Current users of fixed vstr buffers (building file paths) assume that there
is no overflow and do not check for overflow after building the vstr.  This
has the potential to lead to NULL pointer dereferences
(when vstr_null_terminated_str returns NULL because it can't allocate RAM
for the terminating byte) and stat'ing and loading invalid path names (due
to the path being truncated).  The safest and simplest thing to do in these
cases is just raise an exception if a write goes beyond the end of a fixed
vstr buffer, which is what this patch does.  It also simplifies the vstr
code.
2017-09-21 20:29:41 +10:00
Damien George 347de3e218 stm32/usbdev: Change static function variable to non-static.
It's written straight away in the function on every call so it doesn't need
to be static.
2017-09-20 17:45:21 +10:00
Damien George 78602a217f stm32/usbdev: Make the USBD callback struct const so it can go in ROM. 2017-09-20 17:44:16 +10:00
Damien George aca498c2b0 stm32/mpconfigport.h: Add configuration for max periphs on L4 series. 2017-09-13 17:03:57 +10:00
Damien George d7cd1d2027 stm32/timer: Make pyb.Timer() instances persistent.
Prior to this patch calling pyb.Timer(id) would always create a new timer
instance, even if there was an existing one.  This patch fixes this
behaviour to match other peripherals, like UART, such that constructing a
timer with just the id will retrieve any existing instances.

The patch also refactors the way timers are validated on construction to
simplify and reduce code size.
2017-09-13 16:20:42 +10:00
Damien George da8c4c2653 py/builtinhelp: Change signature of help text var from pointer to array.
As a pointer (const char *) it takes up an extra word of storage which is
in RAM.
2017-09-12 16:03:52 +10:00
Damien George eea5fcc442 stm32/make-stmconst.py: Make sure mpz const data lives in ROM. 2017-09-12 15:31:43 +10:00
Paul Sokolovsky c46d480adc zephyr/Makefile: Revamp "test" target after ports were moved to ports/. 2017-09-10 22:25:43 +03:00
Paul Sokolovsky d6f9d64d97 tests/class_reverse_op: Test for reverse arith ops special methods.
This test should be run only if support for reverse ops is enabled, so
the corresponding feature_check is added to run-tests.
2017-09-10 17:05:57 +03:00
Paul Sokolovsky eb84a830df py/runtime: Implement dispatch for "reverse op" special methods.
If, for class X, X.__add__(Y) doesn't exist (or returns NotImplemented),
try Y.__radd__(X) instead.

This patch could be simpler, but requires undoing operand swap and
operation switch to get non-confusing error message in case __radd__
doesn't exist.
2017-09-10 17:05:57 +03:00
Paul Sokolovsky 9355cca610 esp8266: Set DEFPSIZE=1024, MINCACHE=3 for "btree" module.
Defaults of 4096 and 5 respectively are too high to esp8266, causing
out of memory with a database beyond couple of pages.
2017-09-10 13:54:00 +03:00
Paul Sokolovsky 9b4666dad5 esp8266/posix_helpers: Set ENOMEM on memory alloc failure.
POSIX requires malloc(), etc. to set ENOMEM on the failure, and e.g.
BerkeleyDB relies on this:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html

This should fix confusing OSError exceptions with 0 error code when
working with btree module.
2017-09-10 09:55:18 +03:00
Paul Sokolovsky 5671a11b81 esp8266: Rename axtls_helpers.c to posix_helpers.c.
As it's used by BerkeleyDB, etc.
2017-09-10 09:47:20 +03:00
Tobias Badertscher bd71b3252a stm32/boards: Add new board B_L475E_IOT01A based on STM32L475. 2017-09-10 16:02:39 +10:00
Damien George cc7fece309 stm32/modnwwiznet5k: Release the GIL on blocking network operations.
connect, send, recv, sendto and recvfrom now release the GIL.  accept
already releases the GIL because it calls mp_hal_delay_ms() within its
busy-wait loop.
2017-09-08 12:23:33 +10:00
Damien George 19f1b39d6f stm32/i2c: When scanning for I2C devices only do 1 probe per address.
Previous to this patch the i2c.scan() method would do up to 100 probes per
I2C address, to detect the devices on the bus.  This repeated probing was a
relic from when the code was copied from the accelerometer initialisation,
which requires to do repeated probes while waiting for the accelerometer
chip to turn on.

But I2C devices shouldn't need more than 1 probe to detect their presence,
and the generic software I2C implementation uses 1 probe successfully.  So
this patch changes the implementation to use 1 probe per address, which
significantly speeds up the scan operation.
2017-09-08 11:19:40 +10:00
Damien George 069fc48bf6 stm32/boards: Fix I2C1 pin mapping on NUCLEO_F401RE/F411RE boards.
This patch makes it consistent with the STM document describing the Arduino
layout.

Thanks to @shaoziyang for the original patch.
2017-09-06 15:41:12 +10:00
Damien George 21c889baeb stm32/boards: Change linker scripts to use "K" instead of hex byte size. 2017-09-06 15:24:08 +10:00
Damien George 81375eb470 stm32/boards: Change remaining stm32f4xx_hal_conf.h to unix line ending. 2017-09-06 15:02:21 +10:00
Damien George 3101a8fe32 stm32: Replace stray tabs with spaces. 2017-09-06 14:53:17 +10:00
Damien George f1dd0fd7df stm32: Remove unused usbd_msc.c file. 2017-09-06 14:50:08 +10:00
Damien George 4a93801c12 all: Update Makefiles and others to build with new ports/ dir layout.
Also renames "stmhal" to "stm32" in documentation and everywhere else.
2017-09-06 14:09:13 +10:00
Damien George 01dd7804b8 ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
2017-09-06 13:40:51 +10:00