aboutsummaryrefslogtreecommitdiff
path: root/ports/esp32
AgeCommit message (Collapse)Author
2021-04-23esp32/CMakeLists.txt: Require CMake version 3.12.Damien George
Because "find_package(Python3 ...)" requires at least this version of CMake. And other features like GREATER_EQUAL and COMMAND_EXPAND_LISTS need at least CMake 3.7 and 3.8 respectively. Signed-off-by: Damien George <damien@micropython.org>
2021-04-15esp32/machine_pin: Use rtc_gpio_deinit instead of gpio_reset_pin.Damien George
Commit 8a917ad2529ea3df5f47e2be5b4edf362d2d03f6 added the gpio_reset_pin() call to make sure that pins that were used as ADC inputs could subsequently be used as digital IO. But calling gpio_reset_pin() will enable the pull-up on the pin and so pull it high for a brief period. Instead use rtc_gpio_deinit() which will just reconfigure the pin as a digital IO and do nothing else. Fixes issue #7079 (see also #5771). Signed-off-by: Damien George <damien@micropython.org>
2021-04-15esp32/boards: Add GENERIC_S2 board definition.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-15esp32: Add support for USB with CDC ACM.Damien George
The REPL will be available on the USB serial port. Signed-off-by: Damien George <damien@micropython.org>
2021-04-15esp32: Add initial support for ESP32S2 SoCs.Damien George
Builds against IDF v4.3-beta2. Signed-off-by: Damien George <damien@micropython.org>
2021-04-14esp32/modsocket: Correctly handle poll/read of unconnected TCP socket.Damien George
For an unconnected TCP socket, poll should return WR|HUP and read should raise ENOTCONN. This is implemented by this commit and now the following tests pass on esp32: extmod/usocket_tcp_basic.py, net_hosted/connect_poll.py. Signed-off-by: Damien George <damien@micropython.org>
2021-04-09esp32: Enable btree module.Damien George
This was disabled with the move to CMake, and this commit reinstates it. Signed-off-by: Damien George <damien@micropython.org>
2021-04-09extmod/extmod.cmake: Add support to build btree module with CMake.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-09py/py.cmake: Introduce MICROPY_INC_CORE as a list with core includes.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-09py/py.cmake: Move qstr helper code to micropy_gather_target_properties.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-01esp32: Fix multiple definition errors with mp_hal_stdout_tx functions.Michael O'Cleirigh
It was noticed that the esp32 port didn't build ulab correctly. The problem was a multiple defintion of the 'mp_hal_stdout_tx_str' and 'mp_hal_stdout_tx_strn_cooked' functions. They were defined in stdout_helpers.c but also in the ports/esp32/mphalport.c. Fixed by removing stdout_helpers.c from the build. Signed-off-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
2021-04-01esp32: Restore USER_C_MODULE support with new CMake build system.Michael O'Cleirigh
Support for User C and C++ modules was lost due to upgrading the esp32 to the latest CMake based IDF from the GNUMakefile build process. Restore the support for the esp32 port by integrating with the approach recently added for the rp2 port. Signed-off-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
2021-03-14extmod/extmod.cmake: Add modonewire.c to MICROPY_SOURCE_EXTMOD list.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-03-12esp32/machine_hw_spi: Use default pins when making SPI if none given.Damien George
The default pins can be optionally configured by a board. Fixes issue #6974. Signed-off-by: Damien George <damien@micropython.org>
2021-03-11esp32/Makefile: Specify port and baud on erase_flash command.Mike Causer
2021-02-21esp32: Define MICROPY_QSTRDEFS_PORT to include special qstrs.Damien George
Fixes issue #6942. Signed-off-by: Damien George <damien@micropython.org>
2021-02-19esp32: Make machine.soft_reset() work in main.py and reset_cause().Thorsten von Eicken
This commit fixes two issues on the esp32: - it enables machine.soft_reset() to be called in main.py; - it enables machine.reset_cause() to correctly identify a soft reset. The former is useful in that it enables soft resets in applications that are started at boot time. The support is patterned after the stm32 port.
2021-02-19esp32: Add basic support for Non-Volatile-Storage in esp32 module.Thorsten von Eicken
This commit implements basic NVS support for the esp32. It follows the pattern of the esp32.Partition class and exposes an NVS object per NVS namespace. The initial support provided is only for signed 32-bit integers and binary blobs. It's easy (albeit a bit tedious) to add support for more types. See discussions in: #4436, #4707, #6780
2021-02-19esp32: Add support to build with ESP-IDF v4.3 pre-release.Damien George
The esp32 port now builds against IDF v4.3-beta1, as well as v4.4-dev. Signed-off-by: Damien George <damien@micropython.org>
2021-02-19esp32/boards: Enable size optimisation for builds.Damien George
This enables -Os for compilation, but still keeps full assertion messages. With IDF v4.2, -Os changes the GENERIC firmware size from 1512176 down to 1384640, and the GENERIC_SPIRAM firmware is now 1452320 which fits in the allocated partition. Signed-off-by: Damien George <damien@micropython.org>
2021-02-17extmod/modussl: Fix ussl read/recv/send/write errors when non-blocking.Thorsten von Eicken
Also fix related problems with socket on esp32, improve docs for wrap_socket, and add more tests.
2021-02-15esp32: Set MICROPY_USE_INTERNAL_ERRNO=0 to use toolchain's errno.h.Thorsten von Eicken
The underlying OS (the ESP-IDF) uses it's own internal errno codes and so it's simpler and cleaner to use those rather than trying to convert everything to the values defined in py/mperrno.h.
2021-02-15esp32/modsocket: Remove unix socket error code translation.Thorsten von Eicken
The ESP-IDF has its own errno codes which should propagate out to the user.
2021-02-15esp32: Remove obsolete IDF v3 code wrapped in MICROPY_ESP_IDF_4.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32: Add support to build with ESP-IDF v4.2.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32: Add support to build with ESP-IDF v4.1.1.Damien George
ESP-IDF v4.0.2 is still supported. Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32/README: Update based on new IDF v4 cmake build process.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32/boards: Enable BLE on all boards.Damien George
BLE was enabled by default on all boards in the existing make build. Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32/boards: Remove old IDF v3 sdkconfig values.Damien George
IDF v3 is no longer supported with the move to cmake. Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32: Remove traditional "make" capability.Damien George
It's now replaced by cmake/idf.py. But a convenience Makefile is still provided with traditional targets like "all" and "deploy". Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32: Add explicit initialisers to silence compiler warnings.Damien George
This makes no functional change. See similar commit 9aa58cf8bac353297ff5e7b4f3331e5618046095 Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32/esp32_rmt: Don't do unnecessary check for unsigned less than zero.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-15esp32: Add support to build using IDF with cmake.Damien George
This commit adds support for building the esp32 port with cmake, and in particular it builds MicroPython as a component within the ESP-IDF. Using cmake and the ESP-IDF build infrastructure makes it much easier to maintain the port, especially with the various new ESP32 MCUs and their required toolchains. Signed-off-by: Damien George <damien@micropython.org>
2021-02-04all: Rename BYTES_PER_WORD to MP_BYTES_PER_OBJ_WORD.Damien George
The "word" referred to by BYTES_PER_WORD is actually the size of mp_obj_t which is not always the same as the size of a pointer on the target architecture. So rename this config value to better reflect what it measures, and also prefix it with MP_. For uses of BYTES_PER_WORD in setting the stack limit this has been changed to sizeof(void *), because the stack usually grows with machine-word sized values (eg an nlr_buf_t has many machine words in it). Signed-off-by: Damien George <damien@micropython.org>
2021-02-04ports: Remove def of MP_PLAT_PRINT_STRN if it's the same as the default.Damien George
To simplify config, there's no need to specify MP_PLAT_PRINT_STRN if it's the same as the default definition in py/mpconfig.h. Signed-off-by: Damien George <damien@micropython.org>
2021-01-23esp32/modnetwork: Synchronize WiFi AUTH_xxx constants with IDF values.IhorNehrutsa
2020-11-23extmod/machine_i2c: Add init protocol method for generic I2C bindings.Damien George
Hardware I2C implementations must provide a .init() protocol method if they want to support reconfiguration. Otherwise the default is that i2c.init() raises an OSError (currently the case for all ports). mp_machine_soft_i2c_locals_dict is renamed to mp_machine_i2c_locals_dict to match the generic SPI bindings. Fixes issue #6623 (where calling .init() on a HW I2C would crash). Signed-off-by: Damien George <damien@micropython.org>
2020-11-18esp32,esp8266: Remove "FAT" from warning message in inisetup.py.robert
Because FAT is not any more the only filesystem used.
2020-11-12esp32/machine_pin: Reset pin if init sets mode.Jonathan Hogg
This will forcibly grab the pin back from the ADC if it has previously been associated with it. Fixes #5771.
2020-10-29esp32,unix: Support building C++ code.stijn
Support building .cpp files and linking them into the micropython executable in a way similar to how it is done for .c files. The main incentive here is to enable user C modules to use C++ files (which are put in SRC_MOD_CXX by py.mk) since the core itself does not utilize C++. However, to verify build functionality a unix overage test is added. The esp32 port already has CXXFLAGS so just add the user modules' flags to it. For the unix port use a copy of the CFLAGS but strip the ones which are not usable for C++.
2020-10-29py/mkrules.mk: Add target for compiling C++ files.stijn
Move the target from the ESP32 Makefile since that does what is needed already, but also include files from user C modules as is done for the C files.
2020-10-29esp32/mpconfigport.h: Seed the urandom module on import.robert
For seeding, the RNG function of the ESP-IDF is used, which is told to be a true RNG, at least when WiFi or Bluetooth is enabled. Seeding on import is as per CPython. To obtain a reproducible sequence of pseudo-random numbers one must explicitly seed with a known value.
2020-10-21esp32/mpconfigport.h: Enable MICROPY_PY_DELATTR_SETATTR.Andrew Leech
To align with unix and stm32 ports.
2020-10-06esp32: Use path relative to root for netutils/timeutils headers.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-10-01extmod/utime_mphal: Add generic utime.time_ns() function.Damien George
It requires mp_hal_time_ns() to be provided by a port. This function allows very accurate absolute timestamps. Enabled on unix, windows, stm32, esp8266 and esp32. Signed-off-by: Damien George <damien@micropython.org>
2020-10-01ports: Support legacy soft I2C/SPI construction via id=-1 arg.Damien George
With a warning that this way of constructing software I2C/SPI is deprecated. The check and warning will be removed in a future release. This should help existing code to migrate to the new SoftI2C/SoftSPI types. Signed-off-by: Damien George <damien@micropython.org>
2020-10-01ports: Add SoftI2C and SoftSPI to machine module where appropriate.Damien George
Previous commits removed the ability for one I2C/SPI constructor to construct both software- or hardware-based peripheral instances. Such construction is now split to explicit soft and non-soft types. This commit makes both types available in all ports that previously could create both software and hardware peripherals: machine.I2C and machine.SPI construct hardware instances, while machine.SoftI2C and machine.SoftSPI create software instances. This is a breaking change for use of software-based I2C and SPI. Code that constructed I2C/SPI peripherals in the following way will need to be changed: machine.I2C(-1, ...) -> machine.SoftI2C(...) machine.I2C(scl=scl, sda=sda) -> machine.SoftI2C(scl=scl, sda=sda) machine.SPI(-1, ...) -> machine.SoftSPI(...) machine.SPI(sck=sck, mosi=mosi, miso=miso) -> machine.SoftSPI(sck=sck, mosi=mosi, miso=miso) Code which uses machine.I2C and machine.SPI classes to access hardware peripherals does not need to change. Signed-off-by: Damien George <damien@micropython.org>
2020-10-01extmod/machine_spi: Remove "id" arg in SoftSPI constructor.Damien George
The SoftSPI constructor is now used soley to create SoftSPI instances, it can no longer delegate to create a hardware-based SPI instance. Signed-off-by: Damien George <damien@micropython.org>
2020-10-01extmod/machine_i2c: Remove "id" arg in SoftI2C constructor.Damien George
The SoftI2C constructor is now used soley to create SoftI2C instances, it can no longer delegate to create a hardware-based I2C instance. Signed-off-by: Damien George <damien@micropython.org>
2020-10-01extmod/machine_i2c: Rename type to SoftI2C and add custom print method.Damien George
Also rename machine_i2c_type to mp_machine_soft_i2c_type. These changes make it clear that it's a soft-I2C implementation, and match SoftSPI. Signed-off-by: Damien George <damien@micropython.org>