Commit Graph

47 Commits

Author SHA1 Message Date
Damien George
c77225ae5b esp32/boards/GENERIC_C3: Add generic C3-based board.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-18 23:58:24 +10:00
Damien George
bbf9dd849a esp32/boards/sdkconfig.base: Disable MEMPROT_FEATURE to alloc from IRAM.
Dynamically generate/loaded native code (eg from @micropython.native or
native .mpy files) needs to be able allocate from IRAM, and the memory
protection feature must be disabled for that to work.  Disabling it is
needed to get native code working on ESP32-S2 and -C3.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-20 22:54:20 +10:00
IAMLIUBO
a18f695e29 esp32/boards: Add M5STACK_ATOM board definition.
ATOM is a very small ESP32 development board produced by M5Stack, with a
size of 24mm * 24mm, with peripherals such as WS2812, IR, button, MPU6886
(Only Matrix), and 8 GPIO extensions.  It also has a plastic shell.
2021-05-30 23:15:13 +10:00
Damien George
db8704ecbd esp8266,esp32: Update manifest to point to new dirs in micropython-lib.
Following a refactoring of micropython-lib.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-28 18:32:56 +10:00
Mike Causer
605b74f390 esp32/boards: Fix spelling mistakes in comments for UM_xxx boards. 2021-05-14 22:26:29 +10:00
Mike Causer
9e65662a11 esp32/boards: Set default I2C and SPI pins on UM_xxx boards.
And fix incorrect I2C and SPI pins in the feathers2 module.
2021-05-14 22:26:05 +10:00
Chris Greening
cce7096d1a esp32/boards/UM_TINYPICO: Fix include of sdkconfig fragment.
This was broken by 32ec07a350
2021-05-11 09:36:41 +10:00
Damien George
0e87459e2b esp32/boards: Add UM_FEATHERS2 and UM_TINYS2 board definitions.
Based on original commit made by Seon Rozenblum aka @UnexpectedMaker.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-10 16:56:53 +10:00
Seon Rozenblum
32ec07a350 esp32/boards: Rename TINYPICO board to UM_TINYPICO.
And add default hardware SPI 0 pins in mpconfigboard.h, and
CONFIG_LWIP_LOCAL_HOSTNAME in sdkconfig.board.
2021-05-10 16:56:53 +10:00
Damien George
5093d49fae esp32: Extend support for S2 series, and S3 where applicable.
Improvements made:
- PSRAM support for S2
- partition definition for 16MiB flash
- correct ADC and DAC pins
- correct GPIO and IRQ pins
- S3 components in CMakeLists

