Skip to content

Building a firmware with asyncio included #1273

@DrTom

Description

@DrTom

We want to build a firmware with the asyncio module from micropython included.

To that end we created a symlink from bricks/_common/modules/uasyncio to ../../../micropython/extmod/uasyncio and adjusted manifest.py by adding include("./modules/uasyncio"). We used this approach because the autodetection in manifest.py does not work for files in directories and and the directive ("$(MPY_DIR)/extmod/uasyncio") from the original micropython seems not to work. It says MPY_DIR is not set.

When we compile the firmware we can see the following in the log:

Including foo as a module.
MPY uasyncio/__init__.py
MPY uasyncio/core.py
MPY uasyncio/event.py
MPY uasyncio/funcs.py
MPY uasyncio/lock.py
MPY uasyncio/stream.py
MPY foo.py
GEN build/frozen_content.c

so far so goo. foo.py ist just for testing to see if that works.

Now, when running the firmware using foo works:

>>> import foo
>>> print(foo.PI)
3.14

however, when trying to import (u)asyncio we get an ImportError.

>>> import asyncio
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'asyncio'
>>> import uasyncio
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'uasyncio'

What do we need to do to build asyncio (or for that matter any other micropython library) into the firmware?

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportRequest for technical support for a problem that is not a bug or feature requesttopic: multitaskingIssues releated to parallel threads, tasks, coroutines, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions