From 4772ff2f27533c5db6d12c126f147f882f6982b1 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 12 Apr 2025 14:24:11 +0200 Subject: [PATCH] misc: Refactor Makefiles. Remove old Makefiles and replace with Makefile fragments. Signed-off-by: iabdalkader --- Makefile | 130 +++++---- drivers/lsm6dsm/Makefile => common/common.mk | 41 +-- common/export.mk | 96 ------- common/micropy.mk | 188 ++++++++++++ drivers/lsm6ds3/Makefile => common/mkrules.mk | 36 ++- drivers/dave2d/Makefile | 75 ----- drivers/display/Makefile | 40 --- drivers/drivers.mk | 268 ++++++++++++++++++ drivers/genx320/Makefile | 28 -- drivers/lepton/Makefile | 40 --- drivers/lsm6dsox/Makefile | 42 --- drivers/mlx90621/Makefile | 40 --- drivers/mlx90640/Makefile | 40 --- drivers/mlx90641/Makefile | 40 --- drivers/pixart/Makefile | 41 --- drivers/vl53l5cx/Makefile | 42 --- drivers/winc1500/Makefile | 41 --- lib/alif/{Makefile => alif.mk} | 42 ++- lib/cmsis/Makefile | 42 --- drivers/boson/Makefile => lib/cmsis/cmsis.mk | 41 ++- lib/imlib/imlib.mk | 88 ++++++ lib/mimxrt/MIMXRT1062/Makefile | 100 ------- lib/mimxrt/MIMXRT1064/Makefile | 98 ------- lib/mimxrt/mimxrt.mk | 166 +++++++++++ lib/nrfx/Makefile | 62 ---- lib/nrfx/nrfx.mk | 52 ++++ lib/stm32/f4/Makefile | 63 ---- lib/stm32/f7/Makefile | 66 ----- lib/stm32/h7/Makefile | 78 ----- lib/stm32/n6/Makefile | 132 --------- lib/stm32/stm32.mk | 263 +++++++++++++++++ lib/tflm/Makefile | 59 ---- lib/tflm/tflm.mk | 55 ++++ drivers/vl53l8cx/Makefile => ports/ports.mk | 23 +- 34 files changed, 1235 insertions(+), 1423 deletions(-) rename drivers/lsm6dsm/Makefile => common/common.mk (70%) delete mode 100644 common/export.mk create mode 100644 common/micropy.mk rename drivers/lsm6ds3/Makefile => common/mkrules.mk (61%) delete mode 100644 drivers/dave2d/Makefile delete mode 100644 drivers/display/Makefile create mode 100644 drivers/drivers.mk delete mode 100644 drivers/genx320/Makefile delete mode 100644 drivers/lepton/Makefile delete mode 100644 drivers/lsm6dsox/Makefile delete mode 100644 drivers/mlx90621/Makefile delete mode 100644 drivers/mlx90640/Makefile delete mode 100644 drivers/mlx90641/Makefile delete mode 100644 drivers/pixart/Makefile delete mode 100644 drivers/vl53l5cx/Makefile delete mode 100644 drivers/winc1500/Makefile rename lib/alif/{Makefile => alif.mk} (52%) delete mode 100644 lib/cmsis/Makefile rename drivers/boson/Makefile => lib/cmsis/cmsis.mk (63%) create mode 100644 lib/imlib/imlib.mk delete mode 100644 lib/mimxrt/MIMXRT1062/Makefile delete mode 100644 lib/mimxrt/MIMXRT1064/Makefile create mode 100644 lib/mimxrt/mimxrt.mk delete mode 100644 lib/nrfx/Makefile create mode 100644 lib/nrfx/nrfx.mk delete mode 100644 lib/stm32/f4/Makefile delete mode 100644 lib/stm32/f7/Makefile delete mode 100644 lib/stm32/h7/Makefile delete mode 100644 lib/stm32/n6/Makefile create mode 100644 lib/stm32/stm32.mk delete mode 100644 lib/tflm/Makefile create mode 100644 lib/tflm/tflm.mk rename drivers/vl53l8cx/Makefile => ports/ports.mk (75%) diff --git a/Makefile b/Makefile index c7cb115a9..0bab9e382 100755 --- a/Makefile +++ b/Makefile @@ -9,9 +9,9 @@ # Set verbosity ifeq ($(V), 1) -Q = +export Q = else -Q = @ +export Q = @ MAKEFLAGS += --silent endif @@ -19,31 +19,31 @@ endif LLVM_PATH ?=/opt/LLVM-ET-Arm-18.1.3-Linux-x86_64/bin/ # Commands -CC = $(Q)arm-none-eabi-gcc -CLANG = $(Q)$(LLVM_PATH)/clang -CXX = $(Q)arm-none-eabi-g++ -AS = $(Q)arm-none-eabi-as -LD = $(Q)arm-none-eabi-ld -AR = $(Q)arm-none-eabi-ar -RM = $(Q)rm -CPP = $(Q)arm-none-eabi-cpp -SIZE = $(Q)arm-none-eabi-size -STRIP = $(Q)arm-none-eabi-strip -s -OBJCOPY = $(Q)arm-none-eabi-objcopy -OBJDUMP = $(Q)arm-none-eabi-objdump -PYTHON = $(Q)python3 -MKDFU = $(MICROPY_DIR)/tools/dfu.py -PYDFU = $(Q)../tools/pydfu.py -MKDIR = $(Q)mkdir -ECHO = $(Q)@echo -MAKE = $(Q)make -CAT = $(Q)cat -TFLITE2C = tflite2c.py -MKROMFS = mkromfs.py +export CC = $(Q)arm-none-eabi-gcc +export CLANG = $(Q)$(LLVM_PATH)/clang +export CXX = $(Q)arm-none-eabi-g++ +export AS = $(Q)arm-none-eabi-as +export LD = $(Q)arm-none-eabi-ld +export AR = $(Q)arm-none-eabi-ar +export RM = $(Q)rm +export CPP = $(Q)arm-none-eabi-cpp +export SIZE = $(Q)arm-none-eabi-size +export STRIP = $(Q)arm-none-eabi-strip -s +export OBJCOPY = $(Q)arm-none-eabi-objcopy +export OBJDUMP = $(Q)arm-none-eabi-objdump +export PYTHON = $(Q)python3 +export MKDFU = $(MICROPY_DIR)/tools/dfu.py +export PYDFU = $(Q)tools/pydfu.py +export MKDIR = $(Q)mkdir +export ECHO = $(Q)@echo +export MAKE = $(Q)make +export CAT = $(Q)cat +export MKROMFS = mkromfs.py # Targets -OPENMV = openmv -FIRMWARE = firmware +export OPENMV ?= openmv +export FIRMWARE ?= firmware +export BOOTLOADER ?= bootloader # Jlink config JLINK_INTERFACE ?= swd @@ -59,40 +59,25 @@ ifeq ($(TARGET),) endif # Directories -TOP_DIR=$(shell pwd) -BUILD=$(TOP_DIR)/build -TOOLS=$(TOP_DIR)/../tools -FW_DIR=$(BUILD)/bin -OMV_DIR=omv -BOOT_DIR=boot -CUBEAI_DIR=stm32cubeai -CMSIS_DIR=hal/cmsis -MICROPY_DIR=lib/micropython -GENX320_DIR=drivers/genx320 -BOSON_DIR=drivers/boson -LEPTON_DIR=drivers/lepton -LSM6DS3_DIR=drivers/lsm6ds3 -LSM6DSM_DIR=drivers/lsm6dsm -LSM6DSOX_DIR=drivers/lsm6dsox -WINC1500_DIR=drivers/winc1500 -MLX90621_DIR=drivers/mlx90621 -MLX90640_DIR=drivers/mlx90640 -MLX90641_DIR=drivers/mlx90641 -VL53L5CX_DIR=drivers/vl53l5cx -VL53L8CX_DIR=drivers/vl53l8cx -PIXART_DIR=drivers/pixart -DISPLAY_DIR=drivers/display -DAVE2D_DIR=drivers/dave2d -NEMA_DIR=drivers/nema -LIBPDM_DIR=lib/libpdm -TENSORFLOW_DIR=lib/tflm -CYW4343_FW_DIR=drivers/cyw4343/firmware/ -OMV_BOARD_CONFIG_DIR=$(TOP_DIR)/$(OMV_DIR)/boards/$(TARGET)/ -OMV_PORT_DIR=$(TOP_DIR)/$(OMV_DIR)/ports/$(PORT) -MP_BOARD_CONFIG_DIR=$(TOP_DIR)/$(MICROPY_DIR)/ports/$(PORT)/boards/$(TARGET)/ -OMV_LIB_DIR=$(TOP_DIR)/../scripts/libraries -FROZEN_MANIFEST=$(OMV_BOARD_CONFIG_DIR)/manifest.py -OMV_COMMON_DIR=$(TOP_DIR)/$(OMV_DIR)/common +export TOP_DIR=$(shell pwd) +export BUILD=$(TOP_DIR)/build +export TOOLS_DIR=$(TOP_DIR)/tools +export FW_DIR=$(BUILD)/bin +export BOOT_DIR=boot +export PORTS_DIR=ports +export CUBEAI_DIR=cubeai +export CMSIS_DIR=lib/cmsis +export MICROPY_DIR=lib/micropython +export NEMA_DIR=drivers/nema +export LIBPDM_DIR=lib/libpdm +export TENSORFLOW_DIR=lib/tflm +export COMMON_DIR=common +export CYW4343_FW_DIR=drivers/cyw4343/firmware/ +export OMV_BOARD_CONFIG_DIR=$(TOP_DIR)/boards/$(TARGET)/ +export OMV_PORT_DIR=$(TOP_DIR)/ports/$(PORT) +export MP_BOARD_CONFIG_DIR=$(TOP_DIR)/$(MICROPY_DIR)/ports/$(PORT)/boards/$(TARGET)/ +export OMV_LIB_DIR=$(TOP_DIR)/scripts/libraries +export FROZEN_MANIFEST=$(OMV_BOARD_CONFIG_DIR)/manifest.py # Debugging/Optimization ifeq ($(DEBUG), 1) @@ -133,12 +118,12 @@ include $(OMV_BOARD_CONFIG_DIR)/omv_boardconfig.mk #include $(MP_BOARD_CONFIG_DIR)/mpconfigboard.mk # Additional qstr definitions for OpenMV -#OMV_SRC_QSTR := $(wildcard $(TOP_DIR)/$(OMV_DIR)/modules/*.c) +#OMV_SRC_QSTR := $(wildcard $(TOP_DIR)/modules/*.c) # The following command line args are passed to MicroPython's top Makefile. MPY_MKARGS = PORT=$(PORT) BOARD=$(TARGET) DEBUG=$(DEBUG) MICROPY_MANIFEST_OMV_LIB_DIR=$(OMV_LIB_DIR)\ FROZEN_MANIFEST=$(FROZEN_MANIFEST) OMV_SRC_QSTR="$(OMV_SRC_QSTR)"\ - MICROPY_ROM_TEXT_COMPRESSION=$(ROM_TEXT_COMPRESSION) USER_C_MODULES=$(TOP_DIR)/$(OMV_DIR) + MICROPY_ROM_TEXT_COMPRESSION=$(ROM_TEXT_COMPRESSION) USER_C_MODULES=$(TOP_DIR) # Configure additional built-in modules. Note must define both the CFLAGS and the Make command line args. ifeq ($(MICROPY_PY_CSI), 1) @@ -146,6 +131,11 @@ MPY_CFLAGS += -DMICROPY_PY_CSI=1 MPY_MKARGS += MICROPY_PY_CSI=1 endif +ifeq ($(MICROPY_PY_FIR), 1) +MPY_CFLAGS += -DMICROPY_PY_FIR=1 +MPY_MKARGS += MICROPY_PY_FIR=1 +endif + ifeq ($(MICROPY_PY_WINC1500), 1) MPY_CFLAGS += -DMICROPY_PY_WINC1500=1 MPY_MKARGS += MICROPY_PY_WINC1500=1 @@ -215,12 +205,26 @@ MPY_CFLAGS += -DMP_CONFIGFILE=\<$(OMV_PORT_DIR)/omv_mpconfigport.h\> # Include the port Makefile. include $(OMV_PORT_DIR)/omv_portconfig.mk -# Export all common variables -include $(OMV_COMMON_DIR)/export.mk +# Export variables for sub-make. +export PORT +export MCU +export TARGET +export CFLAGS +export AFLAGS +export LDFLAGS +export MPY_CFLAGS +export MPY_MKARGS +export USERMOD_OPT clean: $(RM) -fr $(BUILD) +size: +ifeq ($(OMV_ENABLE_BL), 1) + $(SIZE) --format=SysV $(FW_DIR)/$(BOOTLOADER).elf +endif + $(SIZE) --format=SysV $(FW_DIR)/$(FIRMWARE).elf + jlink: ${JLINK_GDB_SERVER} -speed ${JLINK_SPEED} -nogui 1 \ -if ${JLINK_INTERFACE} -halt -cpu cortex-m \ diff --git a/drivers/lsm6dsm/Makefile b/common/common.mk similarity index 70% rename from drivers/lsm6dsm/Makefile rename to common/common.mk index 457493557..a8704e8be 100644 --- a/drivers/lsm6dsm/Makefile +++ b/common/common.mk @@ -1,6 +1,6 @@ # SPDX-License-Identifier: MIT # -# Copyright (C) 2013-2024 OpenMV, LLC. +# Copyright (C) 2025 OpenMV, LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -20,23 +20,26 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -# ST Makefile -override CFLAGS += -Os +# Common files Makefile -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) +COMMON_SRC_C += \ + array.c \ + dma_alloc.c \ + fb_alloc.c \ + file_utils.c \ + mp_utils.c \ + mutex.c \ + nosys_stubs.c \ + omv_csi.c \ + pendsv.c \ + ringbuf.c \ + tinyusb_debug.c \ + trace.c \ + umm_malloc.c \ + unaligned_memcpy.c \ + usbdbg.c \ + vospi.c \ + xalloc.c \ -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) +CFLAGS += -I$(TOP_DIR)/common +OMV_FIRM_OBJ += $(addprefix $(BUILD)/common/, $(COMMON_SRC_C:.c=.o)) diff --git a/common/export.mk b/common/export.mk deleted file mode 100644 index 8d35085e8..000000000 --- a/common/export.mk +++ /dev/null @@ -1,96 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (C) 2013-2024 OpenMV, LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# Tools, directories and common variables that need to be exported when calling -# sub-Makefiles. - -# Export Commands -export Q -export CC -export CLANG -export CXX -export AS -export LD -export AR -export RM -export CPP -export SIZE -export STRIP -export OBJCOPY -export OBJDUMP -export PYTHON -export MKDIR -export ECHO -export MAKE -export CAT -export TFLITE2C -export MKROMFS - -# Export Flags -export CFLAGS -export AFLAGS -export LDFLAGS -export MPY_CFLAGS -export USERMOD_OPT - -# Export variables -export TARGET -export FIRMWARE -export SYSTEM -export STARTUP -export MPY_MKARGS -export VELA_ARGS -export FROZEN_MANIFEST - -# Export board config variables -export PORT -export MCU - -# Export Directories -export TOP_DIR -export BUILD -export TOOLS -export FW_DIR -export BOOT_DIR -export OMV_DIR -export CMSIS_DIR -export MICROPY_DIR -export BOSON_DIR -export LEPTON_DIR -export LSM6DS3_DIR -export LSM6DSM_DIR -export LSM6DSOX_DIR -export WINC1500_DIR -export MLX90621_DIR -export MLX90640_DIR -export MLX90641_DIR -export VL53L5CX_DIR -export VL53L8CX_DIR -export PIXART_DIR -export DISPLAY_DIR -export LIBPDM_DIR -export TENSORFLOW_DIR -export OMV_BOARD_CONFIG_DIR -export OMV_PORT_DIR -export MP_BOARD_CONFIG_DIR -export OMV_LIB_DIR -export OMV_COMMON_DIR diff --git a/common/micropy.mk b/common/micropy.mk new file mode 100644 index 000000000..08e245de2 --- /dev/null +++ b/common/micropy.mk @@ -0,0 +1,188 @@ +# SPDX-License-Identifier: MIT +# +# Copyright (C) 2025 OpenMV, LLC. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# Collects MicroPython object files + +# Add core py object files +MPY_FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/py/*.o) + +# Add extmod object files. +MPY_FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/extmod/*.o) + +# Add shared object files. +MPY_FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/shared/**/*.o) + +# Add driver object files. +MPY_FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/drivers/*.o) +MPY_FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/drivers/**/*.o) + +# Add C user modules. +MPY_FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/modules/*.o) +MPY_FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/modules/**/*.o) +MPY_FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/ports/$(PORT)/modules/*.o) + +# Add lwIP core, netif, apps, and related network modules +ifeq ($(MICROPY_PY_LWIP), 1) +MPY_FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ + mpnetworkport.o \ + lib/lwip/src/core/*.o \ + lib/lwip/src/core/*/*.o \ + lib/lwip/src/netif/*.o \ + lib/lwip/src/apps/*/*.o \ +) +endif + +# Add mbedTLS crypto and error libraries +ifeq ($(MICROPY_SSL_MBEDTLS), 1) +MPY_FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ + mbedtls/*.o \ + lib/mbedtls/library/*.o \ + lib/mbedtls_errors/*.o \ +) +endif + +# Add CYW43 Wi-Fi driver and network glue +ifeq ($(MICROPY_PY_NETWORK_CYW43), 1) +MPY_FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/cyw43-driver/,\ + src/cyw43_bthci_uart.o \ + src/cyw43_ctrl.o \ + src/cyw43_lwip.o \ + src/cyw43_ll.o \ + src/cyw43_sdio.o \ + src/cyw43_spi.o \ + src/cyw43_stats.o \ +) +endif + +# Add NimBLE Bluetooth stack and glue code +ifeq ($(MICROPY_BLUETOOTH_NIMBLE),1) +MPY_FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ + mpbthciport.o \ + mpnimbleport.o \ + extmod/nimble/modbluetooth_nimble.o \ + extmod/nimble/nimble/nimble_npl_os.o \ + extmod/nimble/hal/hal_uart.o \ +) + +MPY_FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/,\ + mynewt-nimble/ext/tinycrypt/src/*.o \ + mynewt-nimble/nimble/host/services/gap/src/*.o \ + mynewt-nimble/nimble/host/services/gatt/src/*.o \ + mynewt-nimble/nimble/host/src/*.o \ + mynewt-nimble/nimble/host/util/src/*.o \ + mynewt-nimble/nimble/transport/uart/src/*.o \ + mynewt-nimble/porting/nimble/src/*.o \ +) +endif + +# Add TinyUSB library objects. +ifeq ($(PORT),$(filter $(PORT),alif mimxrt nrf)) +MPY_FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/tinyusb/, \ + src/*.o \ + src/common/*.o \ + src/device/*.o \ + src/class/**/*.o \ +) + +MPY_FIRM_OBJ += \ + $(wildcard $(BUILD)/$(MICROPY_DIR)/lib/tinyusb/src/portable/**/**/*.o) +endif + +# Add oofatfs library +MPY_FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/lib/oofatfs/*.o) + +# Add OpenAMP metal layer and remoteproc/rpmsg stack +ifeq ($(MICROPY_PY_OPENAMP),1) +MPY_FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/openamp/metal/,\ + device.o \ + dma.o \ + init.o \ + io.o \ + irq.o \ + log.o \ + shmem.o \ + softirq.o \ + version.o \ + system/micropython/condition.o \ + system/micropython/device.o \ + system/micropython/io.o \ + system/micropython/irq.o \ + system/micropython/shmem.o \ + system/micropython/time.o \ +) + +MPY_FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ + mpmetalport.o \ + mpremoteprocport.o \ + lib/open-amp/lib/virtio/virtio.o \ + lib/open-amp/lib/virtio/virtqueue.o \ + lib/open-amp/lib/virtio_mmio/virtio_mmio_drv.o \ + lib/open-amp/lib/rpmsg/rpmsg.o \ + lib/open-amp/lib/rpmsg/rpmsg_virtio.o \ + lib/open-amp/lib/remoteproc/elf_loader.o \ + lib/open-amp/lib/remoteproc/remoteproc.o \ + lib/open-amp/lib/remoteproc/remoteproc_virtio.o \ + lib/open-amp/lib/remoteproc/rsc_table_parser.o \ +) +endif + +# Add ULAB NumPy/SciPy-like modules +ifeq ($(MICROPY_PY_ULAB), 1) +MPY_FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/code/,\ + ndarray.o \ + ndarray_operators.o \ + ndarray_properties.o \ + numpy/approx.o \ + numpy/bitwise.o \ + numpy/carray/carray.o \ + numpy/carray/carray_tools.o \ + numpy/compare.o \ + numpy/create.o \ + numpy/fft/fft.o \ + numpy/fft/fft_tools.o \ + numpy/filter.o \ + numpy/io/io.o \ + numpy/linalg/linalg.o \ + numpy/linalg/linalg_tools.o \ + numpy/ndarray/ndarray_iter.o \ + numpy/numerical.o \ + numpy/numpy.o \ + numpy/poly.o \ + numpy/random/random.o \ + numpy/stats.o \ + numpy/transform.o \ + numpy/vector.o \ + scipy/integrate/integrate.o \ + scipy/linalg/linalg.o \ + scipy/optimize/optimize.o \ + scipy/scipy.o \ + scipy/signal/signal.o \ + scipy/special/special.o \ + ulab.o \ + ulab_tools.o \ + user/user.o \ + utils/utils.o \ +) +endif + +# Add board object files (board.o, board_init etc...) +MPY_FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/boards/$(TARGET)/*.o) diff --git a/drivers/lsm6ds3/Makefile b/common/mkrules.mk similarity index 61% rename from drivers/lsm6ds3/Makefile rename to common/mkrules.mk index 457493557..87a671d8a 100644 --- a/drivers/lsm6ds3/Makefile +++ b/common/mkrules.mk @@ -1,6 +1,6 @@ # SPDX-License-Identifier: MIT # -# Copyright (C) 2013-2024 OpenMV, LLC. +# Copyright (C) 2025 OpenMV, LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -20,23 +20,35 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -# ST Makefile -override CFLAGS += -Os +# Rules for building firmware object files -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ +# Ensure all necessary directories exist +FIRM_DIRS: + $(MKDIR) -p $(sort $(BUILD) $(FW_DIR) $(dir $(OMV_FIRM_OBJ))) +# Compile C source files to object files $(BUILD)/%.o : %.c $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) -MMD -c -o $@ $< +# Compile C++ source files to object files +$(BUILD)/%.o : %.cc + $(ECHO) "CXX $<" + $(CC) $(CXXFLAGS) -MMD -c -o $@ $< + +# Assemble raw assembly files (.s) $(BUILD)/%.o : %.s $(ECHO) "AS $<" $(AS) $(AFLAGS) $< -o $@ --include $(OBJS:%.o=%.d) +# Assemble preprocessed assembly files (.S) using the C compiler +$(BUILD)/%.o: %.S + $(ECHO) "CC $<" + $(CC) $(CFLAGS) -MMD -c -o $@ $< + +# Special rule for compiling certain files with Clang +$(OMV_CLANG_OBJ): $(BUILD)/%.o : %.c + $(ECHO) "CL $<" + $(CLANG) $(CLANG_FLAGS) -c -o $@ $< + +-include $(MPY_FIRM_OBJ:%.o=%.d) $(OMV_FIRM_OBJ:%.o=%.d) diff --git a/drivers/dave2d/Makefile b/drivers/dave2d/Makefile deleted file mode 100644 index 25ae140ff..000000000 --- a/drivers/dave2d/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (C) 2024 OpenMV, LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# D/AVE 2D Makefile -SRC_C += $(addprefix src/, \ - dave_d0lib.c \ - dave_d0_mm_dynamic.c \ - dave_d0_mm_fixed_range.c \ - dave_d0_mm_fixed_range_fixed_blkcnt.c \ - dave_64bitoperation.c \ - dave_blit.c \ - dave_box.c \ - dave_circle.c \ - dave_context.c \ - dave_curve.c \ - dave_dlist.c \ - dave_driver.c \ - dave_edge.c \ - dave_errorcodes.c \ - dave_gradient.c \ - dave_hardware.c \ - dave_line.c \ - dave_math.c \ - dave_memory.c \ - dave_pattern.c \ - dave_perfcount.c \ - dave_polyline.c \ - dave_quad.c \ - dave_rbuffer.c \ - dave_render.c \ - dave_texture.c \ - dave_triangle.c \ - dave_utility.c \ - dave_viewport.c \ - dave_wedge.c \ -) - -OBJS = $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - -$(BUILD)/src/dave_d0lib.o: override CFLAGS += -Wno-unused-value -$(BUILD)/src/dave_d0_mm_fixed_range.o: override CFLAGS += -Wno-unused-value - --include $(OBJS:%.o=%.d) diff --git a/drivers/display/Makefile b/drivers/display/Makefile deleted file mode 100644 index 5c9a4e8aa..000000000 --- a/drivers/display/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (C) 2023-2024 OpenMV, LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# Display drivers Makefile -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/drivers/drivers.mk b/drivers/drivers.mk new file mode 100644 index 000000000..5051a4480 --- /dev/null +++ b/drivers/drivers.mk @@ -0,0 +1,268 @@ +# SPDX-License-Identifier: MIT +# +# Copyright (C) 2013-2024 OpenMV, LLC. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# Drivers Makefile + +# Boson driver sources +ifeq ($(OMV_BOSON_ENABLE), 1) +DRIVER_SRC_C += $(addprefix boson/src/, \ + Client_API.c \ + Client_Dispatcher.c \ + Client_Interface.c \ + Client_Packager.c \ + dataServiceClient.c \ + fifo.c \ + flirChannels.c \ + flirCRC.c \ + FSLP.c \ + I2C_Connector.c \ + MultiServiceSupport.c \ + Serializer_BuiltIn.c \ + Serializer_Struct.c \ + serialPortAdapter.c \ + timeoutLogic.c \ + UART_Connector.c \ + UPTClient.c \ +) + +$(BUILD)/drivers/boson/src/%.o: override CFLAGS += \ + -Wno-maybe-uninitialized \ + -Wno-unused-variable \ + -Wno-array-parameter \ + -Wno-strict-aliasing \ + -Wno-address-of-packed-member \ + -Wno-uninitialized \ + -Wno-format + +CFLAGS += -DOMV_BOSON_ENABLE=1 +CFLAGS += -I$(TOP_DIR)/drivers/boson/include +endif # OMV_BOSON_ENABLE + +# D/AVE 2D driver sources +ifeq ($(PORT),alif) +DRIVER_SRC_C += $(addprefix dave2d/src/, \ + dave_64bitoperation.c \ + dave_blit.c \ + dave_box.c \ + dave_circle.c \ + dave_context.c \ + dave_curve.c \ + dave_d0lib.c \ + dave_d0_mm_dynamic.c \ + dave_d0_mm_fixed_range.c \ + dave_d0_mm_fixed_range_fixed_blkcnt.c \ + dave_dlist.c \ + dave_driver.c \ + dave_edge.c \ + dave_errorcodes.c \ + dave_gradient.c \ + dave_hardware.c \ + dave_line.c \ + dave_math.c \ + dave_memory.c \ + dave_pattern.c \ + dave_perfcount.c \ + dave_polyline.c \ + dave_quad.c \ + dave_rbuffer.c \ + dave_render.c \ + dave_texture.c \ + dave_triangle.c \ + dave_utility.c \ + dave_viewport.c \ + dave_wedge.c \ +) + +CFLAGS += -I$(TOP_DIR)/drivers/dave2d/include +$(BUILD)/drivers/dave2d/src/%.o: override CFLAGS += -Wno-unused-value +endif # D/AVE 2D / Alif port. + +# Display driver sources +ifeq ($(MICROPY_PY_DISPLAY), 1) +DRIVER_SRC_C += $(addprefix display/src/, \ + cec.c \ +) +CFLAGS += -I$(TOP_DIR)/drivers/display/include +endif # MICROPY_PY_DISPLAY + +# GenX320 driver sources +ifeq ($(OMV_GENX320_ENABLE), 1) +DRIVER_SRC_C += $(addprefix genx320/src/, \ + firmware.c \ + genx320_issd_cpi_evt.c \ + genx320_issd_cpi_histo.c \ + psee_genx320.c \ +) + +OMV_GENX320_EHC_ENABLE ?= 0 +CFLAGS += -DOMV_GENX320_ENABLE=1 +CFLAGS += -DOMV_GENX320_EHC_ENABLE=$(OMV_GENX320_EHC_ENABLE) +CFLAGS += -I$(TOP_DIR)/drivers/genx320/include +endif # OMV_GENX320_ENABLE + +# Lepton driver sources +ifeq ($(OMV_LEPTON_SDK_ENABLE), 1) +DRIVER_SRC_C += $(addprefix lepton/src/, \ + crc16fast.c \ + LEPTON_AGC.c \ + LEPTON_I2C_Protocol.c \ + LEPTON_I2C_Service.c \ + LEPTON_OEM.c \ + LEPTON_RAD.c \ + LEPTON_SDK.c \ + LEPTON_SYS.c \ + LEPTON_VID.c \ +) + +CFLAGS += -I$(TOP_DIR)/drivers/lepton/include +endif # OMV_LEPTON_SDK_ENABLE + +ifeq ($(MICROPY_PY_IMU), 1) +# LSM6DS3 sensor driver sources +DRIVER_SRC_C += $(addprefix lsm6ds3/src/, \ + lsm6ds3_reg.c \ + lsm6ds3tr_c_reg.c \ +) +CFLAGS += -I$(TOP_DIR)/drivers/lsm6ds3/include + +# LSM6DSM sensor driver sources +DRIVER_SRC_C += $(addprefix lsm6dsm/src/, \ + lsm6dsm_reg.c \ +) +CFLAGS += -I$(TOP_DIR)/drivers/lsm6dsm/include/ + +# LSM6DSOX sensor driver sources +DRIVER_SRC_C += $(addprefix lsm6dsox/src/, \ + lsm6dsox_reg.c \ +) +CFLAGS += -I$(TOP_DIR)/drivers/lsm6dsox/include +endif # MICROPY_PY_IMU + +ifeq ($(MICROPY_PY_FIR), 1) +# MLX90621 driver sources +DRIVER_SRC_C += $(addprefix mlx90621/src/, \ + MLX90621_API.c \ + MLX90621_I2C_Driver.c \ +) +CFLAGS += -I$(TOP_DIR)/drivers/mlx90621/include + +# MLX90640 driver sources +DRIVER_SRC_C += $(addprefix mlx90640/src/, \ + MLX90640_API.c \ + MLX90640_I2C_Driver.c \ +) +CFLAGS += -I$(TOP_DIR)/drivers/mlx90640/include + +# MLX90641 driver sources +DRIVER_SRC_C += $(addprefix mlx90641/src/, \ + MLX90641_API.c \ + MLX90641_I2C_Driver.c \ +) +CFLAGS += -I$(TOP_DIR)/drivers/mlx90641/include +endif # MICROPY_PY_FIR + +# PixArt sensor driver sources +DRIVER_SRC_C += $(addprefix pixart/src/, \ + pixspi.c \ +) +CFLAGS += -I$(TOP_DIR)/drivers/pixart/include + +# Image sensor drivers sources +DRIVER_SRC_C += $(addprefix sensors/, \ + boson.c \ + frogeye2020.c \ + gc2145.c \ + genx320.c \ + hm01b0.c \ + hm0360.c \ + lepton.c \ + mt9m114.c \ + mt9v0xx.c \ + ov2640.c \ + ov5640.c \ + ov7670.c \ + ov7690.c \ + ov7725.c \ + ov9650.c \ + pag7920.c \ + pag7936.c \ + paj6100.c \ +) +CFLAGS += -I$(TOP_DIR)/drivers/sensors + +# VL53L5CX driver sources +ifeq ($(OMV_TOF_VL53L5CX_ENABLE), 1) +DRIVER_SRC_C += $(addprefix vl53l5cx/src/, \ + platform.c \ + vl53l5cx_api.c \ + vl53l5cx_plugin_detection_thresholds.c \ + vl53l5cx_plugin_motion_indicator.c \ + vl53l5cx_plugin_xtalk.c \ +) + +CFLAGS += -DOMV_TOF_VL53L5CX_ENABLE=1 +CFLAGS += -I$(TOP_DIR)/drivers/vl53l5cx/include +endif + +# VL53L8CX driver sources +ifeq ($(OMV_TOF_VL53L8CX_ENABLE), 1) +DRIVER_SRC_C += $(addprefix vl53l8cx/src/, \ + platform.c \ + vl53l8cx_api.c \ + vl53l8cx_plugin_detection_thresholds.c \ + vl53l8cx_plugin_motion_indicator.c \ + vl53l8cx_plugin_xtalk.c \ +) + +CFLAGS += -DOMV_TOF_VL53L8CX_ENABLE=1 +CFLAGS += -I$(TOP_DIR)/drivers/vl53l8cx/include/ +endif + +# WINC1500 Wi-Fi module sources +ifeq ($(MICROPY_PY_WINC1500), 1) +DRIVER_SRC_C += $(addprefix winc1500/src/, \ + flexible_flash.c \ + m2m_ate_mode.c \ + m2m_crypto.c \ + m2m_hif.c \ + m2m_ota.c \ + m2m_periph.c \ + m2m_ssl.c \ + m2m_wifi.c \ + nmasic.c \ + nm_bsp.c \ + nmbus.c \ + nm_bus_wrapper.c \ + nm_common.c \ + nmdrv.c \ + nmi2c.c \ + nmspi.c \ + nmuart.c \ + programmer.c \ + socket.c \ + spi_flash.c \ + winc.c \ +) +CFLAGS += -I$(TOP_DIR)/drivers/winc1500/include +endif # MICROPY_PY_WINC1500 + +OMV_FIRM_OBJ += $(addprefix $(BUILD)/drivers/, $(DRIVER_SRC_C:.c=.o)) diff --git a/drivers/genx320/Makefile b/drivers/genx320/Makefile deleted file mode 100644 index 30a4a1302..000000000 --- a/drivers/genx320/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -### -# Copyright (c) Prophesee S.A. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed -# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and limitations under the License. -### - -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/drivers/lepton/Makefile b/drivers/lepton/Makefile deleted file mode 100644 index f45a4931c..000000000 --- a/drivers/lepton/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (C) 2013-2024 OpenMV, LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# LEPTON Makefile -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/drivers/lsm6dsox/Makefile b/drivers/lsm6dsox/Makefile deleted file mode 100644 index 457493557..000000000 --- a/drivers/lsm6dsox/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (C) 2013-2024 OpenMV, LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# ST Makefile -override CFLAGS += -Os - -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/drivers/mlx90621/Makefile b/drivers/mlx90621/Makefile deleted file mode 100644 index 5a68e288a..000000000 --- a/drivers/mlx90621/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (C) 2013-2024 OpenMV, LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# MLX90621 Makefile -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/drivers/mlx90640/Makefile b/drivers/mlx90640/Makefile deleted file mode 100644 index a61a7a08c..000000000 --- a/drivers/mlx90640/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (C) 2013-2024 OpenMV, LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# MLX90640 Makefile -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/drivers/mlx90641/Makefile b/drivers/mlx90641/Makefile deleted file mode 100644 index 75daa9b60..000000000 --- a/drivers/mlx90641/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (C) 2013-2024 OpenMV, LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# MLX90641 Makefile -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/drivers/pixart/Makefile b/drivers/pixart/Makefile deleted file mode 100644 index cda814cb4..000000000 --- a/drivers/pixart/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -### -# MIT License -# -# Copyright (c) 2021 Pixart Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the "Software"), to deal in -# the Software without restriction, including without limitation the rights to -# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -# of the Software, and to permit persons to whom the Software is furnished to do -# so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -### - -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/drivers/vl53l5cx/Makefile b/drivers/vl53l5cx/Makefile deleted file mode 100644 index 4655a85c3..000000000 --- a/drivers/vl53l5cx/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (C) 2013-2024 OpenMV, LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# VL53L5CX Makefile -override CFLAGS += -Os - -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/drivers/winc1500/Makefile b/drivers/winc1500/Makefile deleted file mode 100644 index 6475f918a..000000000 --- a/drivers/winc1500/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# Copyright (C) 2013-2024 OpenMV, LLC. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# WINC1500 Makefile - -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/lib/alif/Makefile b/lib/alif/alif.mk similarity index 52% rename from lib/alif/Makefile rename to lib/alif/alif.mk index 76988b447..12d73cb2e 100644 --- a/lib/alif/Makefile +++ b/lib/alif/alif.mk @@ -1,13 +1,13 @@ # This file is part of the OpenMV project. # -# Copyright (c) 2013-2024 Ibrahim Abdelkader -# Copyright (c) 2013-2024 Kwabena W. Agyeman +# Copyright (c) 2013-2021 Ibrahim Abdelkader +# Copyright (c) 2013-2021 Kwabena W. Agyeman # # This work is licensed under the MIT license, see the file LICENSE for details. # -# Alif SDK Makefile +# Alif Makefile -SRCS += \ +HAL_SRC_C += \ drivers/source/adc.c \ drivers/source/dma_ctrl.c \ drivers/source/dma_op.c \ @@ -42,25 +42,19 @@ SRCS += \ Device/common/source/tcm_partition.c \ Device/core/$(MCU_CORE)/source/startup_$(MCU_CORE).c \ -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) +HAL_CFLAGS += -I$(TOP_DIR)/lib/alif/drivers/include/ +HAL_CFLAGS += -I$(TOP_DIR)/lib/alif/ospi_xip/source/ospi/ +HAL_CFLAGS += -I$(TOP_DIR)/lib/alif/se_services/include +HAL_CFLAGS += -I$(TOP_DIR)/lib/alif/Device/common/config/ +HAL_CFLAGS += -I$(TOP_DIR)/lib/alif/Device/common/include/ +HAL_CFLAGS += -I$(TOP_DIR)/lib/alif/Device/core/$(MCU_CORE)/config/ +HAL_CFLAGS += -I$(TOP_DIR)/lib/alif/Device/core/$(MCU_CORE)/include/ +HAL_CFLAGS += -I$(TOP_DIR)/lib/alif/Device/$(MCU_SERIES)/$(MCU_VARIANT)/ -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ +OMV_FIRM_OBJ += $(addprefix $(BUILD)/lib/alif/, $(HAL_SRC_C:.c=.o)) -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - -$(BUILD)/drivers/source/spi.o: override CFLAGS += -Wno-maybe-uninitialized -$(BUILD)/drivers/source/i3c.o: override CFLAGS += -Wno-int-conversion -$(BUILD)/drivers/source/mram.o: override CFLAGS += -Wno-strict-aliasing -$(BUILD)/se_services/source/services_host_boot.o: override CFLAGS += -Wno-stringop-truncation -$(BUILD)/se_services/source/services_host_system.o: override CFLAGS += -Wno-maybe-uninitialized - --include $(OBJS:%.o=%.d) +$(BUILD)/lib/alif/drivers/source/spi.o: override CFLAGS += -Wno-maybe-uninitialized +$(BUILD)/lib/alif/drivers/source/i3c.o: override CFLAGS += -Wno-int-conversion +$(BUILD)/lib/alif/drivers/source/mram.o: override CFLAGS += -Wno-strict-aliasing +$(BUILD)/lib/alif/se_services/source/services_host_boot.o: override CFLAGS += -Wno-stringop-truncation +$(BUILD)/lib/alif/se_services/source/services_host_system.o: override CFLAGS += -Wno-maybe-uninitialized diff --git a/lib/cmsis/Makefile b/lib/cmsis/Makefile deleted file mode 100644 index 039aef69f..000000000 --- a/lib/cmsis/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# This file is part of the OpenMV project. -# -# Copyright (c) 2013-2021 Ibrahim Abdelkader -# Copyright (c) 2013-2021 Kwabena W. Agyeman -# -# This work is licensed under the MIT license, see the file LICENSE for details. -# -# CMSIS Makefile - -SRC_S = src/$(STARTUP).s -SRC_C = src/$(SYSTEM).c - -SRC_C += $(addprefix src/dsp/,\ - CommonTables/CommonTables.c \ - CommonTables/CommonTablesF16.c \ - FastMathFunctions/FastMathFunctions.c \ - FastMathFunctions/FastMathFunctionsF16.c \ -) - -OBJS = $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) -OBJS += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: $(OBJS) -$(OBJS): | $(OBJ_DIRS) - -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o: %.S - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/drivers/boson/Makefile b/lib/cmsis/cmsis.mk similarity index 63% rename from drivers/boson/Makefile rename to lib/cmsis/cmsis.mk index c4d93701a..6b4e63cea 100644 --- a/drivers/boson/Makefile +++ b/lib/cmsis/cmsis.mk @@ -1,6 +1,6 @@ # SPDX-License-Identifier: MIT # -# Copyright (C) 2013-2024 OpenMV, LLC. +# Copyright (C) 2025 OpenMV, LLC. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -20,29 +20,26 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -# BOSON Makefile -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) +# CMSIS Makefile -override CFLAGS += -Wno-maybe-uninitialized \ - -Wno-unused-variable \ - -Wno-array-parameter \ - -Wno-strict-aliasing \ - -Wno-address-of-packed-member \ - -Wno-uninitialized \ - -Wno-format +CMSIS_INC ?= $(PORT) -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ +ifneq ($(STARTUP),) +CMSIS_SRC_S += cmsis/src/$(STARTUP).s +endif +ifneq ($(SYSTEM),) +CMSIS_SRC_C += cmsis/src/$(SYSTEM).c +endif -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< +CMSIS_SRC_C += $(addprefix cmsis/src/dsp/,\ + CommonTables/CommonTables.c \ + CommonTables/CommonTablesF16.c \ + FastMathFunctions/FastMathFunctions.c \ + FastMathFunctions/FastMathFunctionsF16.c \ +) -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ +HAL_CFLAGS += -I$(TOP_DIR)/lib/cmsis/include +HAL_CFLAGS += -I$(TOP_DIR)/lib/cmsis/include/$(CMSIS_INC) --include $(OBJS:%.o=%.d) +OMV_FIRM_OBJ += $(addprefix $(BUILD)/lib/, $(CMSIS_SRC_S:.s=.o)) +OMV_FIRM_OBJ += $(addprefix $(BUILD)/lib/, $(CMSIS_SRC_C:.c=.o)) diff --git a/lib/imlib/imlib.mk b/lib/imlib/imlib.mk new file mode 100644 index 000000000..f5824bdd6 --- /dev/null +++ b/lib/imlib/imlib.mk @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: MIT +# +# Copyright (C) 2025 OpenMV, LLC. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# IMLIB Makefile + +IMLIB_SRC_C += \ + agast.c \ + apriltag.c \ + bayer.c \ + binary.c \ + blob.c \ + bmp.c \ + clahe.c \ + collections.c \ + dmtx.c \ + draw.c \ + edge.c \ + eye.c \ + fast.c \ + fft.c \ + filter.c \ + fmath.c \ + font.c \ + framebuffer.c \ + fsort.c \ + gif.c \ + haar.c \ + hog.c \ + hough.c \ + imlib.c \ + integral.c \ + integral_mw.c \ + isp.c \ + jpegd.c \ + jpege.c \ + kmeans.c \ + lab_tab.c \ + lbp.c \ + line.c \ + lodepng.c \ + lsd.c \ + mathop.c \ + mjpeg.c \ + orb.c \ + phasecorrelation.c \ + png.c \ + point.c \ + ppm.c \ + qrcode.c \ + qsort.c \ + rainbow_tab.c \ + rectangle.c \ + selective_search.c \ + sincos_tab.c \ + stats.c \ + stereo.c \ + template.c \ + xyz_tab.c \ + yuv.c \ + zbar.c \ + +CFLAGS += -I$(TOP_DIR)/lib/imlib +$(BUILD)/lib/imlib/fmath.o: override CFLAGS += -fno-strict-aliasing + +ifeq ($(CLANG_ENABLE),1) +OMV_CLANG_OBJ = $(BUILD)/lib/imlib/bayer.o +endif + +OMV_FIRM_OBJ += $(addprefix $(BUILD)/lib/imlib/, $(IMLIB_SRC_C:.c=.o)) diff --git a/lib/mimxrt/MIMXRT1062/Makefile b/lib/mimxrt/MIMXRT1062/Makefile deleted file mode 100644 index 781769361..000000000 --- a/lib/mimxrt/MIMXRT1062/Makefile +++ /dev/null @@ -1,100 +0,0 @@ -# This file is part of the OpenMV project. -# -# Copyright (c) 2013-2023 Ibrahim Abdelkader -# Copyright (c) 2013-2023 Kwabena W. Agyeman -# -# This work is licensed under the MIT license, see the file LICENSE for details. -# -# MIMXRT Makefile -SRCS = $(addprefix drivers/,\ - fsl_adc.c\ - fsl_adc_etc.c\ - fsl_aipstz.c\ - fsl_aoi.c\ - fsl_bee.c\ - fsl_cache.c\ - fsl_clock.c\ - fsl_cmp.c\ - fsl_common_arm.c\ - fsl_common.c\ - fsl_csi.c\ - fsl_dcdc.c\ - fsl_dcp.c\ - fsl_dmamux.c\ - fsl_edma.c\ - fsl_elcdif.c\ - fsl_enc.c\ - fsl_enet.c\ - fsl_ewm.c\ - fsl_flexcan.c\ - fsl_flexcan_edma.c\ - fsl_flexio.c\ - fsl_flexio_camera.c\ - fsl_flexio_camera_edma.c\ - fsl_flexio_i2c_master.c\ - fsl_flexio_i2s.c\ - fsl_flexio_i2s_edma.c\ - fsl_flexio_mculcd.c\ - fsl_flexio_mculcd_edma.c\ - fsl_flexio_spi.c\ - fsl_flexio_spi_edma.c\ - fsl_flexio_uart.c\ - fsl_flexio_uart_edma.c\ - fsl_flexram_allocate.c\ - fsl_flexram.c\ - fsl_flexspi.c\ - fsl_flexspi_edma.c\ - fsl_flexspi_nor_boot.c\ - fsl_gpc.c\ - fsl_gpio.c\ - fsl_gpt.c\ - fsl_kpp.c\ - fsl_lpi2c.c\ - fsl_lpi2c_edma.c\ - fsl_lpspi.c\ - fsl_lpspi_edma.c\ - fsl_lpuart.c\ - fsl_lpuart_edma.c\ - fsl_ocotp.c\ - fsl_pit.c\ - fsl_pmu.c\ - fsl_pwm.c\ - fsl_pxp.c\ - fsl_qtmr.c\ - fsl_romapi.c\ - fsl_rtwdog.c\ - fsl_sai.c\ - fsl_sai_edma.c\ - fsl_semc.c\ - fsl_snvs_hp.c\ - fsl_snvs_lp.c\ - fsl_spdif.c\ - fsl_spdif_edma.c\ - fsl_src.c\ - fsl_tempmon.c\ - fsl_trng.c\ - fsl_tsc.c\ - fsl_usdhc.c\ - fsl_usb_phy.c\ - fsl_wdog.c\ - fsl_xbara.c\ - fsl_xbarb.c\ - mimxrt_pads.c\ -) - -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/lib/mimxrt/MIMXRT1064/Makefile b/lib/mimxrt/MIMXRT1064/Makefile deleted file mode 100644 index 760f53bb6..000000000 --- a/lib/mimxrt/MIMXRT1064/Makefile +++ /dev/null @@ -1,98 +0,0 @@ -# This file is part of the OpenMV project. -# -# Copyright (c) 2013-2023 Ibrahim Abdelkader -# Copyright (c) 2013-2023 Kwabena W. Agyeman -# -# This work is licensed under the MIT license, see the file LICENSE for details. -# -# MIMXRT Makefile -SRCS = $(addprefix drivers/,\ - fsl_adc.c\ - fsl_adc_etc.c\ - fsl_aipstz.c\ - fsl_aoi.c\ - fsl_bee.c\ - fsl_cache.c\ - fsl_clock.c\ - fsl_cmp.c\ - fsl_common_arm.c\ - fsl_common.c\ - fsl_csi.c\ - fsl_dcdc.c\ - fsl_dcp.c\ - fsl_dmamux.c\ - fsl_edma.c\ - fsl_elcdif.c\ - fsl_enc.c\ - fsl_enet.c\ - fsl_ewm.c\ - fsl_flexcan.c\ - fsl_flexcan_edma.c\ - fsl_flexio.c\ - fsl_flexio_camera.c\ - fsl_flexio_camera_edma.c\ - fsl_flexio_i2c_master.c\ - fsl_flexio_i2s.c\ - fsl_flexio_i2s_edma.c\ - fsl_flexio_mculcd.c\ - fsl_flexio_mculcd_edma.c\ - fsl_flexio_spi.c\ - fsl_flexio_spi_edma.c\ - fsl_flexio_uart.c\ - fsl_flexio_uart_edma.c\ - fsl_flexram_allocate.c\ - fsl_flexram.c\ - fsl_flexspi.c\ - fsl_flexspi_edma.c\ - fsl_flexspi_nor_boot.c\ - fsl_gpc.c\ - fsl_gpio.c\ - fsl_gpt.c\ - fsl_kpp.c\ - fsl_lpi2c.c\ - fsl_lpi2c_edma.c\ - fsl_lpspi.c\ - fsl_lpspi_edma.c\ - fsl_lpuart.c\ - fsl_lpuart_edma.c\ - fsl_ocotp.c\ - fsl_pit.c\ - fsl_pmu.c\ - fsl_pwm.c\ - fsl_pxp.c\ - fsl_qtmr.c\ - fsl_romapi.c\ - fsl_rtwdog.c\ - fsl_sai.c\ - fsl_sai_edma.c\ - fsl_semc.c\ - fsl_snvs_hp.c\ - fsl_snvs_lp.c\ - fsl_spdif.c\ - fsl_spdif_edma.c\ - fsl_src.c\ - fsl_tempmon.c\ - fsl_trng.c\ - fsl_tsc.c\ - fsl_usdhc.c\ - fsl_wdog.c\ - fsl_xbara.c\ - fsl_xbarb.c\ -) - -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/lib/mimxrt/mimxrt.mk b/lib/mimxrt/mimxrt.mk new file mode 100644 index 000000000..125a7ae3a --- /dev/null +++ b/lib/mimxrt/mimxrt.mk @@ -0,0 +1,166 @@ +# This file is part of the OpenMV project. +# +# Copyright (c) 2013-2021 Ibrahim Abdelkader +# Copyright (c) 2013-2021 Kwabena W. Agyeman +# +# This work is licensed under the MIT license, see the file LICENSE for details. +# +# MIMXRT Makefile +ifeq ($(MCU_SERIES),MIMXRT1062) +HAL_SRC_C = $(addprefix MIMXRT1062/drivers/,\ + fsl_adc.c\ + fsl_adc_etc.c\ + fsl_aipstz.c\ + fsl_aoi.c\ + fsl_bee.c\ + fsl_cache.c\ + fsl_clock.c\ + fsl_cmp.c\ + fsl_common_arm.c\ + fsl_common.c\ + fsl_csi.c\ + fsl_dcdc.c\ + fsl_dcp.c\ + fsl_dmamux.c\ + fsl_edma.c\ + fsl_elcdif.c\ + fsl_enc.c\ + fsl_enet.c\ + fsl_ewm.c\ + fsl_flexcan.c\ + fsl_flexcan_edma.c\ + fsl_flexio.c\ + fsl_flexio_camera.c\ + fsl_flexio_camera_edma.c\ + fsl_flexio_i2c_master.c\ + fsl_flexio_i2s.c\ + fsl_flexio_i2s_edma.c\ + fsl_flexio_mculcd.c\ + fsl_flexio_mculcd_edma.c\ + fsl_flexio_spi.c\ + fsl_flexio_spi_edma.c\ + fsl_flexio_uart.c\ + fsl_flexio_uart_edma.c\ + fsl_flexram_allocate.c\ + fsl_flexram.c\ + fsl_flexspi.c\ + fsl_flexspi_edma.c\ + fsl_flexspi_nor_boot.c\ + fsl_gpc.c\ + fsl_gpio.c\ + fsl_gpt.c\ + fsl_kpp.c\ + fsl_lpi2c.c\ + fsl_lpi2c_edma.c\ + fsl_lpspi.c\ + fsl_lpspi_edma.c\ + fsl_lpuart.c\ + fsl_lpuart_edma.c\ + fsl_ocotp.c\ + fsl_pit.c\ + fsl_pmu.c\ + fsl_pwm.c\ + fsl_pxp.c\ + fsl_qtmr.c\ + fsl_romapi.c\ + fsl_rtwdog.c\ + fsl_sai.c\ + fsl_sai_edma.c\ + fsl_semc.c\ + fsl_snvs_hp.c\ + fsl_snvs_lp.c\ + fsl_spdif.c\ + fsl_spdif_edma.c\ + fsl_src.c\ + fsl_tempmon.c\ + fsl_trng.c\ + fsl_tsc.c\ + fsl_usdhc.c\ + fsl_usb_phy.c\ + fsl_wdog.c\ + fsl_xbara.c\ + fsl_xbarb.c\ + mimxrt_pads.c\ +) +endif + +ifeq ($(MCU_SERIES),MIMXRT1064) +HAL_SRC_C = $(addprefix MIMXRT1064/drivers/,\ + fsl_adc.c\ + fsl_adc_etc.c\ + fsl_aipstz.c\ + fsl_aoi.c\ + fsl_bee.c\ + fsl_cache.c\ + fsl_clock.c\ + fsl_cmp.c\ + fsl_common_arm.c\ + fsl_common.c\ + fsl_csi.c\ + fsl_dcdc.c\ + fsl_dcp.c\ + fsl_dmamux.c\ + fsl_edma.c\ + fsl_elcdif.c\ + fsl_enc.c\ + fsl_enet.c\ + fsl_ewm.c\ + fsl_flexcan.c\ + fsl_flexcan_edma.c\ + fsl_flexio.c\ + fsl_flexio_camera.c\ + fsl_flexio_camera_edma.c\ + fsl_flexio_i2c_master.c\ + fsl_flexio_i2s.c\ + fsl_flexio_i2s_edma.c\ + fsl_flexio_mculcd.c\ + fsl_flexio_mculcd_edma.c\ + fsl_flexio_spi.c\ + fsl_flexio_spi_edma.c\ + fsl_flexio_uart.c\ + fsl_flexio_uart_edma.c\ + fsl_flexram_allocate.c\ + fsl_flexram.c\ + fsl_flexspi.c\ + fsl_flexspi_edma.c\ + fsl_flexspi_nor_boot.c\ + fsl_gpc.c\ + fsl_gpio.c\ + fsl_gpt.c\ + fsl_kpp.c\ + fsl_lpi2c.c\ + fsl_lpi2c_edma.c\ + fsl_lpspi.c\ + fsl_lpspi_edma.c\ + fsl_lpuart.c\ + fsl_lpuart_edma.c\ + fsl_ocotp.c\ + fsl_pit.c\ + fsl_pmu.c\ + fsl_pwm.c\ + fsl_pxp.c\ + fsl_qtmr.c\ + fsl_romapi.c\ + fsl_rtwdog.c\ + fsl_sai.c\ + fsl_sai_edma.c\ + fsl_semc.c\ + fsl_snvs_hp.c\ + fsl_snvs_lp.c\ + fsl_spdif.c\ + fsl_spdif_edma.c\ + fsl_src.c\ + fsl_tempmon.c\ + fsl_trng.c\ + fsl_tsc.c\ + fsl_usdhc.c\ + fsl_wdog.c\ + fsl_xbara.c\ + fsl_xbarb.c\ +) +endif + +HAL_CFLAGS += -I$(TOP_DIR)/lib/mimxrt/$(MCU_SERIES) +HAL_CFLAGS += -I$(TOP_DIR)/lib/mimxrt/$(MCU_SERIES)/drivers + +OMV_FIRM_OBJ += $(addprefix $(BUILD)/lib/mimxrt/, $(HAL_SRC_C:.c=.o)) diff --git a/lib/nrfx/Makefile b/lib/nrfx/Makefile deleted file mode 100644 index 56ca6afaf..000000000 --- a/lib/nrfx/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# This file is part of the OpenMV project. -# -# Copyright (c) 2013-2021 Ibrahim Abdelkader -# Copyright (c) 2013-2021 Kwabena W. Agyeman -# -# This work is licensed under the MIT license, see the file LICENSE for details. -# -# NRF HAL Makefile -SRCS = $(addprefix src/,\ -nrfx_adc.c\ -nrfx_clock.c\ -nrfx_comp.c\ -nrfx_dppi.c\ -nrfx_egu.c\ -nrfx_gpiote.c\ -nrfx_i2s.c\ -nrfx_ipc.c\ -nrfx_lpcomp.c\ -nrfx_nfct.c\ -nrfx_nvmc.c\ -nrfx_pdm.c\ -nrfx_power.c\ -nrfx_ppi.c\ -nrfx_prs.c\ -nrfx_pwm.c\ -nrfx_qdec.c\ -nrfx_qspi.c\ -nrfx_rng.c\ -nrfx_rtc.c\ -nrfx_saadc.c\ -nrfx_spi.c\ -nrfx_spim.c\ -nrfx_spis.c\ -nrfx_systick.c\ -nrfx_temp.c\ -nrfx_timer.c\ -nrfx_twi.c\ -nrfx_twim.c\ -nrfx_twis.c\ -nrfx_twi_twim.c\ -nrfx_uart.c\ -nrfx_uarte.c\ -nrfx_usbd.c\ -nrfx_wdt.c\ -) - -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/lib/nrfx/nrfx.mk b/lib/nrfx/nrfx.mk new file mode 100644 index 000000000..015b32230 --- /dev/null +++ b/lib/nrfx/nrfx.mk @@ -0,0 +1,52 @@ +# This file is part of the OpenMV project. +# +# Copyright (c) 2013-2021 Ibrahim Abdelkader +# Copyright (c) 2013-2021 Kwabena W. Agyeman +# +# This work is licensed under the MIT license, see the file LICENSE for details. +# +# NRF Makefile +HAL_SRC_C += $(addprefix src/,\ + nrfx_adc.c \ + nrfx_clock.c \ + nrfx_comp.c \ + nrfx_dppi.c \ + nrfx_egu.c \ + nrfx_gpiote.c \ + nrfx_i2s.c \ + nrfx_ipc.c \ + nrfx_lpcomp.c \ + nrfx_nfct.c \ + nrfx_nvmc.c \ + nrfx_pdm.c \ + nrfx_power.c \ + nrfx_ppi.c \ + nrfx_prs.c \ + nrfx_pwm.c \ + nrfx_qdec.c \ + nrfx_qspi.c \ + nrfx_rng.c \ + nrfx_rtc.c \ + nrfx_saadc.c \ + nrfx_spi.c \ + nrfx_spim.c \ + nrfx_spis.c \ + nrfx_systick.c \ + nrfx_temp.c \ + nrfx_timer.c \ + nrfx_twi.c \ + nrfx_twim.c \ + nrfx_twis.c \ + nrfx_twi_twim.c \ + nrfx_uart.c \ + nrfx_uarte.c \ + nrfx_usbd.c \ + nrfx_wdt.c \ +) + +HAL_CFLAGS += -I$(TOP_DIR)/lib/nrfx/include +HAL_CFLAGS += -I$(TOP_DIR)/lib/nrfx/include/hal +HAL_CFLAGS += -I$(TOP_DIR)/lib/nrfx/include/soc +HAL_CFLAGS += -I$(TOP_DIR)/lib/nrfx/include/prs + +OMV_FIRM_OBJ += $(addprefix $(BUILD)/lib/nrfx/, $(HAL_SRC_C:.c=.o)) diff --git a/lib/stm32/f4/Makefile b/lib/stm32/f4/Makefile deleted file mode 100644 index 0dc2ff08e..000000000 --- a/lib/stm32/f4/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# This file is part of the OpenMV project. -# -# Copyright (c) 2013-2021 Ibrahim Abdelkader -# Copyright (c) 2013-2021 Kwabena W. Agyeman -# -# This work is licensed under the MIT license, see the file LICENSE for details. -# -# STHAL Makefile -SRCS = $(addprefix src/,\ -stm32f4xx_hal_adc.c\ -stm32f4xx_hal_adc_ex.c\ -stm32f4xx_hal_dac.c\ -stm32f4xx_hal_dac_ex.c\ -stm32f4xx_hal.c\ -stm32f4xx_hal_cortex.c\ -stm32f4xx_hal_dcmi.c\ -stm32f4xx_hal_dma.c\ -stm32f4xx_hal_dma_ex.c\ -stm32f4xx_hal_dma2d.c\ -stm32f4xx_hal_flash.c\ -stm32f4xx_hal_flash_ex.c\ -stm32f4xx_hal_gpio.c\ -stm32f4xx_hal_hcd.c\ -stm32f4xx_hal_i2c.c\ -stm32f4xx_hal_i2c_ex.c\ -stm32f4xx_hal_pcd.c\ -stm32f4xx_hal_pcd_ex.c\ -stm32f4xx_hal_pwr.c\ -stm32f4xx_hal_pwr_ex.c\ -stm32f4xx_hal_rcc.c\ -stm32f4xx_hal_rcc_ex.c\ -stm32f4xx_hal_rng.c\ -stm32f4xx_hal_rtc.c\ -stm32f4xx_hal_rtc_ex.c\ -stm32f4xx_hal_sd.c\ -stm32f4xx_hal_sdram.c\ -stm32f4xx_hal_spi.c\ -stm32f4xx_hal_can.c\ -stm32f4xx_hal_tim.c\ -stm32f4xx_hal_tim_ex.c\ -stm32f4xx_hal_uart.c\ -stm32f4xx_hal_usart.c\ -stm32f4xx_ll_usb.c\ -stm32f4xx_ll_sdmmc.c\ -stm32f4xx_ll_fmc.c\ -) - -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/lib/stm32/f7/Makefile b/lib/stm32/f7/Makefile deleted file mode 100644 index 4d7ef7936..000000000 --- a/lib/stm32/f7/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -# This file is part of the OpenMV project. -# -# Copyright (c) 2013-2021 Ibrahim Abdelkader -# Copyright (c) 2013-2021 Kwabena W. Agyeman -# -# This work is licensed under the MIT license, see the file LICENSE for details. -# -# STHAL Makefile -SRCS = $(addprefix src/,\ -stm32f7xx_hal_adc.c\ -stm32f7xx_hal_adc_ex.c\ -stm32f7xx_hal_dac.c\ -stm32f7xx_hal_dac_ex.c\ -stm32f7xx_hal.c\ -stm32f7xx_hal_cortex.c\ -stm32f7xx_hal_crc.c\ -stm32f7xx_hal_crc_ex.c\ -stm32f7xx_hal_dcmi.c\ -stm32f7xx_hal_dma.c\ -stm32f7xx_hal_dma_ex.c\ -stm32f7xx_hal_dma2d.c\ -stm32f7xx_hal_flash.c\ -stm32f7xx_hal_flash_ex.c\ -stm32f7xx_hal_gpio.c\ -stm32f7xx_hal_hcd.c\ -stm32f7xx_hal_i2c.c\ -stm32f7xx_hal_i2c_ex.c\ -stm32f7xx_hal_pcd.c\ -stm32f7xx_hal_pcd_ex.c\ -stm32f7xx_hal_pwr.c\ -stm32f7xx_hal_pwr_ex.c\ -stm32f7xx_hal_rcc.c\ -stm32f7xx_hal_rcc_ex.c\ -stm32f7xx_hal_rng.c\ -stm32f7xx_hal_rtc.c\ -stm32f7xx_hal_rtc_ex.c\ -stm32f7xx_hal_sd.c\ -stm32f7xx_hal_sdram.c\ -stm32f7xx_hal_spi.c\ -stm32f7xx_hal_can.c\ -stm32f7xx_hal_tim.c\ -stm32f7xx_hal_tim_ex.c\ -stm32f7xx_hal_uart.c\ -stm32f7xx_hal_usart.c\ -stm32f7xx_hal_jpeg.c\ -stm32f7xx_ll_usb.c\ -stm32f7xx_ll_sdmmc.c\ -stm32f7xx_ll_fmc.c\ -) - -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/lib/stm32/h7/Makefile b/lib/stm32/h7/Makefile deleted file mode 100644 index 30feece52..000000000 --- a/lib/stm32/h7/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# This file is part of the OpenMV project. -# -# Copyright (c) 2013-2021 Ibrahim Abdelkader -# Copyright (c) 2013-2021 Kwabena W. Agyeman -# -# This work is licensed under the MIT license, see the file LICENSE for details. -# -# STHAL Makefile -SRCS = $(addprefix src/,\ -stm32h7xx_hal_adc.c\ -stm32h7xx_hal_adc_ex.c\ -stm32h7xx_hal_dac.c\ -stm32h7xx_hal_dac_ex.c\ -stm32h7xx_hal_dsi.c\ -stm32h7xx_hal.c\ -stm32h7xx_hal_cortex.c\ -stm32h7xx_hal_crc.c\ -stm32h7xx_hal_crc_ex.c\ -stm32h7xx_hal_dcmi.c\ -stm32h7xx_hal_dfsdm.c\ -stm32h7xx_hal_dfsdm_ex.c\ -stm32h7xx_hal_dma.c\ -stm32h7xx_hal_dma_ex.c\ -stm32h7xx_hal_dma2d.c\ -stm32h7xx_hal_mdma.c\ -stm32h7xx_hal_flash.c\ -stm32h7xx_hal_flash_ex.c\ -stm32h7xx_hal_gpio.c\ -stm32h7xx_hal_hcd.c\ -stm32h7xx_hal_hsem.c\ -stm32h7xx_hal_i2c.c\ -stm32h7xx_hal_i2c_ex.c\ -stm32h7xx_hal_ltdc.c\ -stm32h7xx_hal_ltdc_ex.c\ -stm32h7xx_hal_pcd.c\ -stm32h7xx_hal_pcd_ex.c\ -stm32h7xx_hal_pwr.c\ -stm32h7xx_hal_pwr_ex.c\ -stm32h7xx_hal_rcc.c\ -stm32h7xx_hal_rcc_ex.c\ -stm32h7xx_hal_rng.c\ -stm32h7xx_hal_rtc.c\ -stm32h7xx_hal_rtc_ex.c\ -stm32h7xx_hal_sai.c\ -stm32h7xx_hal_sai_ex.c\ -stm32h7xx_hal_sd.c\ -stm32h7xx_hal_sdram.c\ -stm32h7xx_hal_spi.c\ -stm32h7xx_hal_fdcan.c\ -stm32h7xx_hal_tim.c\ -stm32h7xx_hal_tim_ex.c\ -stm32h7xx_hal_uart.c\ -stm32h7xx_hal_usart.c\ -stm32h7xx_hal_jpeg.c\ -stm32h7xx_hal_qspi.c\ -stm32h7xx_ll_rcc.c\ -stm32h7xx_ll_usb.c\ -stm32h7xx_ll_sdmmc.c\ -stm32h7xx_ll_fmc.c\ -stm32h7xx_ll_delayblock.c\ -) - -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/lib/stm32/n6/Makefile b/lib/stm32/n6/Makefile deleted file mode 100644 index c7531f7a3..000000000 --- a/lib/stm32/n6/Makefile +++ /dev/null @@ -1,132 +0,0 @@ -# This file is part of the OpenMV project. -# -# Copyright (c) 2013-2021 Ibrahim Abdelkader -# Copyright (c) 2013-2021 Kwabena W. Agyeman -# -# This work is licensed under the MIT license, see the file LICENSE for details. -# -# STHAL Makefile -SRCS = $(addprefix src/,\ -stm32n6xx_hal_adc.c\ -stm32n6xx_hal_adc_ex.c\ -stm32n6xx_hal_bsec.c\ -stm32n6xx_hal.c\ -stm32n6xx_hal_cacheaxi.c\ -stm32n6xx_hal_cortex.c\ -stm32n6xx_hal_crc.c\ -stm32n6xx_hal_crc_ex.c\ -stm32n6xx_hal_cryp.c\ -stm32n6xx_hal_cryp_ex.c\ -stm32n6xx_hal_dcmi.c\ -stm32n6xx_hal_dcmipp.c\ -stm32n6xx_hal_dma2d.c\ -stm32n6xx_hal_dma.c\ -stm32n6xx_hal_dma_ex.c\ -stm32n6xx_hal_dts.c\ -stm32n6xx_hal_eth.c\ -stm32n6xx_hal_eth_ex.c\ -stm32n6xx_hal_exti.c\ -stm32n6xx_hal_fdcan.c\ -stm32n6xx_hal_gfxmmu.c\ -stm32n6xx_hal_gfxtim.c\ -stm32n6xx_hal_gpio.c\ -stm32n6xx_hal_gpu2d.c\ -stm32n6xx_hal_hash.c\ -stm32n6xx_hal_hcd.c\ -stm32n6xx_hal_i2c.c\ -stm32n6xx_hal_i2c_ex.c\ -stm32n6xx_hal_i2s.c\ -stm32n6xx_hal_i2s_ex.c\ -stm32n6xx_hal_i3c.c\ -stm32n6xx_hal_icache.c\ -stm32n6xx_hal_irda.c\ -stm32n6xx_hal_iwdg.c\ -stm32n6xx_hal_jpeg.c\ -stm32n6xx_hal_lptim.c\ -stm32n6xx_hal_ltdc.c\ -stm32n6xx_hal_ltdc_ex.c\ -stm32n6xx_hal_mce.c\ -stm32n6xx_hal_mdf.c\ -stm32n6xx_hal_mdios.c\ -stm32n6xx_hal_mmc.c\ -stm32n6xx_hal_mmc_ex.c\ -stm32n6xx_hal_nand.c\ -stm32n6xx_hal_nor.c\ -stm32n6xx_hal_pcd.c\ -stm32n6xx_hal_pcd_ex.c\ -stm32n6xx_hal_pka.c\ -stm32n6xx_hal_pssi.c\ -stm32n6xx_hal_pwr.c\ -stm32n6xx_hal_pwr_ex.c\ -stm32n6xx_hal_ramcfg.c\ -stm32n6xx_hal_rcc.c\ -stm32n6xx_hal_rcc_ex.c\ -stm32n6xx_hal_rif.c\ -stm32n6xx_hal_rng.c\ -stm32n6xx_hal_rng_ex.c\ -stm32n6xx_hal_rtc.c\ -stm32n6xx_hal_rtc_ex.c\ -stm32n6xx_hal_sai.c\ -stm32n6xx_hal_sai_ex.c\ -stm32n6xx_hal_sd.c\ -stm32n6xx_hal_sd_ex.c\ -stm32n6xx_hal_sdram.c\ -stm32n6xx_hal_smartcard.c\ -stm32n6xx_hal_smartcard_ex.c\ -stm32n6xx_hal_smbus.c\ -stm32n6xx_hal_smbus_ex.c\ -stm32n6xx_hal_spdifrx.c\ -stm32n6xx_hal_spi.c\ -stm32n6xx_hal_spi_ex.c\ -stm32n6xx_hal_sram.c\ -stm32n6xx_hal_tim.c\ -stm32n6xx_hal_tim_ex.c\ -stm32n6xx_hal_uart.c\ -stm32n6xx_hal_uart_ex.c\ -stm32n6xx_hal_usart.c\ -stm32n6xx_hal_usart_ex.c\ -stm32n6xx_hal_wwdg.c\ -stm32n6xx_hal_xspi.c\ -stm32n6xx_ll_adc.c\ -stm32n6xx_ll_crc.c\ -stm32n6xx_ll_dma2d.c\ -stm32n6xx_ll_dma.c\ -stm32n6xx_ll_exti.c\ -stm32n6xx_ll_fmc.c\ -stm32n6xx_ll_gpio.c\ -stm32n6xx_ll_i2c.c\ -stm32n6xx_ll_i3c.c\ -stm32n6xx_ll_lptim.c\ -stm32n6xx_ll_lpuart.c\ -stm32n6xx_ll_pka.c\ -stm32n6xx_ll_pwr.c\ -stm32n6xx_ll_rcc.c\ -stm32n6xx_ll_rng.c\ -stm32n6xx_ll_rtc.c\ -stm32n6xx_ll_sdmmc.c\ -stm32n6xx_ll_spi.c\ -stm32n6xx_ll_tim.c\ -stm32n6xx_ll_ucpd.c\ -stm32n6xx_ll_usart.c\ -stm32n6xx_ll_usb.c\ -stm32n6xx_ll_utils.c\ -stm32n6xx_ll_venc.c\ -stm32n6xx_util_i3c.c\ -) - -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/lib/stm32/stm32.mk b/lib/stm32/stm32.mk new file mode 100644 index 000000000..4b759042a --- /dev/null +++ b/lib/stm32/stm32.mk @@ -0,0 +1,263 @@ +# This file is part of the OpenMV project. +# +# Copyright (c) 2013-2021 Ibrahim Abdelkader +# Copyright (c) 2013-2021 Kwabena W. Agyeman +# +# This work is licensed under the MIT license, see the file LICENSE for details. +# +# STHAL Makefile +ifeq ($(MCU_SERIES),f4) +HAL_SRC_C += $(addprefix stm32/f4/src/,\ + stm32f4xx_hal_adc.c \ + stm32f4xx_hal_adc_ex.c \ + stm32f4xx_hal_dac.c \ + stm32f4xx_hal_dac_ex.c \ + stm32f4xx_hal.c \ + stm32f4xx_hal_cortex.c \ + stm32f4xx_hal_dcmi.c \ + stm32f4xx_hal_dma.c \ + stm32f4xx_hal_dma_ex.c \ + stm32f4xx_hal_dma2d.c \ + stm32f4xx_hal_flash.c \ + stm32f4xx_hal_flash_ex.c \ + stm32f4xx_hal_gpio.c \ + stm32f4xx_hal_hcd.c \ + stm32f4xx_hal_i2c.c \ + stm32f4xx_hal_i2c_ex.c \ + stm32f4xx_hal_pcd.c \ + stm32f4xx_hal_pcd_ex.c \ + stm32f4xx_hal_pwr.c \ + stm32f4xx_hal_pwr_ex.c \ + stm32f4xx_hal_rcc.c \ + stm32f4xx_hal_rcc_ex.c \ + stm32f4xx_hal_rng.c \ + stm32f4xx_hal_rtc.c \ + stm32f4xx_hal_rtc_ex.c \ + stm32f4xx_hal_sd.c \ + stm32f4xx_hal_sdram.c \ + stm32f4xx_hal_spi.c \ + stm32f4xx_hal_can.c \ + stm32f4xx_hal_tim.c \ + stm32f4xx_hal_tim_ex.c \ + stm32f4xx_hal_uart.c \ + stm32f4xx_hal_usart.c \ + stm32f4xx_ll_usb.c \ + stm32f4xx_ll_sdmmc.c \ + stm32f4xx_ll_fmc.c \ +) +endif + +ifeq ($(MCU_SERIES),f7) +HAL_SRC_C += $(addprefix stm32/f7/src/,\ + stm32f7xx_hal_adc.c \ + stm32f7xx_hal_adc_ex.c \ + stm32f7xx_hal_dac.c \ + stm32f7xx_hal_dac_ex.c \ + stm32f7xx_hal.c \ + stm32f7xx_hal_cortex.c \ + stm32f7xx_hal_crc.c \ + stm32f7xx_hal_crc_ex.c \ + stm32f7xx_hal_dcmi.c \ + stm32f7xx_hal_dma.c \ + stm32f7xx_hal_dma_ex.c \ + stm32f7xx_hal_dma2d.c \ + stm32f7xx_hal_flash.c \ + stm32f7xx_hal_flash_ex.c \ + stm32f7xx_hal_gpio.c \ + stm32f7xx_hal_hcd.c \ + stm32f7xx_hal_i2c.c \ + stm32f7xx_hal_i2c_ex.c \ + stm32f7xx_hal_pcd.c \ + stm32f7xx_hal_pcd_ex.c \ + stm32f7xx_hal_pwr.c \ + stm32f7xx_hal_pwr_ex.c \ + stm32f7xx_hal_rcc.c \ + stm32f7xx_hal_rcc_ex.c \ + stm32f7xx_hal_rng.c \ + stm32f7xx_hal_rtc.c \ + stm32f7xx_hal_rtc_ex.c \ + stm32f7xx_hal_sd.c \ + stm32f7xx_hal_sdram.c \ + stm32f7xx_hal_spi.c \ + stm32f7xx_hal_can.c \ + stm32f7xx_hal_tim.c \ + stm32f7xx_hal_tim_ex.c \ + stm32f7xx_hal_uart.c \ + stm32f7xx_hal_usart.c \ + stm32f7xx_hal_jpeg.c \ + stm32f7xx_ll_usb.c \ + stm32f7xx_ll_sdmmc.c \ + stm32f7xx_ll_fmc.c \ +) +endif + +ifeq ($(MCU_SERIES),h7) +HAL_SRC_C += $(addprefix stm32/h7/src/,\ + stm32h7xx_hal_adc.c \ + stm32h7xx_hal_adc_ex.c \ + stm32h7xx_hal_dac.c \ + stm32h7xx_hal_dac_ex.c \ + stm32h7xx_hal_dsi.c \ + stm32h7xx_hal.c \ + stm32h7xx_hal_cortex.c \ + stm32h7xx_hal_crc.c \ + stm32h7xx_hal_crc_ex.c \ + stm32h7xx_hal_dcmi.c \ + stm32h7xx_hal_dfsdm.c \ + stm32h7xx_hal_dfsdm_ex.c \ + stm32h7xx_hal_dma.c \ + stm32h7xx_hal_dma_ex.c \ + stm32h7xx_hal_dma2d.c \ + stm32h7xx_hal_mdma.c \ + stm32h7xx_hal_flash.c \ + stm32h7xx_hal_flash_ex.c \ + stm32h7xx_hal_gpio.c \ + stm32h7xx_hal_hcd.c \ + stm32h7xx_hal_hsem.c \ + stm32h7xx_hal_i2c.c \ + stm32h7xx_hal_i2c_ex.c \ + stm32h7xx_hal_ltdc.c \ + stm32h7xx_hal_ltdc_ex.c \ + stm32h7xx_hal_pcd.c \ + stm32h7xx_hal_pcd_ex.c \ + stm32h7xx_hal_pwr.c \ + stm32h7xx_hal_pwr_ex.c \ + stm32h7xx_hal_rcc.c \ + stm32h7xx_hal_rcc_ex.c \ + stm32h7xx_hal_rng.c \ + stm32h7xx_hal_rtc.c \ + stm32h7xx_hal_rtc_ex.c \ + stm32h7xx_hal_sai.c \ + stm32h7xx_hal_sai_ex.c \ + stm32h7xx_hal_sd.c \ + stm32h7xx_hal_sdram.c \ + stm32h7xx_hal_spi.c \ + stm32h7xx_hal_fdcan.c \ + stm32h7xx_hal_tim.c \ + stm32h7xx_hal_tim_ex.c \ + stm32h7xx_hal_uart.c \ + stm32h7xx_hal_usart.c \ + stm32h7xx_hal_jpeg.c \ + stm32h7xx_hal_qspi.c \ + stm32h7xx_ll_rcc.c \ + stm32h7xx_ll_usb.c \ + stm32h7xx_ll_sdmmc.c \ + stm32h7xx_ll_fmc.c \ + stm32h7xx_ll_delayblock.c \ +) +endif + +ifeq ($(MCU_SERIES),n6) +HAL_SRC_C += $(addprefix stm32/n6/src/,\ + stm32n6xx_hal_adc.c \ + stm32n6xx_hal_adc_ex.c \ + stm32n6xx_hal_bsec.c \ + stm32n6xx_hal.c \ + stm32n6xx_hal_cacheaxi.c \ + stm32n6xx_hal_cortex.c \ + stm32n6xx_hal_crc.c \ + stm32n6xx_hal_crc_ex.c \ + stm32n6xx_hal_cryp.c \ + stm32n6xx_hal_cryp_ex.c \ + stm32n6xx_hal_dcmi.c \ + stm32n6xx_hal_dcmipp.c \ + stm32n6xx_hal_dma2d.c \ + stm32n6xx_hal_dma.c \ + stm32n6xx_hal_dma_ex.c \ + stm32n6xx_hal_dts.c \ + stm32n6xx_hal_eth.c \ + stm32n6xx_hal_eth_ex.c \ + stm32n6xx_hal_exti.c \ + stm32n6xx_hal_fdcan.c \ + stm32n6xx_hal_gfxmmu.c \ + stm32n6xx_hal_gfxtim.c \ + stm32n6xx_hal_gpio.c \ + stm32n6xx_hal_gpu2d.c \ + stm32n6xx_hal_hash.c \ + stm32n6xx_hal_hcd.c \ + stm32n6xx_hal_i2c.c \ + stm32n6xx_hal_i2c_ex.c \ + stm32n6xx_hal_i2s.c \ + stm32n6xx_hal_i2s_ex.c \ + stm32n6xx_hal_i3c.c \ + stm32n6xx_hal_icache.c \ + stm32n6xx_hal_irda.c \ + stm32n6xx_hal_iwdg.c \ + stm32n6xx_hal_jpeg.c \ + stm32n6xx_hal_lptim.c \ + stm32n6xx_hal_ltdc.c \ + stm32n6xx_hal_ltdc_ex.c \ + stm32n6xx_hal_mce.c \ + stm32n6xx_hal_mdf.c \ + stm32n6xx_hal_mdios.c \ + stm32n6xx_hal_mmc.c \ + stm32n6xx_hal_mmc_ex.c \ + stm32n6xx_hal_nand.c \ + stm32n6xx_hal_nor.c \ + stm32n6xx_hal_pcd.c \ + stm32n6xx_hal_pcd_ex.c \ + stm32n6xx_hal_pka.c \ + stm32n6xx_hal_pssi.c \ + stm32n6xx_hal_pwr.c \ + stm32n6xx_hal_pwr_ex.c \ + stm32n6xx_hal_ramcfg.c \ + stm32n6xx_hal_rcc.c \ + stm32n6xx_hal_rcc_ex.c \ + stm32n6xx_hal_rif.c \ + stm32n6xx_hal_rng.c \ + stm32n6xx_hal_rng_ex.c \ + stm32n6xx_hal_rtc.c \ + stm32n6xx_hal_rtc_ex.c \ + stm32n6xx_hal_sai.c \ + stm32n6xx_hal_sai_ex.c \ + stm32n6xx_hal_sd.c \ + stm32n6xx_hal_sd_ex.c \ + stm32n6xx_hal_sdram.c \ + stm32n6xx_hal_smartcard.c \ + stm32n6xx_hal_smartcard_ex.c \ + stm32n6xx_hal_smbus.c \ + stm32n6xx_hal_smbus_ex.c \ + stm32n6xx_hal_spdifrx.c \ + stm32n6xx_hal_spi.c \ + stm32n6xx_hal_spi_ex.c \ + stm32n6xx_hal_sram.c \ + stm32n6xx_hal_tim.c \ + stm32n6xx_hal_tim_ex.c \ + stm32n6xx_hal_uart.c \ + stm32n6xx_hal_uart_ex.c \ + stm32n6xx_hal_usart.c \ + stm32n6xx_hal_usart_ex.c \ + stm32n6xx_hal_wwdg.c \ + stm32n6xx_hal_xspi.c \ + stm32n6xx_ll_adc.c \ + stm32n6xx_ll_crc.c \ + stm32n6xx_ll_dma2d.c \ + stm32n6xx_ll_dma.c \ + stm32n6xx_ll_exti.c \ + stm32n6xx_ll_fmc.c \ + stm32n6xx_ll_gpio.c \ + stm32n6xx_ll_i2c.c \ + stm32n6xx_ll_i3c.c \ + stm32n6xx_ll_lptim.c \ + stm32n6xx_ll_lpuart.c \ + stm32n6xx_ll_pka.c \ + stm32n6xx_ll_pwr.c \ + stm32n6xx_ll_rcc.c \ + stm32n6xx_ll_rng.c \ + stm32n6xx_ll_rtc.c \ + stm32n6xx_ll_sdmmc.c \ + stm32n6xx_ll_spi.c \ + stm32n6xx_ll_tim.c \ + stm32n6xx_ll_ucpd.c \ + stm32n6xx_ll_usart.c \ + stm32n6xx_ll_usb.c \ + stm32n6xx_ll_utils.c \ + stm32n6xx_ll_venc.c \ + stm32n6xx_util_i3c.c \ +) +endif + +HAL_CFLAGS += -I$(TOP_DIR)/lib/stm32/$(MCU_SERIES)/include +HAL_CFLAGS += -I$(TOP_DIR)/lib/stm32/$(MCU_SERIES)/include/Legacy + +OMV_FIRM_OBJ += $(addprefix $(BUILD)/lib/, $(HAL_SRC_C:.c=.o)) diff --git a/lib/tflm/Makefile b/lib/tflm/Makefile deleted file mode 100644 index 8fcebbad7..000000000 --- a/lib/tflm/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# This file is part of the OpenMV project. -# -# Copyright (c) 2013-2024 Ibrahim Abdelkader -# Copyright (c) 2013-2024 Kwabena W. Agyeman -# -# This work is licensed under the MIT license, see the file LICENSE for details. -# -# TFLM Makefile -LIB_OBJS = $(BUILD)/tflm_backend.o -OBJ_DIRS = $(sort $(dir $(LIB_OBJS))) - -override CFLAGS := $(CFLAGS) -Wno-unused-variable - -# Extra module flags. -CXXFLAGS += $(filter-out -std=gnu99 -std=gnu11,$(CFLAGS)) \ - -std=c++11 \ - -fno-rtti \ - -fno-exceptions \ - -fno-use-cxa-atexit \ - -nodefaultlibs \ - -fno-unwind-tables \ - -fpermissive \ - -fmessage-length=0 \ - -fno-threadsafe-statics \ - -Wno-double-promotion \ - -Wno-float-conversion - -CXXFLAGS += -DTF_LITE_STATIC_MEMORY \ - -DTF_LITE_DISABLE_X86_NEON \ - -DKERNELS_OPTIMIZED_FOR_SPEED \ - -DTF_LITE_STRIP_ERROR_STRINGS \ - -I$(TOP_DIR)/lib/tflm/libtflm/include/ \ - -I$(TOP_DIR)/lib/tflm/libtflm/include/third_party/ \ - -I$(TOP_DIR)/lib/tflm/libtflm/include/third_party/gemmlowp/ \ - -I$(TOP_DIR)/lib/tflm/libtflm/include/third_party/flatbuffers/include/ - -# Add CubeAI module if enabled. -ifeq ($(MICROPY_PY_CUBEAI), 1) -SRC_USERMOD += $(OMV_MOD_DIR)/../../stm32cubeai/py_st_nn.c -endif - -all: $(LIB_OBJS) | $(OBJ_DIRS) - -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.cc - $(ECHO) "CXX $<" - $(CC) $(CXXFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(LIB_OBJS:%.o=%.d) diff --git a/lib/tflm/tflm.mk b/lib/tflm/tflm.mk new file mode 100644 index 000000000..1ff698e96 --- /dev/null +++ b/lib/tflm/tflm.mk @@ -0,0 +1,55 @@ +# SPDX-License-Identifier: MIT +# +# Copyright (C) 2025 OpenMV, LLC. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# TFLM Makefile + +ifeq ($(MICROPY_PY_ML_TFLM), 1) +TFLM_SRC_CC = tflm_backend.cc + +$(BUILD)/lib/tflm/tflm_backend.o: CXXFLAGS = \ + $(filter-out -std=gnu99 -std=gnu11,$(CFLAGS)) \ + -std=c++11 \ + -fno-rtti \ + -fno-exceptions \ + -fno-use-cxa-atexit \ + -nodefaultlibs \ + -fno-unwind-tables \ + -fpermissive \ + -fmessage-length=0 \ + -fno-threadsafe-statics \ + -Wno-double-promotion \ + -Wno-float-conversion \ + -DTF_LITE_STATIC_MEMORY \ + -DTF_LITE_DISABLE_X86_NEON \ + -DKERNELS_OPTIMIZED_FOR_SPEED \ + -DTF_LITE_STRIP_ERROR_STRINGS \ + -I$(TOP_DIR)/lib/tflm/libtflm/include \ + -I$(TOP_DIR)/lib/tflm/libtflm/include/third_party \ + -I$(TOP_DIR)/lib/tflm/libtflm/include/third_party/gemmlowp \ + -I$(TOP_DIR)/lib/tflm/libtflm/include/third_party/flatbuffers/include \ + -I$(TOP_DIR)/lib/tflm/libtflm/include/third_party/ethos_u_core_driver/include + +OMV_CFLAGS += -I$(TOP_DIR)/lib/tflm/libtflm/include +OMV_CFLAGS += -I$(TOP_DIR)/lib/tflm/libtflm/include/third_party/ethos_u_core_driver/include + +OMV_FIRM_OBJ += $(addprefix $(BUILD)/lib/tflm/, $(TFLM_SRC_CC:.cc=.o)) +endif diff --git a/drivers/vl53l8cx/Makefile b/ports/ports.mk similarity index 75% rename from drivers/vl53l8cx/Makefile rename to ports/ports.mk index 160a318ad..d41a2615a 100644 --- a/drivers/vl53l8cx/Makefile +++ b/ports/ports.mk @@ -20,23 +20,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # -# VL53L8CX Makefile -override CFLAGS += -Os +# Ports Makefile -SRCS = $(wildcard src/*.c) -OBJS = $(addprefix $(BUILD)/, $(SRCS:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) +CFLAGS += -I$(TOP_DIR)/ports/$(PORT) +CFLAGS += -I$(TOP_DIR)/ports/$(PORT)/modules -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) +PORT_SRC_C = $(wildcard ports/$(PORT)/*.c) +OMV_FIRM_OBJ += $(addprefix $(BUILD)/, $(PORT_SRC_C:.c=.o))