diff --git a/src/Makefile b/src/Makefile index 302f094ea..fa234cbef 100755 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ # This file is part of the OpenMV project. # -# Copyright (c) 2013-2019 Ibrahim Abdelkader -# Copyright (c) 2013-2019 Kwabena W. Agyeman +# 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. # @@ -195,5 +195,8 @@ 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 + clean: $(RM) -fr $(BUILD) diff --git a/src/omv/common/export.mk b/src/omv/common/export.mk new file mode 100644 index 000000000..7c434cc13 --- /dev/null +++ b/src/omv/common/export.mk @@ -0,0 +1,77 @@ +# 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. +# +# Tools, directories and common variables that need to be exported when calling +# sub-Makefiles. + +# Export Commands +export Q +export CC +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 Flags +export CFLAGS +export AFLAGS +export LDFLAGS +export MPY_CFLAGS + +# Export variables +export TARGET +export FIRMWARE +export SYSTEM +export STARTUP +export MICROPY_ARGS +export FROZEN_MANIFEST + +# Export board config variables +export PORT +export HAL_DIR +export MCU +export MCU_SERIES +export MCU_VARIANT +export MCU_CORE + +# Export Directories +export TOP_DIR +export BUILD +export TOOLS +export FW_DIR +export OMV_DIR +export CMSIS_DIR +export MICROPY_DIR +export LEPTON_DIR +export LSM6DS3_DIR +export LSM6DSOX_DIR +export WINC1500_DIR +export MLX90621_DIR +export MLX90640_DIR +export MLX90641_DIR +export VL53L5CX_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/src/omv/ports/mimxrt/omv_portconfig.mk b/src/omv/ports/mimxrt/omv_portconfig.mk index bd02b1ee1..e9918206d 100644 --- a/src/omv/ports/mimxrt/omv_portconfig.mk +++ b/src/omv/ports/mimxrt/omv_portconfig.mk @@ -1,6 +1,6 @@ -# Set startup and system files based on MCU. -SYSTEM ?= mimxrt/system_$(MCU_SERIES) -STARTUP ?= mimxrt/startup_$(MCU_SERIES) +# Set startup and system files for CMSIS Makefile. +SYSTEM ?= mimxrt/system_$(MCU_SERIES) +STARTUP ?= mimxrt/startup_$(MCU_SERIES) LDSCRIPT ?= mimxrt # Compiler Flags @@ -511,34 +511,6 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ ) endif -################################################### -#Export Variables -export Q -export CC -export CXX -export AS -export LD -export AR -export SIZE -export OBJCOPY -export OBJDUMP -export MKDIR -export ECHO -export CFLAGS -export AFLAGS -export LDFLAGS -export TOP_DIR -export BUILD -export TOOLS -export TARGET -export STARTUP -export SYSTEM -export FROZEN_MANIFEST -export PORT -export HAL_DIR -export CMSIS_DIR -export PYTHON -export TFLITE2C ################################################### all: $(OPENMV) diff --git a/src/omv/ports/nrf/omv_portconfig.mk b/src/omv/ports/nrf/omv_portconfig.mk index 38eb97c01..d7126641e 100644 --- a/src/omv/ports/nrf/omv_portconfig.mk +++ b/src/omv/ports/nrf/omv_portconfig.mk @@ -2,7 +2,7 @@ SYSTEM ?= nrf/system_nrf52840 STARTUP ?= nrf/startup_$(shell echo $(MCU) | tr '[:upper:]' '[:lower:]') LDSCRIPT ?= nrf52xxx -SD_DIR = $(TOP_DIR)/drivers/nrf +export SD_DIR = $(TOP_DIR)/drivers/nrf # Compiler Flags CFLAGS += -std=gnu99 -Wall -Werror -Warray-bounds -mthumb -nostartfiles -fdata-sections -ffunction-sections @@ -369,28 +369,6 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/code/,\ ) endif -################################################### -#Export Variables -export Q -export CC -export AS -export LD -export AR -export SIZE -export OBJCOPY -export OBJDUMP -export MKDIR -export ECHO -export CFLAGS -export LDFLAGS -export TOP_DIR -export BUILD -export TARGET -export STARTUP -export SYSTEM -export FROZEN_MANIFEST -export PORT -export SD_DIR ################################################### all: $(OPENMV) diff --git a/src/omv/ports/rp2/omv_portconfig.mk b/src/omv/ports/rp2/omv_portconfig.mk index 57676c005..d432fdc00 100644 --- a/src/omv/ports/rp2/omv_portconfig.mk +++ b/src/omv/ports/rp2/omv_portconfig.mk @@ -8,9 +8,7 @@ # RP2 Makefile. # This just invokes make in MicroPython RP2 port with OpenMV's cmake arg. -export PORT -export TARGET -export TOP_DIR +export Q= export CC= export CXX= diff --git a/src/omv/ports/stm32/omv_portconfig.mk b/src/omv/ports/stm32/omv_portconfig.mk index c72fb44da..c75589106 100644 --- a/src/omv/ports/stm32/omv_portconfig.mk +++ b/src/omv/ports/stm32/omv_portconfig.mk @@ -1,6 +1,7 @@ -# Set startup and system files based on MCU. -SYSTEM ?= st/system_stm32fxxx -STARTUP ?= st/startup_$(shell echo $(MCU) | tr '[:upper:]' '[:lower:]') +# Set startup and system files for CMSIS Makefile. +SYSTEM ?= st/system_stm32fxxx +STARTUP ?= st/startup_$(shell echo $(MCU) | tr '[:upper:]' '[:lower:]') + LDSCRIPT ?= stm32fxxx # Compiler Flags @@ -645,32 +646,6 @@ UVC_OBJ += $(wildcard $(BUILD)/$(VL53L5CX_DIR)/src/*.o) UVC_OBJ += $(wildcard $(BUILD)/$(PIXART_DIR)/src/*.o) endif -################################################### -#Export Variables -export Q -export CC -export AS -export LD -export AR -export SIZE -export OBJCOPY -export OBJDUMP -export MKDIR -export ECHO -export CFLAGS -export LDFLAGS -export TOP_DIR -export BUILD -export TOOLS -export TARGET -export STARTUP -export SYSTEM -export FROZEN_MANIFEST -export PORT -export HAL_DIR -export CMSIS_DIR -export PYTHON -export TFLITE2C ################################################### all: $(OPENMV)