Based on original commit made by Seon Rozenblum aka @UnexpectedMaker.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-10 16:56:53 +10:00
Steve App
21fee92be6 esp32: Restore FROZEN_MANIFEST support with new CMake build system.
This commit re-enables the command-line make option "FROZEN_MANIFEST".  The
boards/*/mpconfigboard.cmake will now use the command-line FROZEN_MANIFEST
value if supplied.

Usage: make FROZEN_MANIFEST=~/foo/my-manifest.py
2021-04-29 12:34:00 +10:00
Damien George
d97b8daf1a esp32/boards: Add GENERIC_S2 board definition.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-15 10:31:06 +10:00
Damien George
c81d048bb3 esp32: Add support for USB with CDC ACM.
The REPL will be available on the USB serial port.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-15 10:31:06 +10:00
Damien George
66a86a0615 esp32: Add initial support for ESP32S2 SoCs.
Builds against IDF v4.3-beta2.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-15 10:31:06 +10:00
Damien George
466ad35a72 esp32/boards: Enable size optimisation for builds.
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-19 10:42:16 +11:00
Damien George
da2b5fa1c1 esp32/boards: Enable BLE on all boards.
BLE was enabled by default on all boards in the existing make build.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 16:40:07 +11:00
Damien George
26b17fd28a esp32/boards: Remove old IDF v3 sdkconfig values.
IDF v3 is no longer supported with the move to cmake.

Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 16:40:03 +11:00
Damien George
9f035d6bb7 esp32: Remove traditional "make" capability.
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-15 16:37:58 +11:00
Damien George
9b90882146 esp32: Add support to build using IDF with cmake.
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-15 12:48:39 +11:00
Jim Mussared
52d6eeb409 esp32/boards/sdkconfig.base: Set default IDF log level to ERROR.
This commit changes the default logging level on all esp32 boards to ERROR.
The esp32 port is now stable enough that it makes sense to remove the info
logs to make the output cleaner, and to match other ports.  More verbose
logging can always be reenabled via esp.osdebug().

This also fixes issue #6354, error messages from NimBLE: the problem is
that ble.active(True) will cause the IDF's NimBLE port to reset the
"NimBLE" tag back to the default level (which was INFO prior to this
commit).  Even if the user had previously called esp.osdebug(None), because
the IDF is setting the "NimBLE" tag back to the default (INFO), the
messages will continue to be shown.

The one quirk is that if the user does want to see the additional logging,
then they must call esp.osdebug(0, 3) after ble.active(True) to undo the
IDF setting the level back to the default (now ERROR).  This means that
it's impossible (via Python/esp.osdebug) to see stack-startup logging,
you'd have to recompile with the default level changed back to INFO.
2020-09-18 15:53:56 +10:00
Jim Mussared
311b8519af esp32: Pin MicroPython and NimBLE tasks to core 0.
MicroPython and NimBLE must be on the same core, for synchronisation of the
BLE ringbuf and the MicroPython scheduler.  However, in the current IDF
versions (3.3 and 4.0) there are issues (see e.g. #5489) with running
NimBLE on core 1.

This change - pinning both tasks to core 0 - makes it possible to reliably
run the BLE multitests on esp32 boards.
2020-09-08 12:53:24 +10:00
Thorsten von Eicken
952ff8a8ea esp32: Improve support for OTA updates.
This commit adds several small items to improve the support for OTA
updates on an esp32:

- a partition table for 4MB flash modules that has two OTA partitions ready
  to go to do updates
- a GENERIC_OTA board that uses that partition table and that enables
  automatic roll-back in the bootloader
- a new esp32.Partition.mark_app_valid_cancel_rollback() class-method to
  signal that the boot is successful and should not be rolled back at the
  next reset
- an automated test for doing an OTA update
- documentation updates
2020-05-03 15:00:45 +10:00
Damien George
ad004db662 esp32: Enable and freeze uasyncio. 2020-03-26 01:25:46 +11:00
Damien George
69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Jim Mussared
3032ae1155 esp32: Enable NimBLE support on all builds (IDF 3.3 and 4.0).
This commit updates the IDFv3 version to v3.3.1, and enables the
"ubluetooth" module by default on IDFv3 builds.
2020-01-15 00:24:43 +11:00
Jim Mussared
7ce1e0b1dc extmod/webrepl: Move webrepl scripts to common place and use manifest.
Move webrepl support code from ports/esp8266/modules into extmod/webrepl
(to be alongside extmod/modwebrepl.c), and use frozen manifests to include
it in the build on esp8266 and esp32.

A small modification is made to webrepl.py to make it work on non-ESP
ports, i.e. don't call dupterm_notify if not available.
2019-12-20 12:59:13 +11:00
Seon Rozenblum
0d82f5d8c8 esp32/boards/TINYPICO: Add tinypico.py, dotstar.py with custom manifest. 2019-12-19 10:05:01 +11:00
Andrew Leech
9ca8a503ed esp32/boards: Enable ULP in base sdk configuration.
Fixes issue #5159.
2019-12-05 15:28:56 +11:00
Jim Mussared
71299d3224 esp32/boards/sdkconfig.base: Resize SSL output buffer from 16 to 4kiB.
The IDF heap is more fragmented with IDF 4 and mbedtls cannot allocate
enough RAM with 16+16kiB for both in and out buffers, so reduce output
buffer size.

Fixes issue #5303.
2019-11-11 11:55:58 +11:00
Jim Mussared
912892b209 esp32: Add missing and necessary newline at EOF for sdkconfig.240mhz.
When these files get concatenated the newline-at-EOF is necessary so that
the start of the next file doesn't join with the end of the previous.
2019-10-21 23:54:59 +11:00
Jim Mussared
8ba963cfa3 tools/makemanifest.py: Eval relative paths w.r.t. current manifest file.
When loading a manifest file, e.g. by include(), it will chdir first to the
directory of that manifest.  This means that all file operations within a
manifest are relative to that manifest's location.

As a consequence of this, additional environment variables are needed to
find absolute paths, so the following are added: $(MPY_LIB_DIR),
$(PORT_DIR), $(BOARD_DIR).  And rename $(MPY) to $(MPY_DIR) to be
consistent.

Existing manifests are updated to match.
2019-10-21 23:01:41 +11:00
Josh Lloyd
59c1b7d4b8 esp32/boards: Split out CPU frequency config, make 160MHz the default.
Remove the 240MHz CPU config option from sdkconfig.base and create a new
sdkconfig.240mhz file for those boards that want to use 240MHz on boot.

The default CPU frequency is now 160MHz (was 240MHz), to align with the ESP
IDF and support more boards (eg those with D2WD chips).

Fixes issue #5169.
2019-10-18 13:42:24 +11:00
Damien George
ce1de1faf0 esp32: Convert to use FROZEN_MANIFEST to specify frozen code.
All symlinks are removed.  boards/manifest.py is used as a default, and can
optionally use boards/manifest_release.py for more scripts.
2019-10-15 21:37:02 +11:00
Jim Mussared
4b2b05718a esp32: Run NimBLE on the app core.
This prevents issues with concurrent access to the ringbuf.
MICROPY_BEGIN_ATOMIC_SECTION is only atomic to the same core.  We could
address this with a mutex, but it's also not safe to call mp_sched_schedule
across cores.
2019-10-15 17:22:15 +11:00
Jim Mussared
418f12c5f5 extmod/modbluetooth: Increase maximum connections from 1 to 4.
This avoids a confusing ENOMEM raised from gap_advertise if there is
currently an active connection.  This refers to the static connection
buffer pre-allocated by Nimble (nothing to do with MicroPython heap
memory).
2019-10-15 17:20:25 +11:00
Jim Mussared
d5cbee3cfb esp32: Add 4.x version of IDLE WDT config. 2019-10-11 14:30:47 +11:00
Jim Mussared
6a9bd1c1ab esp32: Implement BLE using Nimble from IDF 4.x. 2019-10-08 14:50:01 +11:00
Jim Mussared
96008ff59a esp32: Support building with ESP IDF 4.0-beta1.
This commit adds support for a second supported hash (currently set to the
4.0-beta1 tag).  When this hash is detected, the relevant changes are
applied.

This allows to start using v4 features (e.g. BLE with Nimble), and also
start doing testing, while still supporting the original, stable, v3.3 IDF.

Note: this feature is experimental, not well tested, and network.LAN and
network.PPP are currently unsupported.
2019-09-17 12:25:36 +10:00
Alex Albino
80d37d936c esp32: Add support for ESP32-D2WD with 2MiB internal flash.
This patch adds a partitions file for the D2WD and a new board GENERIC_D2WD
which runs on these chip variants.

Resolves issue #4986.
2019-09-10 15:22:16 +10:00
Damien George
e9af6f5f88 esp32/boards/TINYPICO: Switch to use QIO and 80MHz for SPI interface. 2019-09-10 11:10:19 +10:00
Jim Mussared
8db517f26d esp32: Add per-board configs, following other ports.
Replaces the `SDKCONFIG` makefile variable with `BOARD`.  Defaults to
BOARD=GENERIC.  spiram can be enabled with `BOARD=GENERIC_SPIRAM`

Add example definition for TINYPICO, currently identical to GENERIC_SPIRAM
but with custom board/SoC names for the uPy banner.
2019-08-16 00:22:29 +10:00
Damien George
69cb24a21d esp32/boards/sdkconfig: Disable WDT check of idle task on CPU1.
With dual-core enabled it's possible that the uPy task has full utilisation
of CPU1.  Fixes issue #4673.
2019-04-05 12:25:21 +11:00
Damien George
92149c8a79 esp32/boards: Enable dual core support by default.
Single core is still supported, just by adding CONFIG_FREERTOS_UNICORE=y to
a custom sdkconfig file.
2019-03-27 11:20:21 +11:00
Damien George
c33f538066 esp32/modmachine: Add support for changing the CPU frequency. 2019-02-07 22:51:55 +11:00
Damien George
6a95e74387 esp32: Use SPIRAM in mem-map mode so all of it can be used for uPy heap.
Also enable CONFIG_SPIRAM_IGNORE_NOTFOUND to allow boards with faulty or
missing SPIRAM to still boot.
2019-02-06 00:10:50 +11:00
Damien George
f431795caf esp32/boards: Use auto xtal freq config instead of default 40MHz.
Auto-detection of the crystal frequency is convenient and allows for a
single binary for many different boards.  But it can be unreliable in
certain situations so in production, for a given board, it's recommended to
configure the correct fixed frequency.
2019-01-28 20:42:12 +11:00
Damien George
3d49b157b8 esp32: Update to latest ESP IDF using sdkconfig and new ldgen procedure.
Configuration for the build is now specified using sdkconfig rather than
sdkconfig.h, which allows for much easier configuration with defaults from
the ESP IDF automatically applied.  sdkconfig.h is generated using the new
ESP IDF kconfig_new tool written in Python.  Custom configuration for a
particular ESP32 board can be specified via the make variable SDKCONFIG.

The esp32.common.ld file is also now generated using the standard ESP IDF
ldgen.py tool.
2019-01-28 12:44:03 +11:00