micropython/ports/embed
Christian Walther 3a8f8db38d ports/embed: Enable use of littlefs.
To make use of it, as demonstrated in the embedding-full example:
- Include the word(s) "littlefs1" and/or "littlefs2" in EMBED_EXTRA in
  micropython_embed.mk.
- Enable the desired MICROPY_*VFS* features in mpconfigport.h.
- Add include path "$(EMBED_DIR)/lib/littlefs" to your application build
  system.

For demonstration, a block device implementation containing a small
read-only littlefs2 image is added to the embedding-full example. The block
device could have been written in C and interface to some external,
possibly writable storage medium, but was written in Python and frozen for
simplicity.

What makes this a bit awkward is the fact that the littlefs sources are
located in lib/ and do need to be compiled into the application, unlike all
previous .c files from lib/ that are #included by other C files and must
not be compiled separately. Therefore, introduce a new directory 'libsrc'
in the embed build output that contains these files and can be added to the
application build system as usual, while 'lib' can remain excluded. The
headers need to stay in 'lib' because vfs_lfs.c refers to them under that
path. I am also not entirely happy about having to add an additional
include path to the application build, but see no way around that as long
as vfs_lfs.c refers to "lib/littlefs/lfs2.h" while lfs2.c refers to
"lfs2.h".

Signed-off-by: Christian Walther <cwalther@gmx.ch>
2024-04-21 17:28:52 +02:00
..
port ports/embed: Enable use of extmod modules. 2024-04-21 17:28:52 +02:00
README.md
embed.mk ports/embed: Enable use of littlefs. 2024-04-21 17:28:52 +02:00

README.md

MicroPython embed port

This is a port of MicroPython that outputs a set of .c and .h files for embedding into a wider project. This port essentially targets the C language, instead of a particular hardware architecture or platform.

To use this port in a project there are three main steps:

  1. Provide configuration for the project via an mpconfigport.h file.

  2. Build this embed port against that configuration, using the provided embed.mk. The output is a set of self-contained source files for building MicroPython. These files can be placed outside this repository.

  3. Build the project. This requires compiling all .c files from the above step.

See examples/embedding for an example.