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.
2016-12-05 20:20:10 -05:00
|
|
|
/*
|
|
|
|
* This file is part of the MicroPython project, http://micropython.org/
|
|
|
|
*
|
|
|
|
* Development of the code in this file was sponsored by Microbric Pty Ltd
|
|
|
|
* and Mnemote Pty Ltd
|
|
|
|
*
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2016, 2017 Nick Moore @mnemote
|
|
|
|
*
|
|
|
|
* Based on extmod/modlwip.c
|
|
|
|
* Copyright (c) 2013, 2014 Damien P. George
|
|
|
|
* Copyright (c) 2015 Galen Hazelwood
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "py/runtime0.h"
|
|
|
|
#include "py/nlr.h"
|
|
|
|
#include "py/objlist.h"
|
|
|
|
#include "py/objstr.h"
|
|
|
|
#include "py/runtime.h"
|
|
|
|
#include "py/mperrno.h"
|
|
|
|
#include "py/mphal.h"
|
|
|
|
#include "py/stream.h"
|
|
|
|
#include "py/mperrno.h"
|
|
|
|
#include "lib/netutils/netutils.h"
|
|
|
|
#include "tcpip_adapter.h"
|
2019-07-10 01:38:48 -04:00
|
|
|
#include "mdns.h"
|
2018-04-27 09:53:45 -04:00
|
|
|
#include "modnetwork.h"
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
|
|
|
|
#include "lwip/sockets.h"
|
|
|
|
#include "lwip/netdb.h"
|
|
|
|
#include "lwip/ip4.h"
|
2017-09-22 06:31:10 -04:00
|
|
|
#include "lwip/igmp.h"
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
#include "esp_log.h"
|
|
|
|
|
2019-09-13 09:04:13 -04:00
|
|
|
#if !MICROPY_ESP_IDF_4
|
|
|
|
#define lwip_bind lwip_bind_r
|
|
|
|
#define lwip_listen lwip_listen_r
|
|
|
|
#define lwip_accept lwip_accept_r
|
|
|
|
#define lwip_setsockopt lwip_setsockopt_r
|
|
|
|
#define lwip_fnctl lwip_fnctl_r
|
|
|
|
#define lwip_recvfrom lwip_recvfrom_r
|
|
|
|
#define lwip_write lwip_write_r
|
|
|
|
#define lwip_sendto lwip_sendto_r
|
|
|
|
#define lwip_close lwip_close_r
|
|
|
|
#endif
|
|
|
|
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
#define SOCKET_POLL_US (100000)
|
2019-07-10 01:38:48 -04:00
|
|
|
#define MDNS_QUERY_TIMEOUT_MS (5000)
|
|
|
|
#define MDNS_LOCAL_SUFFIX ".local"
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
|
|
|
|
typedef struct _socket_obj_t {
|
|
|
|
mp_obj_base_t base;
|
|
|
|
int fd;
|
|
|
|
uint8_t domain;
|
|
|
|
uint8_t type;
|
|
|
|
uint8_t proto;
|
2018-05-02 08:31:00 -04:00
|
|
|
bool peer_closed;
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
unsigned int retries;
|
2018-04-27 09:53:45 -04:00
|
|
|
#if MICROPY_PY_USOCKET_EVENTS
|
|
|
|
mp_obj_t events_callback;
|
|
|
|
struct _socket_obj_t *events_next;
|
|
|
|
#endif
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
} socket_obj_t;
|
|
|
|
|
|
|
|
void _socket_settimeout(socket_obj_t *sock, uint64_t timeout_ms);
|
|
|
|
|
2018-04-27 09:53:45 -04:00
|
|
|
#if MICROPY_PY_USOCKET_EVENTS
|
|
|
|
// Support for callbacks on asynchronous socket events (when socket becomes readable)
|
|
|
|
|
|
|
|
// This divisor is used to reduce the load on the system, so it doesn't poll sockets too often
|
|
|
|
#define USOCKET_EVENTS_DIVISOR (8)
|
|
|
|
|
|
|
|
STATIC uint8_t usocket_events_divisor;
|
|
|
|
STATIC socket_obj_t *usocket_events_head;
|
|
|
|
|
|
|
|
void usocket_events_deinit(void) {
|
|
|
|
usocket_events_head = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assumes the socket is not already in the linked list, and adds it
|
|
|
|
STATIC void usocket_events_add(socket_obj_t *sock) {
|
|
|
|
sock->events_next = usocket_events_head;
|
|
|
|
usocket_events_head = sock;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assumes the socket is already in the linked list, and removes it
|
|
|
|
STATIC void usocket_events_remove(socket_obj_t *sock) {
|
|
|
|
for (socket_obj_t **s = &usocket_events_head;; s = &(*s)->events_next) {
|
|
|
|
if (*s == sock) {
|
|
|
|
*s = (*s)->events_next;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Polls all registered sockets for readability and calls their callback if they are readable
|
|
|
|
void usocket_events_handler(void) {
|
|
|
|
if (usocket_events_head == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (--usocket_events_divisor) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
usocket_events_divisor = USOCKET_EVENTS_DIVISOR;
|
|
|
|
|
|
|
|
fd_set rfds;
|
|
|
|
FD_ZERO(&rfds);
|
|
|
|
int max_fd = 0;
|
|
|
|
|
|
|
|
for (socket_obj_t *s = usocket_events_head; s != NULL; s = s->events_next) {
|
|
|
|
FD_SET(s->fd, &rfds);
|
|
|
|
max_fd = MAX(max_fd, s->fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Poll the sockets
|
|
|
|
struct timeval timeout = { .tv_sec = 0, .tv_usec = 0 };
|
|
|
|
int r = select(max_fd + 1, &rfds, NULL, NULL, &timeout);
|
|
|
|
if (r <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Call the callbacks
|
|
|
|
for (socket_obj_t *s = usocket_events_head; s != NULL; s = s->events_next) {
|
|
|
|
if (FD_ISSET(s->fd, &rfds)) {
|
|
|
|
mp_call_function_1_protected(s->events_callback, s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // MICROPY_PY_USOCKET_EVENTS
|
|
|
|
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
NORETURN static void exception_from_errno(int _errno) {
|
|
|
|
// Here we need to convert from lwip errno values to MicroPython's standard ones
|
|
|
|
if (_errno == EINPROGRESS) {
|
|
|
|
_errno = MP_EINPROGRESS;
|
|
|
|
}
|
|
|
|
mp_raise_OSError(_errno);
|
|
|
|
}
|
|
|
|
|
2018-05-02 10:09:25 -04:00
|
|
|
static inline void check_for_exceptions(void) {
|
|
|
|
mp_handle_pending();
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
}
|
|
|
|
|
2019-07-10 01:38:48 -04:00
|
|
|
// This function mimics lwip_getaddrinfo, with added support for mDNS queries
|
|
|
|
static int _socket_getaddrinfo3(const char *nodename, const char *servname,
|
|
|
|
const struct addrinfo *hints, struct addrinfo **res) {
|
|
|
|
|
|
|
|
#if MICROPY_HW_ENABLE_MDNS_QUERIES
|
|
|
|
int nodename_len = strlen(nodename);
|
|
|
|
const int local_len = sizeof(MDNS_LOCAL_SUFFIX) - 1;
|
|
|
|
if (nodename_len > local_len
|
|
|
|
&& strcasecmp(nodename + nodename_len - local_len, MDNS_LOCAL_SUFFIX) == 0) {
|
|
|
|
// mDNS query
|
|
|
|
char nodename_no_local[nodename_len - local_len + 1];
|
|
|
|
memcpy(nodename_no_local, nodename, nodename_len - local_len);
|
|
|
|
nodename_no_local[nodename_len - local_len] = '\0';
|
|
|
|
|
|
|
|
struct ip4_addr addr = {0};
|
|
|
|
esp_err_t err = mdns_query_a(nodename_no_local, MDNS_QUERY_TIMEOUT_MS, &addr);
|
|
|
|
if (err != ESP_OK) {
|
|
|
|
if (err == ESP_ERR_NOT_FOUND){
|
|
|
|
*res = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
*res = NULL;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct addrinfo *ai = memp_malloc(MEMP_NETDB);
|
|
|
|
if (ai == NULL) {
|
|
|
|
*res = NULL;
|
|
|
|
return EAI_MEMORY;
|
|
|
|
}
|
|
|
|
memset(ai, 0, sizeof(struct addrinfo) + sizeof(struct sockaddr_storage));
|
|
|
|
|
|
|
|
struct sockaddr_in *sa = (struct sockaddr_in*)((uint8_t*)ai + sizeof(struct addrinfo));
|
|
|
|
inet_addr_from_ip4addr(&sa->sin_addr, &addr);
|
|
|
|
sa->sin_family = AF_INET;
|
|
|
|
sa->sin_len = sizeof(struct sockaddr_in);
|
|
|
|
sa->sin_port = lwip_htons((u16_t)atoi(servname));
|
|
|
|
ai->ai_family = AF_INET;
|
|
|
|
ai->ai_canonname = ((char*)sa + sizeof(struct sockaddr_storage));
|
|
|
|
memcpy(ai->ai_canonname, nodename, nodename_len + 1);
|
|
|
|
ai->ai_addrlen = sizeof(struct sockaddr_storage);
|
|
|
|
ai->ai_addr = (struct sockaddr*)sa;
|
|
|
|
|
|
|
|
*res = ai;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Normal query
|
|
|
|
return lwip_getaddrinfo(nodename, servname, hints, res);
|
|
|
|
}
|
|
|
|
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
static int _socket_getaddrinfo2(const mp_obj_t host, const mp_obj_t portx, struct addrinfo **resp) {
|
|
|
|
const struct addrinfo hints = {
|
|
|
|
.ai_family = AF_INET,
|
|
|
|
.ai_socktype = SOCK_STREAM,
|
|
|
|
};
|
|
|
|
|
|
|
|
mp_obj_t port = portx;
|
2019-01-30 06:05:48 -05:00
|
|
|
if (mp_obj_is_small_int(port)) {
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
// This is perverse, because lwip_getaddrinfo promptly converts it back to an int, but
|
|
|
|
// that's the API we have to work with ...
|
|
|
|
port = mp_obj_str_binary_op(MP_BINARY_OP_MODULO, mp_obj_new_str_via_qstr("%s", 2), port);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *host_str = mp_obj_str_get_str(host);
|
|
|
|
const char *port_str = mp_obj_str_get_str(port);
|
|
|
|
|
|
|
|
if (host_str[0] == '\0') {
|
|
|
|
// a host of "" is equivalent to the default/all-local IP address
|
|
|
|
host_str = "0.0.0.0";
|
|
|
|
}
|
|
|
|
|
|
|
|
MP_THREAD_GIL_EXIT();
|
2019-07-10 01:38:48 -04:00
|
|
|
int res = _socket_getaddrinfo3(host_str, port_str, &hints, resp);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
MP_THREAD_GIL_ENTER();
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2019-01-29 20:40:50 -05:00
|
|
|
STATIC void _socket_getaddrinfo(const mp_obj_t addrtuple, struct addrinfo **resp) {
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
mp_obj_t *elem;
|
2019-01-29 20:40:50 -05:00
|
|
|
mp_obj_get_array_fixed_n(addrtuple, 2, &elem);
|
|
|
|
int res = _socket_getaddrinfo2(elem[0], elem[1], resp);
|
|
|
|
if (res != 0) {
|
|
|
|
mp_raise_OSError(res);
|
|
|
|
}
|
|
|
|
if (*resp == NULL) {
|
|
|
|
mp_raise_OSError(-2); // name or service not known
|
|
|
|
}
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
}
|
|
|
|
|
2019-02-18 07:20:13 -05:00
|
|
|
STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
|
|
|
mp_arg_check_num(n_args, n_kw, 0, 3, false);
|
|
|
|
|
|
|
|
socket_obj_t *sock = m_new_obj_with_finaliser(socket_obj_t);
|
|
|
|
sock->base.type = type_in;
|
|
|
|
sock->domain = AF_INET;
|
|
|
|
sock->type = SOCK_STREAM;
|
|
|
|
sock->proto = 0;
|
|
|
|
sock->peer_closed = false;
|
|
|
|
if (n_args > 0) {
|
|
|
|
sock->domain = mp_obj_get_int(args[0]);
|
|
|
|
if (n_args > 1) {
|
|
|
|
sock->type = mp_obj_get_int(args[1]);
|
|
|
|
if (n_args > 2) {
|
|
|
|
sock->proto = mp_obj_get_int(args[2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sock->fd = lwip_socket(sock->domain, sock->type, sock->proto);
|
|
|
|
if (sock->fd < 0) {
|
|
|
|
exception_from_errno(errno);
|
|
|
|
}
|
|
|
|
_socket_settimeout(sock, UINT64_MAX);
|
|
|
|
|
|
|
|
return MP_OBJ_FROM_PTR(sock);
|
|
|
|
}
|
|
|
|
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
STATIC mp_obj_t socket_bind(const mp_obj_t arg0, const mp_obj_t arg1) {
|
|
|
|
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
|
|
|
|
struct addrinfo *res;
|
|
|
|
_socket_getaddrinfo(arg1, &res);
|
2019-09-13 09:04:13 -04:00
|
|
|
int r = lwip_bind(self->fd, res->ai_addr, res->ai_addrlen);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
lwip_freeaddrinfo(res);
|
|
|
|
if (r < 0) exception_from_errno(errno);
|
|
|
|
return mp_const_none;
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
|
2019-09-13 09:04:13 -04:00
|
|
|
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
STATIC mp_obj_t socket_listen(const mp_obj_t arg0, const mp_obj_t arg1) {
|
|
|
|
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
|
|
|
|
int backlog = mp_obj_get_int(arg1);
|
2019-09-13 09:04:13 -04:00
|
|
|
int r = lwip_listen(self->fd, backlog);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
if (r < 0) exception_from_errno(errno);
|
|
|
|
return mp_const_none;
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_listen_obj, socket_listen);
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_accept(const mp_obj_t arg0) {
|
|
|
|
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
|
|
|
|
|
|
|
|
struct sockaddr addr;
|
|
|
|
socklen_t addr_len = sizeof(addr);
|
|
|
|
|
|
|
|
int new_fd = -1;
|
|
|
|
for (int i=0; i<=self->retries; i++) {
|
|
|
|
MP_THREAD_GIL_EXIT();
|
2019-09-13 09:04:13 -04:00
|
|
|
new_fd = lwip_accept(self->fd, &addr, &addr_len);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
MP_THREAD_GIL_ENTER();
|
|
|
|
if (new_fd >= 0) break;
|
|
|
|
if (errno != EAGAIN) exception_from_errno(errno);
|
|
|
|
check_for_exceptions();
|
|
|
|
}
|
2019-05-28 03:43:00 -04:00
|
|
|
if (new_fd < 0) {
|
|
|
|
if (self->retries == 0) {
|
|
|
|
mp_raise_OSError(MP_EAGAIN);
|
|
|
|
} else {
|
|
|
|
mp_raise_OSError(MP_ETIMEDOUT);
|
|
|
|
}
|
|
|
|
}
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
|
|
|
|
// create new socket object
|
|
|
|
socket_obj_t *sock = m_new_obj_with_finaliser(socket_obj_t);
|
|
|
|
sock->base.type = self->base.type;
|
|
|
|
sock->fd = new_fd;
|
|
|
|
sock->domain = self->domain;
|
|
|
|
sock->type = self->type;
|
|
|
|
sock->proto = self->proto;
|
2018-05-02 08:31:00 -04:00
|
|
|
sock->peer_closed = false;
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
_socket_settimeout(sock, UINT64_MAX);
|
|
|
|
|
|
|
|
// make the return value
|
|
|
|
uint8_t *ip = (uint8_t*)&((struct sockaddr_in*)&addr)->sin_addr;
|
|
|
|
mp_uint_t port = lwip_ntohs(((struct sockaddr_in*)&addr)->sin_port);
|
|
|
|
mp_obj_tuple_t *client = mp_obj_new_tuple(2, NULL);
|
|
|
|
client->items[0] = sock;
|
|
|
|
client->items[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
|
|
|
|
|
|
|
|
return client;
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_connect(const mp_obj_t arg0, const mp_obj_t arg1) {
|
|
|
|
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
|
|
|
|
struct addrinfo *res;
|
|
|
|
_socket_getaddrinfo(arg1, &res);
|
|
|
|
MP_THREAD_GIL_EXIT();
|
2019-09-13 09:04:13 -04:00
|
|
|
int r = lwip_connect(self->fd, res->ai_addr, res->ai_addrlen);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
MP_THREAD_GIL_ENTER();
|
|
|
|
lwip_freeaddrinfo(res);
|
|
|
|
if (r != 0) {
|
|
|
|
exception_from_errno(errno);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mp_const_none;
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
|
|
|
|
(void)n_args; // always 4
|
|
|
|
socket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
|
|
|
|
|
|
|
|
int opt = mp_obj_get_int(args[2]);
|
|
|
|
|
2017-09-22 06:31:10 -04:00
|
|
|
switch (opt) {
|
|
|
|
// level: SOL_SOCKET
|
|
|
|
case SO_REUSEADDR: {
|
|
|
|
int val = mp_obj_get_int(args[3]);
|
2019-09-13 09:04:13 -04:00
|
|
|
int ret = lwip_setsockopt(self->fd, SOL_SOCKET, opt, &val, sizeof(int));
|
2017-09-22 06:31:10 -04:00
|
|
|
if (ret != 0) {
|
|
|
|
exception_from_errno(errno);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-04-27 09:53:45 -04:00
|
|
|
#if MICROPY_PY_USOCKET_EVENTS
|
|
|
|
// level: SOL_SOCKET
|
|
|
|
// special "register callback" option
|
|
|
|
case 20: {
|
|
|
|
if (args[3] == mp_const_none) {
|
|
|
|
if (self->events_callback != MP_OBJ_NULL) {
|
|
|
|
usocket_events_remove(self);
|
|
|
|
self->events_callback = MP_OBJ_NULL;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (self->events_callback == MP_OBJ_NULL) {
|
|
|
|
usocket_events_add(self);
|
|
|
|
}
|
|
|
|
self->events_callback = args[3];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-09-22 06:31:10 -04:00
|
|
|
// level: IPPROTO_IP
|
|
|
|
case IP_ADD_MEMBERSHIP: {
|
|
|
|
mp_buffer_info_t bufinfo;
|
|
|
|
mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ);
|
|
|
|
if (bufinfo.len != sizeof(ip4_addr_t) * 2) {
|
|
|
|
mp_raise_ValueError(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
// POSIX setsockopt has order: group addr, if addr, lwIP has it vice-versa
|
|
|
|
err_t err = igmp_joingroup((const ip4_addr_t*)bufinfo.buf + 1, bufinfo.buf);
|
|
|
|
if (err != ERR_OK) {
|
|
|
|
mp_raise_OSError(-err);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
mp_printf(&mp_plat_print, "Warning: lwip.setsockopt() option not implemented\n");
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return mp_const_none;
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
|
|
|
|
|
|
|
|
void _socket_settimeout(socket_obj_t *sock, uint64_t timeout_ms) {
|
|
|
|
// Rather than waiting for the entire timeout specified, we wait sock->retries times
|
|
|
|
// for SOCKET_POLL_US each, checking for a MicroPython interrupt between timeouts.
|
|
|
|
// with SOCKET_POLL_MS == 100ms, sock->retries allows for timeouts up to 13 years.
|
|
|
|
// if timeout_ms == UINT64_MAX, wait forever.
|
|
|
|
sock->retries = (timeout_ms == UINT64_MAX) ? UINT_MAX : timeout_ms * 1000 / SOCKET_POLL_US;
|
|
|
|
|
|
|
|
struct timeval timeout = {
|
|
|
|
.tv_sec = 0,
|
|
|
|
.tv_usec = timeout_ms ? SOCKET_POLL_US : 0
|
|
|
|
};
|
2019-09-13 09:04:13 -04:00
|
|
|
lwip_setsockopt(sock->fd, SOL_SOCKET, SO_SNDTIMEO, (const void *)&timeout, sizeof(timeout));
|
|
|
|
lwip_setsockopt(sock->fd, SOL_SOCKET, SO_RCVTIMEO, (const void *)&timeout, sizeof(timeout));
|
|
|
|
lwip_fcntl(sock->fd, F_SETFL, timeout_ms ? 0 : O_NONBLOCK);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_settimeout(const mp_obj_t arg0, const mp_obj_t arg1) {
|
|
|
|
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
|
|
|
|
if (arg1 == mp_const_none) _socket_settimeout(self, UINT64_MAX);
|
2018-07-02 22:10:03 -04:00
|
|
|
else {
|
|
|
|
#if MICROPY_PY_BUILTINS_FLOAT
|
|
|
|
_socket_settimeout(self, mp_obj_get_float(arg1) * 1000L);
|
|
|
|
#else
|
|
|
|
_socket_settimeout(self, mp_obj_get_int(arg1) * 1000);
|
|
|
|
#endif
|
|
|
|
}
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
return mp_const_none;
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_setblocking(const mp_obj_t arg0, const mp_obj_t arg1) {
|
|
|
|
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
|
|
|
|
if (mp_obj_is_true(arg1)) _socket_settimeout(self, UINT64_MAX);
|
|
|
|
else _socket_settimeout(self, 0);
|
|
|
|
return mp_const_none;
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
|
|
|
|
|
2018-05-02 08:31:00 -04:00
|
|
|
// XXX this can end up waiting a very long time if the content is dribbled in one character
|
|
|
|
// at a time, as the timeout resets each time a recvfrom succeeds ... this is probably not
|
|
|
|
// good behaviour.
|
|
|
|
STATIC mp_uint_t _socket_read_data(mp_obj_t self_in, void *buf, size_t size,
|
|
|
|
struct sockaddr *from, socklen_t *from_len, int *errcode) {
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
socket_obj_t *sock = MP_OBJ_TO_PTR(self_in);
|
2018-05-02 08:31:00 -04:00
|
|
|
|
|
|
|
// If the peer closed the connection then the lwIP socket API will only return "0" once
|
2019-09-13 09:04:13 -04:00
|
|
|
// from lwip_recvfrom and then block on subsequent calls. To emulate POSIX behaviour,
|
2018-05-02 08:31:00 -04:00
|
|
|
// which continues to return "0" for each call on a closed socket, we set a flag when
|
|
|
|
// the peer closed the socket.
|
|
|
|
if (sock->peer_closed) {
|
|
|
|
return 0;
|
|
|
|
}
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
|
|
|
|
// XXX Would be nicer to use RTC to handle timeouts
|
2018-05-02 08:31:00 -04:00
|
|
|
for (int i = 0; i <= sock->retries; ++i) {
|
2019-01-09 23:46:44 -05:00
|
|
|
// Poll the socket to see if it has waiting data and only release the GIL if it doesn't.
|
|
|
|
// This ensures higher performance in the case of many small reads, eg for readline.
|
|
|
|
bool release_gil;
|
|
|
|
{
|
|
|
|
fd_set rfds;
|
|
|
|
FD_ZERO(&rfds);
|
|
|
|
FD_SET(sock->fd, &rfds);
|
|
|
|
struct timeval timeout = { .tv_sec = 0, .tv_usec = 0 };
|
|
|
|
int r = select(sock->fd + 1, &rfds, NULL, NULL, &timeout);
|
|
|
|
release_gil = r != 1;
|
|
|
|
}
|
|
|
|
if (release_gil) {
|
|
|
|
MP_THREAD_GIL_EXIT();
|
|
|
|
}
|
2019-09-13 09:04:13 -04:00
|
|
|
int r = lwip_recvfrom(sock->fd, buf, size, 0, from, from_len);
|
2019-01-09 23:46:44 -05:00
|
|
|
if (release_gil) {
|
|
|
|
MP_THREAD_GIL_ENTER();
|
|
|
|
}
|
2018-05-02 08:31:00 -04:00
|
|
|
if (r == 0) {
|
|
|
|
sock->peer_closed = true;
|
|
|
|
}
|
|
|
|
if (r >= 0) {
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
if (errno != EWOULDBLOCK) {
|
|
|
|
*errcode = errno;
|
|
|
|
return MP_STREAM_ERROR;
|
|
|
|
}
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
check_for_exceptions();
|
|
|
|
}
|
2018-05-02 08:31:00 -04:00
|
|
|
|
|
|
|
*errcode = sock->retries == 0 ? MP_EWOULDBLOCK : MP_ETIMEDOUT;
|
|
|
|
return MP_STREAM_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
mp_obj_t _socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in,
|
|
|
|
struct sockaddr *from, socklen_t *from_len) {
|
|
|
|
size_t len = mp_obj_get_int(len_in);
|
|
|
|
vstr_t vstr;
|
|
|
|
vstr_init_len(&vstr, len);
|
|
|
|
|
|
|
|
int errcode;
|
|
|
|
mp_uint_t ret = _socket_read_data(self_in, vstr.buf, len, from, from_len, &errcode);
|
|
|
|
if (ret == MP_STREAM_ERROR) {
|
|
|
|
exception_from_errno(errcode);
|
|
|
|
}
|
|
|
|
|
|
|
|
vstr.len = ret;
|
|
|
|
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
|
|
|
|
return _socket_recvfrom(self_in, len_in, NULL, NULL);
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
|
|
|
|
struct sockaddr from;
|
|
|
|
socklen_t fromlen = sizeof(from);
|
|
|
|
|
|
|
|
mp_obj_t tuple[2];
|
|
|
|
tuple[0] = _socket_recvfrom(self_in, len_in, &from, &fromlen);
|
|
|
|
|
|
|
|
uint8_t *ip = (uint8_t*)&((struct sockaddr_in*)&from)->sin_addr;
|
|
|
|
mp_uint_t port = lwip_ntohs(((struct sockaddr_in*)&from)->sin_port);
|
|
|
|
tuple[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG);
|
|
|
|
|
|
|
|
return mp_obj_new_tuple(2, tuple);
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
|
|
|
|
|
|
|
|
int _socket_send(socket_obj_t *sock, const char *data, size_t datalen) {
|
|
|
|
int sentlen = 0;
|
|
|
|
for (int i=0; i<=sock->retries && sentlen < datalen; i++) {
|
|
|
|
MP_THREAD_GIL_EXIT();
|
2019-09-13 09:04:13 -04:00
|
|
|
int r = lwip_write(sock->fd, data+sentlen, datalen-sentlen);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
MP_THREAD_GIL_ENTER();
|
|
|
|
if (r < 0 && errno != EWOULDBLOCK) exception_from_errno(errno);
|
|
|
|
if (r > 0) sentlen += r;
|
|
|
|
check_for_exceptions();
|
|
|
|
}
|
2019-09-13 09:04:13 -04:00
|
|
|
if (sentlen == 0) mp_raise_OSError(MP_ETIMEDOUT);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
return sentlen;
|
|
|
|
}
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_send(const mp_obj_t arg0, const mp_obj_t arg1) {
|
|
|
|
socket_obj_t *sock = MP_OBJ_TO_PTR(arg0);
|
2019-02-17 20:38:38 -05:00
|
|
|
mp_buffer_info_t bufinfo;
|
|
|
|
mp_get_buffer_raise(arg1, &bufinfo, MP_BUFFER_READ);
|
|
|
|
int r = _socket_send(sock, bufinfo.buf, bufinfo.len);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
return mp_obj_new_int(r);
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_sendall(const mp_obj_t arg0, const mp_obj_t arg1) {
|
|
|
|
// XXX behaviour when nonblocking (see extmod/modlwip.c)
|
|
|
|
// XXX also timeout behaviour.
|
|
|
|
socket_obj_t *sock = MP_OBJ_TO_PTR(arg0);
|
|
|
|
mp_buffer_info_t bufinfo;
|
|
|
|
mp_get_buffer_raise(arg1, &bufinfo, MP_BUFFER_READ);
|
|
|
|
int r = _socket_send(sock, bufinfo.buf, bufinfo.len);
|
|
|
|
if (r < bufinfo.len) mp_raise_OSError(MP_ETIMEDOUT);
|
|
|
|
return mp_const_none;
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_sendall_obj, socket_sendall);
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) {
|
|
|
|
socket_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
|
|
|
|
|
|
|
// get the buffer to send
|
|
|
|
mp_buffer_info_t bufinfo;
|
|
|
|
mp_get_buffer_raise(data_in, &bufinfo, MP_BUFFER_READ);
|
|
|
|
|
|
|
|
// create the destination address
|
|
|
|
struct sockaddr_in to;
|
|
|
|
to.sin_len = sizeof(to);
|
|
|
|
to.sin_family = AF_INET;
|
|
|
|
to.sin_port = lwip_htons(netutils_parse_inet_addr(addr_in, (uint8_t*)&to.sin_addr, NETUTILS_BIG));
|
|
|
|
|
|
|
|
// send the data
|
|
|
|
for (int i=0; i<=self->retries; i++) {
|
|
|
|
MP_THREAD_GIL_EXIT();
|
2019-09-13 09:04:13 -04:00
|
|
|
int ret = lwip_sendto(self->fd, bufinfo.buf, bufinfo.len, 0, (struct sockaddr*)&to, sizeof(to));
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
MP_THREAD_GIL_ENTER();
|
|
|
|
if (ret > 0) return mp_obj_new_int_from_uint(ret);
|
|
|
|
if (ret == -1 && errno != EWOULDBLOCK) {
|
|
|
|
exception_from_errno(errno);
|
|
|
|
}
|
|
|
|
check_for_exceptions();
|
|
|
|
}
|
2019-09-13 09:04:13 -04:00
|
|
|
mp_raise_OSError(MP_ETIMEDOUT);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_fileno(const mp_obj_t arg0) {
|
|
|
|
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
|
|
|
|
return mp_obj_new_int(self->fd);
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_fileno_obj, socket_fileno);
|
|
|
|
|
|
|
|
STATIC mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) {
|
|
|
|
(void)n_args;
|
|
|
|
return args[0];
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile);
|
|
|
|
|
|
|
|
STATIC mp_uint_t socket_stream_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
|
2018-05-02 08:31:00 -04:00
|
|
|
return _socket_read_data(self_in, buf, size, NULL, NULL, errcode);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
STATIC mp_uint_t socket_stream_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
|
|
|
|
socket_obj_t *sock = self_in;
|
|
|
|
for (int i=0; i<=sock->retries; i++) {
|
|
|
|
MP_THREAD_GIL_EXIT();
|
2019-09-13 09:04:13 -04:00
|
|
|
int r = lwip_write(sock->fd, buf, size);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
MP_THREAD_GIL_ENTER();
|
|
|
|
if (r > 0) return r;
|
|
|
|
if (r < 0 && errno != EWOULDBLOCK) { *errcode = errno; return MP_STREAM_ERROR; }
|
|
|
|
check_for_exceptions();
|
|
|
|
}
|
|
|
|
*errcode = sock->retries == 0 ? MP_EWOULDBLOCK : MP_ETIMEDOUT;
|
|
|
|
return MP_STREAM_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
STATIC mp_uint_t socket_stream_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
|
|
|
|
socket_obj_t * socket = self_in;
|
|
|
|
if (request == MP_STREAM_POLL) {
|
|
|
|
|
|
|
|
fd_set rfds; FD_ZERO(&rfds);
|
|
|
|
fd_set wfds; FD_ZERO(&wfds);
|
|
|
|
fd_set efds; FD_ZERO(&efds);
|
|
|
|
struct timeval timeout = { .tv_sec = 0, .tv_usec = 0 };
|
|
|
|
if (arg & MP_STREAM_POLL_RD) FD_SET(socket->fd, &rfds);
|
|
|
|
if (arg & MP_STREAM_POLL_WR) FD_SET(socket->fd, &wfds);
|
|
|
|
if (arg & MP_STREAM_POLL_HUP) FD_SET(socket->fd, &efds);
|
|
|
|
|
|
|
|
int r = select((socket->fd)+1, &rfds, &wfds, &efds, &timeout);
|
|
|
|
if (r < 0) {
|
|
|
|
*errcode = MP_EIO;
|
|
|
|
return MP_STREAM_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
mp_uint_t ret = 0;
|
|
|
|
if (FD_ISSET(socket->fd, &rfds)) ret |= MP_STREAM_POLL_RD;
|
|
|
|
if (FD_ISSET(socket->fd, &wfds)) ret |= MP_STREAM_POLL_WR;
|
|
|
|
if (FD_ISSET(socket->fd, &efds)) ret |= MP_STREAM_POLL_HUP;
|
|
|
|
return ret;
|
2018-03-07 01:48:53 -05:00
|
|
|
} else if (request == MP_STREAM_CLOSE) {
|
|
|
|
if (socket->fd >= 0) {
|
2018-04-27 09:53:45 -04:00
|
|
|
#if MICROPY_PY_USOCKET_EVENTS
|
|
|
|
if (socket->events_callback != MP_OBJ_NULL) {
|
|
|
|
usocket_events_remove(socket);
|
|
|
|
socket->events_callback = MP_OBJ_NULL;
|
|
|
|
}
|
|
|
|
#endif
|
2019-09-13 09:04:13 -04:00
|
|
|
int ret = lwip_close(socket->fd);
|
2018-03-07 01:48:53 -05:00
|
|
|
if (ret != 0) {
|
|
|
|
*errcode = errno;
|
|
|
|
return MP_STREAM_ERROR;
|
|
|
|
}
|
|
|
|
socket->fd = -1;
|
|
|
|
}
|
|
|
|
return 0;
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
*errcode = MP_EINVAL;
|
|
|
|
return MP_STREAM_ERROR;
|
|
|
|
}
|
|
|
|
|
2018-05-02 08:33:41 -04:00
|
|
|
STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socket_bind_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&socket_listen_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_accept), MP_ROM_PTR(&socket_accept_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&socket_connect_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&socket_send_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_sendall), MP_ROM_PTR(&socket_sendall_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socket_sendto_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_recv), MP_ROM_PTR(&socket_recv_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_recvfrom), MP_ROM_PTR(&socket_recvfrom_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&socket_setsockopt_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&socket_settimeout_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socket_setblocking_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_makefile), MP_ROM_PTR(&socket_makefile_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_fileno), MP_ROM_PTR(&socket_fileno_obj) },
|
|
|
|
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
};
|
|
|
|
STATIC MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
|
|
|
|
|
|
|
|
STATIC const mp_stream_p_t socket_stream_p = {
|
|
|
|
.read = socket_stream_read,
|
|
|
|
.write = socket_stream_write,
|
|
|
|
.ioctl = socket_stream_ioctl
|
|
|
|
};
|
|
|
|
|
|
|
|
STATIC const mp_obj_type_t socket_type = {
|
|
|
|
{ &mp_type_type },
|
|
|
|
.name = MP_QSTR_socket,
|
2019-02-18 07:20:13 -05:00
|
|
|
.make_new = socket_make_new,
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
.protocol = &socket_stream_p,
|
|
|
|
.locals_dict = (mp_obj_t)&socket_locals_dict,
|
|
|
|
};
|
|
|
|
|
2018-02-21 03:09:38 -05:00
|
|
|
STATIC mp_obj_t esp_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
|
|
|
|
// TODO support additional args beyond the first two
|
|
|
|
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
struct addrinfo *res = NULL;
|
2018-02-21 03:09:38 -05:00
|
|
|
_socket_getaddrinfo2(args[0], args[1], &res);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
mp_obj_t ret_list = mp_obj_new_list(0, NULL);
|
|
|
|
|
|
|
|
for (struct addrinfo *resi = res; resi; resi = resi->ai_next) {
|
|
|
|
mp_obj_t addrinfo_objs[5] = {
|
|
|
|
mp_obj_new_int(resi->ai_family),
|
|
|
|
mp_obj_new_int(resi->ai_socktype),
|
|
|
|
mp_obj_new_int(resi->ai_protocol),
|
|
|
|
mp_obj_new_str(resi->ai_canonname, strlen(resi->ai_canonname)),
|
|
|
|
mp_const_none
|
|
|
|
};
|
2019-09-13 09:04:13 -04:00
|
|
|
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
if (resi->ai_family == AF_INET) {
|
|
|
|
struct sockaddr_in *addr = (struct sockaddr_in *)resi->ai_addr;
|
|
|
|
// This looks odd, but it's really just a u32_t
|
|
|
|
ip4_addr_t ip4_addr = { .addr = addr->sin_addr.s_addr };
|
|
|
|
char buf[16];
|
|
|
|
ip4addr_ntoa_r(&ip4_addr, buf, sizeof(buf));
|
|
|
|
mp_obj_t inaddr_objs[2] = {
|
|
|
|
mp_obj_new_str(buf, strlen(buf)),
|
|
|
|
mp_obj_new_int(ntohs(addr->sin_port))
|
|
|
|
};
|
|
|
|
addrinfo_objs[4] = mp_obj_new_tuple(2, inaddr_objs);
|
|
|
|
}
|
|
|
|
mp_obj_list_append(ret_list, mp_obj_new_tuple(5, addrinfo_objs));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res) lwip_freeaddrinfo(res);
|
|
|
|
return ret_list;
|
|
|
|
}
|
2018-02-21 03:09:38 -05:00
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_socket_getaddrinfo_obj, 2, 6, esp_socket_getaddrinfo);
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
|
|
|
|
STATIC mp_obj_t esp_socket_initialize() {
|
|
|
|
static int initialized = 0;
|
|
|
|
if (!initialized) {
|
|
|
|
ESP_LOGI("modsocket", "Initializing");
|
|
|
|
tcpip_adapter_init();
|
|
|
|
initialized = 1;
|
|
|
|
}
|
|
|
|
return mp_const_none;
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_socket_initialize_obj, esp_socket_initialize);
|
|
|
|
|
2018-05-02 08:33:41 -04:00
|
|
|
STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_usocket) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&esp_socket_initialize_obj) },
|
2019-02-18 07:20:13 -05:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socket_type) },
|
2018-05-02 08:33:41 -04:00
|
|
|
{ MP_ROM_QSTR(MP_QSTR_getaddrinfo), MP_ROM_PTR(&esp_socket_getaddrinfo_obj) },
|
|
|
|
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_AF_INET), MP_ROM_INT(AF_INET) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_AF_INET6), MP_ROM_INT(AF_INET6) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_SOCK_STREAM), MP_ROM_INT(SOCK_STREAM) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_ROM_INT(SOCK_DGRAM) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_SOCK_RAW), MP_ROM_INT(SOCK_RAW) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_TCP), MP_ROM_INT(IPPROTO_TCP) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_UDP), MP_ROM_INT(IPPROTO_UDP) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM_INT(IPPROTO_IP) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_ROM_INT(SOL_SOCKET) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_ROM_INT(SO_REUSEADDR) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_IP_ADD_MEMBERSHIP), MP_ROM_INT(IP_ADD_MEMBERSHIP) },
|
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.
2016-12-05 20:20:10 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
STATIC MP_DEFINE_CONST_DICT(mp_module_socket_globals, mp_module_socket_globals_table);
|
|
|
|
|
|
|
|
const mp_obj_module_t mp_module_usocket = {
|
|
|
|
.base = { &mp_type_module },
|
|
|
|
.globals = (mp_obj_dict_t*)&mp_module_socket_globals,
|
|
|
|
};
|