Commit Graph

281 Commits

Author SHA1 Message Date
Jim Mussared
073b9a5eb8 ports: Enable error text compression for various ports, but not all.
Enabled on: bare-arm, minimal, unix coverage/dev/minimal, stm32, esp32,
esp8266, cc3200, teensy, qemu-arm, nrf.  Not enabled on others to be able
to test the code when the feature is disabled (the default case).

Code size change for this commit:

   bare-arm:  -600 -0.906%
minimal x86:  -308 -0.208%
   unix x64:    +0 +0.000%
unix nanbox:    +0 +0.000%
      stm32: -3368 -0.869% PYBV10
     cc3200: -1024 -0.558%
    esp8266: -2512 -0.368% GENERIC
      esp32: -2876 -0.205% GENERIC[incl -3168(data)]
        nrf: -1708 -1.173% pca10040
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
2020-04-05 15:02:06 +10:00
Jim Mussared
def76fe4d9 all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
Damien George
312c699491 esp32: Change from FAT to littlefs v2 as default filesystem.
This commit changes the default filesystem type for esp32 to littlefs v2.
This port already enables both VfsFat and VfsLfs2, so either can be used
for the filesystem, and existing systems that use FAT will still work.
2020-04-04 17:03:30 +11:00
Jim Mussared
e97bb58f0e esp32/README.md: Fix typo in venv instructions. 2020-04-02 22:52:48 +11:00
Damien George
1a3e386c67 all: Remove spaces inside and around parenthesis.
Using new options enabled in the uncrustify configuration.
2020-03-28 23:36:44 +11:00
Damien George
ad004db662 esp32: Enable and freeze uasyncio. 2020-03-26 01:25:46 +11:00
Damien George
bf4fb16250 esp32/modsocket: Handle poll of a closed socket.
This gets tests/extmod/uselect_poll_basic.py working on the esp32.
2020-03-25 01:17:12 +11:00
Damien George
feb2577585 all: Remove spaces between nested paren and inside function arg paren.
Using new options enabled in the uncrustify configuration.
2020-03-25 00:39:46 +11:00
Jim Mussared
9715905b18 esp32/README.md: Update build instructions for newer toolchain.
Also fix Espressif links to the specific version they apply to.
2020-03-22 13:26:03 +11:00
Damien George
ad9a0ec8ab all: Convert exceptions to use mp_raise_XXX helpers in remaining places. 2020-03-18 17:26:19 +11:00
Thomas Friebel
bd746a4630 esp32: Deinitialize Bluetooth on soft reset.
This fixes a crash, caused by NimBLE continuing to call the Python BLE
interrupt handler after soft reboot.
2020-03-11 13:02:00 +11:00
Damien George
c44d52f33e extmod/modbluetooth_nimble: Move nimble specific code, factor nimble.mk.
Move extmod/modbluetooth_nimble.* to extmod/nimble.  And move common
Makefile lines to extmod/nimble/nimble.mk (which was previously only used
by stm32).  This allows (upcoming) btstack to follow a similar structure.

Work done in collaboration with Jim Mussared aka @jimmo.
2020-03-06 12:35:20 +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
Damien George
3f39d18c2b all: Add *FORMAT-OFF* in various places.
This string is recognised by uncrustify, to disable formatting in the
region marked by these comments.  This is necessary in the qstrdef*.h files
to prevent modification of the strings within the Q(...).  In other places
it is used to prevent excessive reformatting that would make the code less
readable.
2020-02-28 10:31:07 +11:00
Jim Mussared
a9ce8dfdaa esp32: Move to IDF 4.0 release version. 2020-02-20 00:34:31 +11:00
Damien George
ad7213d3c3 py: Add mp_raise_msg_varg helper and use it where appropriate.
This commit adds mp_raise_msg_varg(type, fmt, ...) as a helper for
nlr_raise(mp_obj_new_exception_msg_varg(type, fmt, ...)).  It makes the
C-level API for raising exceptions more consistent, and reduces code size
on most ports:

   bare-arm:   +28 +0.042%
minimal x86:  +100 +0.067%
   unix x64:   -56 -0.011%
