Skip to content

Commit d4e1820

Browse files
DanielOdpgeorge
authored andcommitted
docs/cmodules: Note the various ways MODULE_EXAMPLE_ENABLED can be set.
1 parent a6e5846 commit d4e1820

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

docs/develop/cmodules.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,19 @@ Directory::
117117
# This is not actually needed in this example.
118118
CFLAGS_USERMOD += -I$(EXAMPLE_MOD_DIR)
119119
120-
Finally you will need to modify the ``mpconfigboard.h`` for your board
121-
to tell the build process to include the new module by adding the
122-
following
120+
Finally you will need to define ``MODULE_EXAMPLE_ENABLED`` to 1. This
121+
can be done by adding ``CFLAGS_EXTRA=-DMODULE_EXAMPLE_ENABLED=1`` to
122+
the ``make`` command, or editing ``mpconfigport.h`` or
123+
``mpconfigboard.h`` to add
123124

124125
.. code-block:: c
125126
126127
#define MODULE_EXAMPLE_ENABLED (1)
127128
129+
Note that the exact method depends on the port as they have different
130+
structures. If not done correctly it will compile but importing will
131+
fail to find the module.
132+
128133

129134
Compiling the cmodule into MicroPython
130135
--------------------------------------
@@ -152,7 +157,7 @@ Building for stm32 port:
152157
.. code-block:: bash
153158
154159
cd my_project/micropython/ports/stm32
155-
make USER_C_MODULES=../../../modules all
160+
make USER_C_MODULES=../../../modules CFLAGS_EXTRA=-DMODULE_EXAMPLE_ENABLED=1 all
156161
157162
158163
Module usage in MicroPython

0 commit comments

Comments
 (0)