Skip to content

Commit 066243e

Browse files
george-hopkinsdpgeorge
authored andcommitted
py/py.mk: Add SRC_USERMOD_LIB_ASM to include assembly files.
Introduce SRC_USERMOD_LIB_ASM to allow users to include assembly files as part of their user modules. It could be used to include optimized functions or outputs of other programming languages. Signed-off-by: George Hopkins <george-hopkins@null.net>
1 parent 1754c58 commit 066243e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

docs/develop/cmodules.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ A MicroPython user C module is a directory with the following files:
5959
SRC_USERMOD_LIB_C += $(EXAMPLE_MOD_DIR)/utils/algorithm.c
6060

6161
Similarly, use ``SRC_USERMOD_CXX`` and ``SRC_USERMOD_LIB_CXX`` for C++
62-
source files.
62+
source files. If you want to include assembly files use ``SRC_USERMOD_LIB_ASM``.
6363

6464
If you have custom compiler options (like ``-I`` to add directories to search
6565
for header files), these should be added to ``CFLAGS_USERMOD`` for C code

py/py.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ ifneq ($(USER_C_MODULES),)
3636
# C/C++ files that are included in the QSTR/module build
3737
SRC_USERMOD_C :=
3838
SRC_USERMOD_CXX :=
39-
# Other C/C++ files (e.g. libraries or helpers)
39+
# Other C/C++/Assembly files (e.g. libraries or helpers)
4040
SRC_USERMOD_LIB_C :=
4141
SRC_USERMOD_LIB_CXX :=
42+
SRC_USERMOD_LIB_ASM :=
4243
# Optionally set flags
4344
CFLAGS_USERMOD :=
4445
CXXFLAGS_USERMOD :=
@@ -60,6 +61,7 @@ SRC_USERMOD_PATHFIX_C += $(patsubst $(USER_C_MODULES)/%.c,%.c,$(SRC_USERMOD_C))
6061
SRC_USERMOD_PATHFIX_CXX += $(patsubst $(USER_C_MODULES)/%.cpp,%.cpp,$(SRC_USERMOD_CXX))
6162
SRC_USERMOD_PATHFIX_LIB_C += $(patsubst $(USER_C_MODULES)/%.c,%.c,$(SRC_USERMOD_LIB_C))
6263
SRC_USERMOD_PATHFIX_LIB_CXX += $(patsubst $(USER_C_MODULES)/%.cpp,%.cpp,$(SRC_USERMOD_LIB_CXX))
64+
SRC_USERMOD_PATHFIX_LIB_ASM += $(patsubst $(USER_C_MODULES)/%.S,%.S,$(SRC_USERMOD_LIB_ASM))
6365

6466
CFLAGS += $(CFLAGS_USERMOD)
6567
CXXFLAGS += $(CXXFLAGS_USERMOD)
@@ -70,6 +72,7 @@ PY_O += $(addprefix $(BUILD)/, $(SRC_USERMOD_PATHFIX_C:.c=.o))
7072
PY_O += $(addprefix $(BUILD)/, $(SRC_USERMOD_PATHFIX_CXX:.cpp=.o))
7173
PY_O += $(addprefix $(BUILD)/, $(SRC_USERMOD_PATHFIX_LIB_C:.c=.o))
7274
PY_O += $(addprefix $(BUILD)/, $(SRC_USERMOD_PATHFIX_LIB_CXX:.cpp=.o))
75+
PY_O += $(addprefix $(BUILD)/, $(SRC_USERMOD_PATHFIX_LIB_ASM:.S=.o))
7376
endif
7477

7578
# py object files

0 commit comments

Comments
 (0)