unix nanbox:  -300 -0.068%
      stm32:  -204 -0.054% PYBV10
     cc3200:    +0 +0.000%
    esp8266:   -64 -0.010% GENERIC
      esp32:  -104 -0.007% GENERIC
        nrf:  -136 -0.094% pca10040
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
2020-02-13 11:52:40 +11:00
Damien George
97eca38c4f py: Add mp_raise_type helper macro and use it where appropriate.
This provides a more consistent C-level API to raise exceptions, ie moving
away from nlr_raise towards mp_raise_XXX.  It also reduces code size by a
small amount on some ports.
2020-02-13 11:03:37 +11:00
Damien George
5a755ac30a esp32/modsocket: Convert EADDRINUSE error code from lwip return value. 2020-02-11 13:59:09 +11:00
Damien George
f4641b2378 esp32/uart: Use core-provided mp_keyboard_interrupt, placed in IRAM. 2020-02-07 16:08:31 +11:00
Damien George
98a3911c43 py/scheduler: Add "raise_exc" argument to mp_handle_pending.
Previous behaviour is when this argument is set to "true", in which case
the function will raise any pending exception.  Setting it to "false" will
cancel any pending exception.
2020-02-07 16:08:20 +11:00
Jim Mussared
0645478475 esp32/Makefile: Reorder includes to build with latest toolchain.
Tested on:
- IDF3.3.1 (old toolchain)
- IDF4.0-beta1 (old toolchain)
- IDF4.0-beta1 (new toolchain from install.sh / export.sh)
2020-02-04 18:06:14 +11:00
David Lechner
b72cb0ca1b py/mpthread.h: Use strong type for mp_thread_set_state() argument.
This modifies the signature of mp_thread_set_state() to use
mp_state_thread_t* instead of void*.  This matches the return type of
mp_thread_get_state(), which returns the same value.

`struct _mp_state_thread_t;` had to be moved before
`#include <mpthreadport.h>` since the stm32 port uses it in its
mpthreadport.h file.
2020-01-29 17:10:32 +11:00
adzierzanowski
a55c17dc69 esp32/modnetwork: Add max_clients kw-arg to WLAN.config for AP setting.
This allows the user to configure the maximum number of clients that are
connected to the access point.  Resolves #5125.
2020-01-22 16:43:25 +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
Thorsten von Eicken
6632dd3981 esp32/modmachine: Add implementation of machine.soft_reset(). 2020-01-12 13:38:45 +11:00
Damien George
99b8c1a937 esp32/Makefile: Assign result of $call to dummy var for older make.
Make version 4.1 and lower does not allow $call as the main expression on a
line, so assign the result of the $call to a dummy variable.

Fixes issue #5426.
2020-01-06 23:03:22 +11:00
Nicko van Someren
4c93955b7b py/objslice: Add support for indices() method on slice objects.
Instances of the slice class are passed to __getitem__() on objects when
the user indexes them with a slice.  In practice the majority of the time
(other than passing it on untouched) is to work out what the slice means in
the context of an array dimension of a particular length.  Since Python 2.3
there has been a method on the slice class, indices(), that takes a
dimension length and returns the real start, stop and step, accounting for
missing or negative values in the slice spec.  This commit implements such
a indices() method on the slice class.

It is configurable at compile-time via MICROPY_PY_BUILTINS_SLICE_INDICES,
disabled by default, enabled on unix, stm32 and esp32 ports.

