Merge pull request #1431 from openmv/user_c_modules

User c modules
This commit is contained in:
Ibrahim Abd Elkader 2021-08-11 23:36:14 +02:00 committed by GitHub
commit 6cf60e1bfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 117 additions and 63 deletions

3
.gitmodules vendored
View File

@ -2,3 +2,6 @@
path = src/micropython path = src/micropython
url = https://github.com/openmv/micropython.git url = https://github.com/openmv/micropython.git
branch = openmv branch = openmv
[submodule "src/omv/modules/ulab"]
path = src/omv/modules/ulab
url = https://github.com/v923z/micropython-ulab.git

View File

@ -103,7 +103,7 @@ OMV_SRC_QSTR := $(wildcard $(TOP_DIR)/$(OMV_DIR)/modules/*.c)
OMV_SRC_QSTR += $(wildcard $(TOP_DIR)/$(OMV_DIR)/ports/$(PORT)/modules/*.c) OMV_SRC_QSTR += $(wildcard $(TOP_DIR)/$(OMV_DIR)/ports/$(PORT)/modules/*.c)
# The following command line args are passed to MicroPython's top Makefile. # The following command line args are passed to MicroPython's top Makefile.
MICROPY_ARGS = PORT=$(PORT) BOARD=$(TARGET) DEBUG=$(DEBUG) OMV_SRC_QSTR="$(OMV_SRC_QSTR)" MPY_LIB_DIR=$(MPY_LIB_DIR) MICROPY_ROM_TEXT_COMPRESSION=$(ROM_TEXT_COMPRESSION) MICROPY_ARGS = PORT=$(PORT) BOARD=$(TARGET) DEBUG=$(DEBUG) MPY_LIB_DIR=$(MPY_LIB_DIR) MICROPY_ROM_TEXT_COMPRESSION=$(ROM_TEXT_COMPRESSION) USER_C_MODULES=$(TOP_DIR)/$(OMV_DIR) #OMV_SRC_QSTR="$(OMV_SRC_QSTR)"
# Configure additional built-in modules. Note must define both the CFLAGS and the Make command line args. # Configure additional built-in modules. Note must define both the CFLAGS and the Make command line args.
ifeq ($(MICROPY_PY_SENSOR), 1) ifeq ($(MICROPY_PY_SENSOR), 1)
@ -173,6 +173,11 @@ MPY_CFLAGS += -DMICROPY_PY_BUZZER=1
MICROPY_ARGS += MICROPY_PY_BUZZER=1 MICROPY_ARGS += MICROPY_PY_BUZZER=1
endif endif
ifeq ($(CUBEAI), 1)
MPY_CFLAGS += -DMICROPY_PY_CUBEAI=1
MICROPY_ARGS += MICROPY_PY_CUBEAI=1
endif
# Include the port Makefile. # Include the port Makefile.
include $(OMV_DIR)/ports/$(PORT)/omv_portconfig.mk include $(OMV_DIR)/ports/$(PORT)/omv_portconfig.mk

@ -1 +1 @@
Subproject commit 97e320cdb9d7a209821a039491a9df5ad060e121 Subproject commit f012171f306999509668e8b40cad7cfb50de5652

View File

@ -41,19 +41,6 @@ SRCS += $(addprefix sensors/, \
paj6100.c \ paj6100.c \
) )
SRCS += $(addprefix modules/, \
py_clock.c \
py_gif.c \
py_helper.c \
py_image.c \
py_imageio.c \
py_mjpeg.c \
py_omv.c \
py_sensor.c \
py_tf.c \
py_fir.c \
)
SRCS += $(addprefix imlib/, \ SRCS += $(addprefix imlib/, \
agast.c \ agast.c \
apriltag.c \ apriltag.c \
@ -108,7 +95,6 @@ SRCS += $(addprefix imlib/, \
) )
SRCS += $(wildcard ports/$(PORT)/*.c) SRCS += $(wildcard ports/$(PORT)/*.c)
SRCS += $(wildcard ports/$(PORT)/modules/*.c)
OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o))
OBJ_DIRS = $(sort $(dir $(OBJS))) OBJ_DIRS = $(sort $(dir $(OBJS)))

View File

@ -29,6 +29,12 @@
#include "imlib_config.h" #include "imlib_config.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"
#ifndef M_PI
#define M_PI 3.14159265f
#define M_PI_2 1.57079632f
#define M_PI_4 0.78539816f
#endif
#define IM_LOG2_2(x) (((x) & 0x2ULL) ? ( 2 ) : 1) // NO ({ ... }) ! #define IM_LOG2_2(x) (((x) & 0x2ULL) ? ( 2 ) : 1) // NO ({ ... }) !
#define IM_LOG2_4(x) (((x) & 0xCULL) ? ( 2 + IM_LOG2_2((x) >> 2)) : IM_LOG2_2(x)) // NO ({ ... }) ! #define IM_LOG2_4(x) (((x) & 0xCULL) ? ( 2 + IM_LOG2_2((x) >> 2)) : IM_LOG2_2(x)) // NO ({ ... }) !
#define IM_LOG2_8(x) (((x) & 0xF0ULL) ? ( 4 + IM_LOG2_4((x) >> 4)) : IM_LOG2_4(x)) // NO ({ ... }) ! #define IM_LOG2_8(x) (((x) & 0xF0ULL) ? ( 4 + IM_LOG2_4((x) >> 4)) : IM_LOG2_4(x)) // NO ({ ... }) !

View File

@ -0,0 +1,36 @@
// Include MicroPython API.
#include "py/runtime.h"
// This is the function which will be called from Python as cexample.add_ints(a, b).
STATIC mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) {
// Extract the ints from the micropython input objects.
int a = mp_obj_get_int(a_obj);
int b = mp_obj_get_int(b_obj);
// Calculate the addition and convert to MicroPython object.
return mp_obj_new_int(a + b);
}
// Define a Python reference to the function above.
STATIC MP_DEFINE_CONST_FUN_OBJ_2(example_add_ints_obj, example_add_ints);
// Define all properties of the module.
// Table entries are key/value pairs of the attribute name (a string)
// and the MicroPython object reference.
// All identifiers and strings are written as MP_QSTR_xxx and will be
// optimized to word-sized integers by the build system (interned strings).
STATIC const mp_rom_map_elem_t example_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cexample) },
{ MP_ROM_QSTR(MP_QSTR_add_ints), MP_ROM_PTR(&example_add_ints_obj) },
};
STATIC MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table);
// Define module object.
const mp_obj_module_t example_user_cmodule = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&example_module_globals,
};
// Register the module to make it available in Python.
// Note: This module is disabled, set the thrid argument to 1 to enable it, or
// use a macro like MODULE_CEXAMPLE_ENABLED to conditionally enable this module.
MP_REGISTER_MODULE(MP_QSTR_cexample, example_user_cmodule, 0);

View File

@ -0,0 +1,23 @@
OMV_MOD_DIR := $(USERMOD_DIR)
OMV_PORT_MOD_DIR := $(OMV_MOD_DIR)/../ports/$(PORT)/modules
# Add OpenMV common modules.
SRC_USERMOD += $(wildcard $(OMV_MOD_DIR)/*.c)
# Add OpenMV port-specific modules.
SRC_USERMOD += $(wildcard $(OMV_PORT_MOD_DIR)/*.c)
# Extra module flags.
CFLAGS_USERMOD += -I$(OMV_MOD_DIR) -I$(OMV_PORT_MOD_DIR) -Wno-float-conversion
# Add CubeAI module if enabled.
ifeq ($(MICROPY_PY_CUBEAI), 1)
SRC_USERMOD += $(OMV_MOD_DIR)/../../stm32cubeai/py_st_nn.c
endif
ifeq ($(MICROPY_PY_ULAB), 1)
# NOTE: overrides USERMOD_DIR
# Workaround to build and link ulab.
USERMOD_DIR := $(USERMOD_DIR)/ulab/code
include $(USERMOD_DIR)/micropython.mk
endif

View File

@ -1265,3 +1265,5 @@ void py_fir_init0()
{ {
py_fir_deinit(); py_fir_deinit();
} }
MP_REGISTER_MODULE(MP_QSTR_fir, fir_module, 1);

View File

@ -155,3 +155,5 @@ const mp_obj_module_t gif_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
}; };
MP_REGISTER_MODULE(MP_QSTR_gif, gif_module, 1);

View File

@ -6951,3 +6951,5 @@ const mp_obj_module_t image_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.globals = (mp_obj_t) &globals_dict .globals = (mp_obj_t) &globals_dict
}; };
MP_REGISTER_MODULE(MP_QSTR_image, image_module, 1);

View File

@ -136,3 +136,5 @@ const mp_obj_module_t mjpeg_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
}; };
MP_REGISTER_MODULE(MP_QSTR_mjpeg, mjpeg_module, 1);

View File

@ -80,3 +80,5 @@ const mp_obj_module_t omv_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.globals = (mp_obj_t) &globals_dict, .globals = (mp_obj_t) &globals_dict,
}; };
MP_REGISTER_MODULE(MP_QSTR_omv, omv_module, 1);

View File

@ -1177,4 +1177,5 @@ const mp_obj_module_t sensor_module = {
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
}; };
MP_REGISTER_MODULE(MP_QSTR_sensor, sensor_module, MICROPY_PY_SENSOR);
#endif // MICROPY_PY_SENSOR #endif // MICROPY_PY_SENSOR

View File

@ -605,3 +605,5 @@ const mp_obj_module_t tf_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.globals = (mp_obj_t) &globals_dict .globals = (mp_obj_t) &globals_dict
}; };
MP_REGISTER_MODULE(MP_QSTR_tf, tf_module, 1);

1
src/omv/modules/ulab Submodule

@ -0,0 +1 @@
Subproject commit be9033384eb86a172ef35f6c7b562bc86f194d7d

View File

@ -194,4 +194,5 @@ const mp_obj_module_t audio_module = {
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
}; };
MP_REGISTER_MODULE(MP_QSTR_audio, audio_module, MICROPY_PY_AUDIO);
#endif //MICROPY_PY_AUDIO #endif //MICROPY_PY_AUDIO

View File

@ -122,19 +122,6 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/sensors/, \
hm01b0.o \ hm01b0.o \
) )
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/modules/, \
py_clock.o \
py_gif.o \
py_helper.o \
py_image.o \
py_imageio.o \
py_mjpeg.o \
py_omv.o \
py_sensor.o \
py_tf.o \
py_fir.o \
)
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/imlib/, \ FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/imlib/, \
agast.o \ agast.o \
apriltag.o \ apriltag.o \
@ -189,7 +176,8 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/imlib/, \
) )
FIRM_OBJ += $(wildcard $(BUILD)/$(OMV_DIR)/ports/$(PORT)/*.o) FIRM_OBJ += $(wildcard $(BUILD)/$(OMV_DIR)/ports/$(PORT)/*.o)
FIRM_OBJ += $(wildcard $(BUILD)/$(OMV_DIR)/ports/$(PORT)/modules/*.o) FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/modules/*.o)
FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/ports/$(PORT)/modules/*.o)
#------------- MicroPy Objects -------------------# #------------- MicroPy Objects -------------------#
FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/py/*.o) FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/py/*.o)
@ -300,7 +288,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/,\
) )
ifeq ($(MICROPY_PY_ULAB), 1) ifeq ($(MICROPY_PY_ULAB), 1)
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/ulab/,\ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/,\
code/scipy/optimize/optimize.o \ code/scipy/optimize/optimize.o \
code/scipy/signal/signal.o \ code/scipy/signal/signal.o \
code/scipy/special/special.o \ code/scipy/special/special.o \

View File

@ -204,4 +204,5 @@ const mp_obj_module_t audio_module = {
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
}; };
MP_REGISTER_MODULE(MP_QSTR_audio, audio_module, MICROPY_PY_AUDIO);
#endif //MICROPY_PY_AUDIO #endif //MICROPY_PY_AUDIO

View File

@ -85,6 +85,8 @@ target_include_directories(${MICROPY_TARGET} PRIVATE
${OMV_BOARD_CONFIG_DIR} ${OMV_BOARD_CONFIG_DIR}
) )
file(GLOB OMV_USER_MODULES ${TOP_DIR}/${OMV_DIR}/modules/*.c)
target_sources(${MICROPY_TARGET} PRIVATE target_sources(${MICROPY_TARGET} PRIVATE
${TOP_DIR}/${OMV_DIR}/alloc/xalloc.c ${TOP_DIR}/${OMV_DIR}/alloc/xalloc.c
${TOP_DIR}/${OMV_DIR}/alloc/fb_alloc.c ${TOP_DIR}/${OMV_DIR}/alloc/fb_alloc.c
@ -113,17 +115,6 @@ target_sources(${MICROPY_TARGET} PRIVATE
${TOP_DIR}/${OMV_DIR}/sensors/hm01b0.c ${TOP_DIR}/${OMV_DIR}/sensors/hm01b0.c
${TOP_DIR}/${OMV_DIR}/sensors/gc2145.c ${TOP_DIR}/${OMV_DIR}/sensors/gc2145.c
${TOP_DIR}/${OMV_DIR}/modules/py_clock.c
${TOP_DIR}/${OMV_DIR}/modules/py_gif.c
${TOP_DIR}/${OMV_DIR}/modules/py_helper.c
${TOP_DIR}/${OMV_DIR}/modules/py_image.c
${TOP_DIR}/${OMV_DIR}/modules/py_imageio.c
${TOP_DIR}/${OMV_DIR}/modules/py_mjpeg.c
${TOP_DIR}/${OMV_DIR}/modules/py_omv.c
${TOP_DIR}/${OMV_DIR}/modules/py_sensor.c
${TOP_DIR}/${OMV_DIR}/modules/py_tf.c
${TOP_DIR}/${OMV_DIR}/modules/py_fir.c
${TOP_DIR}/${OMV_DIR}/imlib/agast.c ${TOP_DIR}/${OMV_DIR}/imlib/agast.c
${TOP_DIR}/${OMV_DIR}/imlib/apriltag.c ${TOP_DIR}/${OMV_DIR}/imlib/apriltag.c
${TOP_DIR}/${OMV_DIR}/imlib/bayer.c ${TOP_DIR}/${OMV_DIR}/imlib/bayer.c
@ -178,6 +169,8 @@ target_sources(${MICROPY_TARGET} PRIVATE
${TOP_DIR}/${OMV_DIR}/ports/${PORT}/main.c ${TOP_DIR}/${OMV_DIR}/ports/${PORT}/main.c
${TOP_DIR}/${OMV_DIR}/ports/${PORT}/cambus.c ${TOP_DIR}/${OMV_DIR}/ports/${PORT}/cambus.c
${TOP_DIR}/${OMV_DIR}/ports/${PORT}/sensor.c ${TOP_DIR}/${OMV_DIR}/ports/${PORT}/sensor.c
${OMV_USER_MODULES}
) )
if(MICROPY_PY_SENSOR) if(MICROPY_PY_SENSOR)
@ -214,7 +207,7 @@ if(MICROPY_PY_AUDIO)
endif() endif()
if(MICROPY_PY_ULAB) if(MICROPY_PY_ULAB)
set(MICROPY_ULAB_DIR "${MICROPY_DIR}/extmod/ulab") set(MICROPY_ULAB_DIR "${TOP_DIR}/${OMV_DIR}/modules/ulab")
target_include_directories(${MICROPY_TARGET} PRIVATE target_include_directories(${MICROPY_TARGET} PRIVATE
${MICROPY_ULAB_DIR}/code/ ${MICROPY_ULAB_DIR}/code/
@ -249,6 +242,7 @@ if(MICROPY_PY_ULAB)
target_compile_definitions(${MICROPY_TARGET} PRIVATE target_compile_definitions(${MICROPY_TARGET} PRIVATE
MICROPY_PY_ULAB=1 MICROPY_PY_ULAB=1
MODULE_ULAB_ENABLED=1
ULAB_CONFIG_FILE="${OMV_BOARD_CONFIG_DIR}/ulab_config.h" ULAB_CONFIG_FILE="${OMV_BOARD_CONFIG_DIR}/ulab_config.h"
) )
endif() endif()

View File

@ -14,7 +14,8 @@ export TOP_DIR
export CC= export CC=
export CXX= export CXX=
MICROPY_ARGS += BOARD=$(TARGET) BUILD=$(BUILD)/rp2 OMV_CMAKE=$(TOP_DIR)/$(OMV_DIR)/ports/$(PORT)/omv_portconfig.cmake # Note this overrides USER_C_MODULES.
MICROPY_ARGS += BOARD=$(TARGET) BUILD=$(BUILD)/rp2 OMV_CMAKE=$(TOP_DIR)/$(OMV_DIR)/ports/$(PORT)/omv_portconfig.cmake USER_C_MODULES=""
################################################### ###################################################
all: $(OPENMV) all: $(OPENMV)

View File

@ -373,4 +373,5 @@ const mp_obj_module_t audio_module = {
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
}; };
MP_REGISTER_MODULE(MP_QSTR_audio, audio_module, MICROPY_PY_AUDIO);
#endif //MICROPY_PY_AUDIO #endif //MICROPY_PY_AUDIO

View File

@ -109,4 +109,5 @@ void py_buzzer_init0()
buzzer_setup(OMV_BUZZER_FREQ, 0); buzzer_setup(OMV_BUZZER_FREQ, 0);
} }
MP_REGISTER_MODULE(MP_QSTR_buzzer, buzzer_module, MICROPY_PY_BUZZER);
#endif // MICROPY_PY_BUZZER #endif // MICROPY_PY_BUZZER

View File

@ -251,3 +251,5 @@ const mp_obj_module_t cpufreq_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.globals = (mp_obj_t)&globals_dict, .globals = (mp_obj_t)&globals_dict,
}; };
MP_REGISTER_MODULE(MP_QSTR_cpufreq, cpufreq_module, 1);

View File

@ -281,4 +281,6 @@ float py_imu_pitch_rotation()
return py_imu_get_pitch(); return py_imu_get_pitch();
} }
MP_REGISTER_MODULE(MP_QSTR_imu, imu_module, MICROPY_PY_IMU);
#endif // MICROPY_PY_IMU #endif // MICROPY_PY_IMU

View File

@ -1839,4 +1839,5 @@ void py_lcd_init0()
py_lcd_deinit(); py_lcd_deinit();
} }
MP_REGISTER_MODULE(MP_QSTR_lcd, lcd_module, MICROPY_PY_LCD);
#endif // MICROPY_PY_LCD #endif // MICROPY_PY_LCD

View File

@ -270,4 +270,6 @@ const mp_obj_module_t micro_speech_module = {
.base = { &mp_type_module }, .base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&module_globals, .globals = (mp_obj_dict_t*)&module_globals,
}; };
MP_REGISTER_MODULE(MP_QSTR_micro_speech, micro_speech_module, MICROPY_PY_MICRO_SPEECH);
#endif //MICROPY_PY_MICRO_SPEECH #endif //MICROPY_PY_MICRO_SPEECH

View File

@ -1108,4 +1108,5 @@ void py_tv_init0()
py_tv_deinit(); py_tv_deinit();
} }
MP_REGISTER_MODULE(MP_QSTR_tv, tv_module, MICROPY_PY_TV);
#endif // MICROPY_PY_TV #endif // MICROPY_PY_TV

View File

@ -156,19 +156,6 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/sensors/, \
paj6100.o \ paj6100.o \
) )
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/modules/, \
py_clock.o \
py_gif.o \
py_helper.o \
py_image.o \
py_imageio.o \
py_mjpeg.o \
py_omv.o \
py_sensor.o \
py_tf.o \
py_fir.o \
)
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/imlib/, \ FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/imlib/, \
agast.o \ agast.o \
apriltag.o \ apriltag.o \
@ -223,7 +210,8 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/imlib/, \
) )
FIRM_OBJ += $(wildcard $(BUILD)/$(OMV_DIR)/ports/$(PORT)/*.o) FIRM_OBJ += $(wildcard $(BUILD)/$(OMV_DIR)/ports/$(PORT)/*.o)
FIRM_OBJ += $(wildcard $(BUILD)/$(OMV_DIR)/ports/$(PORT)/modules/*.o) FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/modules/*.o)
FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/ports/$(PORT)/modules/*.o)
#------------- MicroPy Objects -------------------# #------------- MicroPy Objects -------------------#
FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/py/*.o) FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/py/*.o)
@ -404,7 +392,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/drivers/,\
) )
ifeq ($(MICROPY_PY_ULAB), 1) ifeq ($(MICROPY_PY_ULAB), 1)
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/ulab/,\ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/,\
code/scipy/optimize/optimize.o \ code/scipy/optimize/optimize.o \
code/scipy/signal/signal.o \ code/scipy/signal/signal.o \
code/scipy/special/special.o \ code/scipy/special/special.o \

View File

@ -10,10 +10,6 @@ CFLAGS += -I$(TOP_DIR)/stm32cubeai/
CFLAGS += -I$(TOP_DIR)/stm32cubeai/data/ CFLAGS += -I$(TOP_DIR)/stm32cubeai/data/
CFLAGS += -I$(TOP_DIR)/stm32cubeai/AI/Inc/ CFLAGS += -I$(TOP_DIR)/stm32cubeai/AI/Inc/
# Append to OMV_QSTR_DEFS
OMV_SRC_QSTR += $(TOP_DIR)/stm32cubeai/py_st_nn.c
FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/BasicMathFunctions/*.o) FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/BasicMathFunctions/*.o)
FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/SupportFunctions/*.o) FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/SupportFunctions/*.o)
FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/MatrixFunctions/*.o) FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/MatrixFunctions/*.o)

View File

@ -92,3 +92,5 @@ STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table);
/* Create nn_st_module module + add ref to it in mpconfigport.h file */ /* Create nn_st_module module + add ref to it in mpconfigport.h file */
const mp_obj_module_t nn_st_module = {.base = {&mp_type_module}, const mp_obj_module_t nn_st_module = {.base = {&mp_type_module},
.globals = (mp_obj_t)&globals_dict}; .globals = (mp_obj_t)&globals_dict};
MP_REGISTER_MODULE(MP_QSTR_nn_st, nn_st_module, MICROPY_PY_CUBEAI);