This commit also adds new tests for slice indices and for slicing unicode
strings.
2019-12-28 23:55:15 +11:00
Damien George
d97b40bdaa py: Introduce MP_ROM_FALSE/MP_ROM_TRUE for ROM to refer to bool objects.
This helps to prevent mistakes, and allows easily changing the ROM value of
False/True if needed.
2019-12-27 22:54:20 +11:00
Damien George
09376f0e47 py: Introduce MP_ROM_NONE macro for ROM to refer to None object.
This helps to prevent mistakes, and allows easily changing the ROM value of
None if needed.
2019-12-27 22:51:17 +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
Matt Trentini
0e0e6132fd esp32/esp32_rmt: Add initial support for RMT peripheral.
This is an ESP32-specific peripheral so lives in the esp32 module.
2019-12-20 12:24:51 +11:00
Seon Rozenblum
0d82f5d8c8 esp32/boards/TINYPICO: Add tinypico.py, dotstar.py with custom manifest. 2019-12-19 10:05:01 +11:00
Damien George
b47e155bd0 py/persistentcode: Add ability to relocate loaded native code.
Implements text, rodata and bss generalised relocations, as well as generic
qstr-object linking.  This allows importing dynamic native modules on all
supported architectures in a unified way.
2019-12-12 20:15:28 +11:00
Andrew Leech
9ca8a503ed esp32/boards: Enable ULP in base sdk configuration.
Fixes issue #5159.
2019-12-05 15:28:56 +11:00
Josh Lloyd
1530fda9cf esp32/machine_rtc: Reduce memory footprint of user mem functionality. 2019-11-21 16:55:12 +11:00
Josh Lloyd
ed2314f35a esp32/machine_rtc: Make RTC.memory size and availability configurable.
The compile-time configuration value MICROPY_HW_RTC_USER_MEM_MAX can now be
used to define the amount of memory set aside for RTC.memory().  If this
value is configured to zero then the RTC.memory functionality is not
included in the build.
2019-11-21 16:55:12 +11:00
Josh Lloyd
82d358510b esp32/rtc: Set system microseconds when setting time via RTC.datetime(). 2019-11-13 13:46:33 +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
Damien George
799b6d1e0c extmod: Consolidate FAT FS config to MICROPY_VFS_FAT across all ports.
This commit removes the Makefile-level MICROPY_FATFS config and moves the
MICROPY_VFS_FAT config to the Makefile level to replace it.  It also moves
the include of the oofatfs source files in the build from each port to a
central place in extmod/extmod.mk.

For a port to enabled VFS FAT support it should now set MICROPY_VFS_FAT=1
at the level of the Makefile.  This will include the relevant oofatfs files
in the build and set MICROPY_VFS_FAT=1 at the C (preprocessor) level.
2019-11-11 11:37:38 +11:00
Damien George
4be316fb07 esp32/moduos: Enable uos.VfsLfs2 for littlefs filesystems.
This commit adds support for littlefs (v2) on all esp32 boards.

The original FAT filesystem still works and any board with a preexisting
FAT filesystem will still work as normal.  It's possible to switch to
littlefs by reformatting the block device using:

    import uos, flashbdev
    uos.VfsLfs2.mkfs(flashbdev.bdev)

Then when the board reboots (soft or hard) the new littlefs filesystem will
be mounted.  It's possible to switch back to a FAT filesystem by formatting
with uos.VfsFat.mkfs(flashbdev.bdev).
2019-11-06 12:16:00 +11:00
Damien George
d01ca7888b esp32/esp32_partition: Support extended block protocol. 2019-11-06 12:15:34 +11:00
Andreas Motl
d209f9ebe7 esp32: Remove unused "esponewire.c" in favour of extmod/modonewire. 2019-11-05 14:57:05 +11:00
Damien George
c13f9f209d all: Convert nlr_raise(mp_obj_new_exception_msg(x)) to mp_raise_msg(x).
This helper function was added a while ago and these are the remaining
cases to convert, to save a bit of code size.
2019-11-05 11:35:45 +11:00
Damien George
742030945c esp32/Makefile: Add correct arch to MPY_CROSS_FLAGS for native code. 2019-11-04 15:32:20 +11:00
Damien George
cfe1c5abf8 extmod/vfs: Rename BP_IOCTL_xxx constants to MP_BLOCKDEV_IOCTL_xxx.
Also rename SEC_COUNT to BLOCK_COUNT and SEC_SIZE to BLOCK_SIZE.
2019-10-29 14:17:29 +11:00
Mike Teachman
f301170c7c esp32/machine_hw_spi: Fix exception msg when host is already in use.
When a SPI bus is initialized with a SPI host that is currently in use the
exception msg incorrectly indicates "SPI device already in use".  The
mention of "device" in the exception msg is confusing because the error is
about trying to use a SPI host that is already claimed.  A better exception
msg is "SPI host already in use".
2019-10-23 13:31:13 +11:00
Jim Mussared
b02d7e612d extmod/modbluetooth: Rename module to "ubluetooth".
For consistency with "umachine". Now that weak links are enabled
by default for built-in modules, this should be a no-op, but allows
extension of the bluetooth module by user code.

Also move registration of ubluetooth to objmodule rather than
port-specific.
2019-10-22 21:58:05 +11:00
Damien George
d2384efa80 py: Automatically provide weak links from "foo" to "ufoo" module name.
This commit implements automatic module weak links for all built-in
modules, by searching for "ufoo" in the built-in module list if "foo"
cannot be found.  This means that all modules named "ufoo" are always
available as "foo".  Also, a port can no longer add any other weak links,
which makes strict the definition of a weak link.

It saves some code size (about 100-200 bytes) on ports that previously had
lots of weak links.

Some changes from the previous behaviour:
- It doesn't intern the non-u module names (eg "foo" is not interned),
  which saves code size, but will mean that "import foo" creates a new qstr
  (namely "foo") in RAM (unless the importing module is frozen).
- help('modules') no longer lists non-u module names, only the u-variants;
  this reduces duplication in the help listing.

Weak links are effectively the same as having a set of symbolic links on
the filesystem that is searched last.  So an "import foo" will search
built-in modules first, then all paths in sys.path, then weak links last,
importing "ufoo" if it exists.  Thus a file called "foo.py" somewhere in
sys.path will still have precedence over the weak link of "foo" to "ufoo".

See issues: #1740, #4449, #5229, #5241.
2019-10-22 15:30:52 +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
Jeremy Herbert
7a7ee16ccf esp32/machine_uart: Add ability to invert UART pins. 2019-10-18 12:05:16 +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
Damien George
d7a9388fe0 ports: Add new make target "submodules" which inits required modules. 2019-10-15 17:14:41 +11:00
Jim Mussared
d5cbee3cfb esp32: Add 4.x version of IDLE WDT config. 2019-10-11 14:30:47 +11:00
Jim Mussared
cd8bbf4cfc esp32/boards: Enable BLE by default when building with IDF 4.x. 2019-10-08 14:50:01 +11:00
Jim Mussared
6a9bd1c1ab esp32: Implement BLE using Nimble from IDF 4.x. 2019-10-08 14:50:01 +11:00
Damien George
917f027c0b esp32: Enable native emitter. 2019-10-05 13:45:25 +10:00
Jim Mussared
c33a4cc213 esp32/Makefile: Fix printing of supported git hash. 2019-09-20 14:37:53 +10:00
Jim Mussared
62d78e231c esp32/main: Use both 3.3 and 4.0 config vars to enable SPIRAM. 2019-09-18 15:49:45 +10:00
Jim Mussared
f469634c0c esp32: Add check to Makefile that the toolchain is in PATH. 2019-09-17 12:26:47 +10:00
Jim Mussared
970f798ea9 esp32: Add check to Makefile for pyparsing version. 2019-09-17 12:26:42 +10: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
Damien George
356a728bd0 esp32/Makefile: Add SDKCONFIG_H to QSTR_GLOBAL_REQUIREMENTS.
Fixes issue #5091.
2019-09-12 18:16:16 +10:00
Damien George
bd1d27f00f esp32/modules/inisetup.py: Use bdev.ioctl instead of bdev.SEC_SIZE.
Since the bdev is now a Partition it doesn't have SEC_SIZE.
2019-09-10 22:41:50 +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
31de44775c esp32: Add VFS FAT partition to partitions.csv and mount it as the FS.
This patch uses the newly-added esp32.Partition class to replace the
existing FlashBdev class.  Partition objects implement the block protocol
so can be directly mounted via uos.mount().  This has the following
benefits:

- allows the filesystem partition location and size to be specified in
  partitions.csv, and overridden by a particular board
- very easily allows to have multiple filesystems by simply adding extra
  entries to partitions.csv
- improves efficiency/speed of filesystem operations because the block
  device is implemented fully in C
- opens the possibility to have encrypted flash storage (since Partitions
  can be encrypted)

Note that this patch is fully backwards compatible: existing filesystems
remain untouched and work with this new code.
2019-09-10 15:14:13 +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
Braden Mars
5641aa55dd esp32: Update to use ESP IDF v3.3
Includes patches for CVE-2019-12586 & CVE-2019-12587
2019-09-07 01:28:11 -05:00
Damien George
983283a8cd esp32/machine_adc: Add ADC.read_u16() method. 2019-09-05 22:13:04 +10:00
Jim Mussared
50482cdc0c esp32/Makefile: Fix subst->patsubst in ESPIDF_BOOTLOADER_SUPPORT_O. 2019-09-03 23:21:50 +10:00
Eric Poulsen
5635b96461 esp32: Add 'config' function to network.LAN, reusing network.WLAN. 2019-08-28 13:11:48 +10:00
Damien George
05eb897d06 esp32: Add esp32.Partition class to expose partition and OTA funcs.
Partitions are exposed as a standard MicroPython block device.
2019-08-20 16:49:18 +10:00
stijn
af5c998f37 py/modmath: Implement math.isclose() for non-complex numbers.
As per PEP 485, this function appeared in for Python 3.5.  Configured via
MICROPY_PY_MATH_ISCLOSE which is disabled by default, but enabled for the
ports which already have MICROPY_PY_MATH_SPECIAL_FUNCTIONS enabled.
2019-08-17 23:23:17 +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
baeebc557c esp32/modules: On initial setup mount internal flash at root.
Like it's done on normal boot up.  Fixes issue #5004.
2019-08-15 22:03:09 +10:00
Damien George
2ccf030fd1 esp32: Add support for mDNS queries and responder.
They are both enabled by default, but can be disabled by defining
MICROPY_HW_ENABLE_MDNS_QUERIES and/or MICROPY_HW_ENABLE_MDNS_RESPONDER to
0.  The hostname for the responder is currently taken from
tcpip_adapter_get_hostname() but should eventually be configurable.
2019-08-15 16:36:47 +10:00
Kenta IDA
b6906fa573 esp32/network_ppp: Add authentication support to the PPP interface.
This commit adds the connect() method to the PPP interface and requires
that connect() be called after active(1).  This is a breaking change for
the PPP API.

With the connect() method it's now possible to pass in authentication
information for PAP/CHAP, eg:

    ppp.active(1)
    ppp.connect(authmode=ppp.AUTH_PAP, username="user", "password="password")

If no authentication is needed simply call connect() without any
parameters.  This will get the original behaviour of calling active(1).
2019-08-14 17:20:58 +10:00
Damien George
7c15e50eb8 esp32/Makefile: Include CFLAGS_EXTRA in CFLAGS definition.
Following other ports, so builds can be customised more easily, eg on the
command line building with a user C-module.
2019-07-30 17:31:23 +10:00
Amir Gonnen
995f9cfdfc esp32: Pin MicroPython tasks to a specific core.
On this port the GIL is enabled and everything works under the assumption
of the GIL, ie that a given task has exclusive access to the uPy state, and
any ISRs interrupt the current task and therefore the ISR inherits
exclusive access to the uPy state for the duration of its execution.

If the MicroPython tasks are not pinned to a specific core then an ISR may
be executed on a different core to the task, making it possible for the
main task and an ISR to execute in parallel, breaking the assumption of the
GIL.

The easiest and safest fix for this is to pin all MicroPython related code
to the same CPU core, as done by this patch.  Then any ISR that accesses
MicroPython state must be registered from a MicroPython task, to ensure it
is invoked on the same core.

See issue #4895.
2019-07-25 15:33:47 +10:00
Damien George
e3e7e3a781 esp32/Makefile: Simplify include of IDF source by using wildcards. 2019-07-20 14:07:18 +10:00
Damien George
b88e51d718 esp32/Makefile: Put OBJ and LIB rule additions in gen_espidf_lib_rule. 2019-07-20 13:04:55 +10:00
Jim Mussared
331c224e07 esp32/Makefile: Fix path expansion for ESPIDF_DRIVER_O.
It was using subst to s/.c/.o/ which changed .c anywhere in the path.
2019-07-20 12:32:43 +10:00
Damien George
a29334761d esp32: Add support for hardware I2C. 2019-07-19 16:31:25 +10:00
Eric Poulsen
fa5c0b819c esp32/network_ppp: Add ppp_set_usepeerdns(pcb, 1) when init'ing iface.
Without this you often don't get any DNS server from your network provider.
Additionally, setting your own DNS _does not work_ without this option set
(which could be a bug in the PPP stack).
2019-07-04 11:17:41 +10:00
Damien George
c80614dfc8 ports: Provide mp_hal_stdio_poll for sys.stdio polling where needed. 2019-07-01 17:10:12 +10:00
Josh Lloyd
2f262d5f9a esp32/Makefile: Include all driver/*.c source files in the build.
Fixes #4869.
2019-06-25 15:12:34 +10:00
Damien George
b80bccccff esp32/modnetwork: Still try to reconnect to WLAN even with AUTH_FAIL.
WIFI_REASON_AUTH_FAIL does not necessarily mean the password is wrong, and
a wrong password may not lead to a WIFI_REASON_AUTH_FAIL error code.  So to
improve reliability connecting to a WLAN always reconnect regardless of the
error.
2019-06-22 21:50:49 +10:00
Damien George
3ee3995be1 esp32: Update to use ESP IDF v3.3-beta3.
This updates ESP IDF to use v3.3-beta3.  And also adjusts README.md to
point to stable docs which provide a link to download the correct toolchain
for this IDF version, namely 1.22.0-80-g6c4433a-5.2.0
2019-06-19 14:32:15 +10:00
Nicko van Someren
1a51fc9ddf esp32/machine_sdcard: Fix bug in SPI slot number selection.
And fix minor typo in docs when referring to SDCard class.
2019-06-17 12:36:22 +10:00
Nicko van Someren
8e3af7d4c8 esp32: Add machine.SDCard class using built-in HW SD/MMC controller.
This adds support for SD cards using the ESP32's built-in hardware SD/MMC
host controller, over either the SDIO bus or SPI.  The class is available
as machine.SDCard and using it can be as simple as:

    uos.mount(machine.SDCard(), '/sd')
2019-06-03 00:37:41 +10:00
Martin Dybdal
de76f73d34 esp32/machine_timer: Reuse Timer handles, deallocate only on soft-reset.
The patch solves the problem where multiple Timer objects (e.g. multiple
Timer(0) instances) could initialise multiple handles to the same internal
timer.  The list of timers is now maintained not for "active" timers (where
init is called), but for all timers created.  The timers are only removed
from the list of timers on soft-reset (machine_timer_deinit_all).

Fixes #4078.
2019-05-31 14:55:07 +10:00
Damien George
883e987b90 esp32/modsocket: Raise EAGAIN when accept fails in non-blocking mode.
EAGAIN should be for pure non-blocking mode and ETIMEDOUT for when there is
a finite (but non-zero) timeout enabled.
2019-05-28 17:43:00 +10:00
Tom Manning
887a6712c2 esp32/machine_touchpad: Use HW timer for FSM to enable wake-on-touch. 2019-05-28 11:14:34 +10:00
Damien George
0557f0b74b esp32/network_ppp: Add a timeout for closing PPP connection.
This also fixes deleting the PPP task, since eTaskGetState() never returns
eDeleted.

A limitation with this patch: once the PPP is deactivated (ppp.active(0))
it cannot be used again. A new PPP instance must be created instead.
2019-05-17 17:14:45 +10:00
Damien George
2630d3e51f esp32/machine_uart: Implement UART.deinit() method. 2019-05-15 17:01:54 +10:00
Damien George
8586afa6f5 esp32/modnetwork: Change type to size_t for uses of mp_obj_str_get_data. 2019-05-13 12:39:03 +10:00
Krono
fbd4e61e57 esp32/machine_wdt: Add timeout arg to select interval, make WDT panic.
The machine.WDT() now accepts the "timeout" keyword argument to select the
WDT interval.  And the WDT is changed to panic mode which means it will
reset the device if the interval expires (instead of just printing an error
message).
2019-04-30 16:53:05 +10:00