mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Cleanup Makefile.
* Rename binary files. * Misc cleanups
This commit is contained in:
parent
9631813f7f
commit
1f150c1847
Binary file not shown.
131
src/Makefile
131
src/Makefile
@ -1,5 +1,6 @@
|
|||||||
BIN = openmv
|
OPENMV = openmv
|
||||||
BOOT_BIN= bootloader
|
BOOTLOADER = bootloader
|
||||||
|
FIRMWARE = firmware
|
||||||
CC = arm-none-eabi-gcc
|
CC = arm-none-eabi-gcc
|
||||||
AS = arm-none-eabi-as
|
AS = arm-none-eabi-as
|
||||||
LD = arm-none-eabi-ld
|
LD = arm-none-eabi-ld
|
||||||
@ -89,23 +90,23 @@ BOOT_LDFLAGS = -mcpu=cortex-m4 -mabi=aapcs-linux -mthumb -mlittle-endian -mfloat
|
|||||||
-mfpu=fpv4-sp-d16 -nostdlib -Wl,--gc-sections -Wl,-T$(BUILD)/$(BOOT_DIR)/stm32f4xx.lds
|
-mfpu=fpv4-sp-d16 -nostdlib -Wl,--gc-sections -Wl,-T$(BUILD)/$(BOOT_DIR)/stm32f4xx.lds
|
||||||
|
|
||||||
#------------- Libraries ----------------#
|
#------------- Libraries ----------------#
|
||||||
#OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/st/*.o)
|
#FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/st/*.o)
|
||||||
OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/CommonTables/*.o)
|
FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/CommonTables/*.o)
|
||||||
OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/FastMathFunctions/*.o)
|
FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/FastMathFunctions/*.o)
|
||||||
OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/MatrixFunctions/*.o)
|
FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/MatrixFunctions/*.o)
|
||||||
#OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/ComplexMathFunctions/*.o)
|
#FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/ComplexMathFunctions/*.o)
|
||||||
#OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/ControllerFunctions/*.o)
|
#FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/ControllerFunctions/*.o)
|
||||||
#OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/FilteringFunctions/*.o)
|
#FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/FilteringFunctions/*.o)
|
||||||
#OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/StatisticsFunctions/*.o)
|
#FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/StatisticsFunctions/*.o)
|
||||||
#OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/SupportFunctions/*.o)
|
#FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/SupportFunctions/*.o)
|
||||||
#OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/TransformFunctions/*.o)
|
#FIRM_OBJ += $(wildcard $(BUILD)/$(CMSIS_DIR)/src/dsp/TransformFunctions/*.o)
|
||||||
OBJ += $(wildcard $(BUILD)/$(STHAL_DIR)/src/*.o)
|
FIRM_OBJ += $(wildcard $(BUILD)/$(STHAL_DIR)/src/*.o)
|
||||||
OBJ += $(wildcard $(BUILD)/$(FATFS_DIR)/src/*.o)
|
FIRM_OBJ += $(wildcard $(BUILD)/$(FATFS_DIR)/src/*.o)
|
||||||
OBJ += $(wildcard $(BUILD)/$(FATFS_DIR)/src/option/*.o)
|
FIRM_OBJ += $(wildcard $(BUILD)/$(FATFS_DIR)/src/option/*.o)
|
||||||
OBJ += $(wildcard $(BUILD)/$(WINC1500_DIR)/src/*.o)
|
FIRM_OBJ += $(wildcard $(BUILD)/$(WINC1500_DIR)/src/*.o)
|
||||||
|
|
||||||
#------------- OpenMV Objects ----------------#
|
#------------- OpenMV Objects ----------------#
|
||||||
OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/, \
|
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/, \
|
||||||
main.o \
|
main.o \
|
||||||
xalloc.o \
|
xalloc.o \
|
||||||
fb_alloc.o \
|
fb_alloc.o \
|
||||||
@ -123,16 +124,16 @@ OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/, \
|
|||||||
)
|
)
|
||||||
|
|
||||||
ifeq ($(TARGET), OPENMV1)
|
ifeq ($(TARGET), OPENMV1)
|
||||||
OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/, \
|
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/, \
|
||||||
sdcard_spi.o \
|
sdcard_spi.o \
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/, \
|
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/, \
|
||||||
sdcard_sdio.o \
|
sdcard_sdio.o \
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/img/,\
|
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/img/,\
|
||||||
blob.o \
|
blob.o \
|
||||||
fmath.o \
|
fmath.o \
|
||||||
fsort.o \
|
fsort.o \
|
||||||
@ -168,7 +169,7 @@ OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/img/,\
|
|||||||
im_filter.o \
|
im_filter.o \
|
||||||
)
|
)
|
||||||
|
|
||||||
OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/py/, \
|
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/py/, \
|
||||||
py_helper.o \
|
py_helper.o \
|
||||||
py_sensor.o \
|
py_sensor.o \
|
||||||
py_image.o \
|
py_image.o \
|
||||||
@ -181,22 +182,22 @@ OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/py/, \
|
|||||||
)
|
)
|
||||||
|
|
||||||
ifeq ($(TARGET), OPENMV1)
|
ifeq ($(TARGET), OPENMV1)
|
||||||
OBJ += $(addprefix $(BUILD)/$(CMSIS_DIR)/src/st/,\
|
FIRM_OBJ += $(addprefix $(BUILD)/$(CMSIS_DIR)/src/st/,\
|
||||||
system_stm32f4xx.o \
|
system_stm32f4xx.o \
|
||||||
startup_stm32f407xx.o \
|
startup_stm32f407xx.o \
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
OBJ += $(addprefix $(BUILD)/$(CMSIS_DIR)/src/st/,\
|
FIRM_OBJ += $(addprefix $(BUILD)/$(CMSIS_DIR)/src/st/,\
|
||||||
system_stm32f4xx.o \
|
system_stm32f4xx.o \
|
||||||
startup_stm32f427xx.o \
|
startup_stm32f427xx.o \
|
||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#------------- MicroPy Core -------------------#
|
#------------- MicroPy Core -------------------#
|
||||||
OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/py/*.o)
|
FIRM_OBJ += $(wildcard $(BUILD)/$(MICROPY_DIR)/py/*.o)
|
||||||
|
|
||||||
#------------- MicroPy Objects ----------------#
|
#------------- MicroPy Objects ----------------#
|
||||||
OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
|
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
|
||||||
stm32f4xx_it.o \
|
stm32f4xx_it.o \
|
||||||
usbd_conf.o \
|
usbd_conf.o \
|
||||||
usbd_desc.o \
|
usbd_desc.o \
|
||||||
@ -248,13 +249,13 @@ OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\
|
|||||||
)
|
)
|
||||||
|
|
||||||
#------------- MicroPy Objects ----------------#
|
#------------- MicroPy Objects ----------------#
|
||||||
OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/,\
|
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/,\
|
||||||
libc/string0.o \
|
libc/string0.o \
|
||||||
netutils/netutils.o \
|
netutils/netutils.o \
|
||||||
timeutils/timeutils.o \
|
timeutils/timeutils.o \
|
||||||
)
|
)
|
||||||
|
|
||||||
OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/libm/,\
|
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/libm/,\
|
||||||
math.o \
|
math.o \
|
||||||
asinfacosf.o \
|
asinfacosf.o \
|
||||||
atanf.o \
|
atanf.o \
|
||||||
@ -282,12 +283,12 @@ OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/libm/,\
|
|||||||
wf_tgamma.o \
|
wf_tgamma.o \
|
||||||
)
|
)
|
||||||
|
|
||||||
OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/mp-readline/,\
|
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/mp-readline/,\
|
||||||
readline.o \
|
readline.o \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/usbdev/, \
|
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/usbdev/, \
|
||||||
core/src/usbd_core.o \
|
core/src/usbd_core.o \
|
||||||
core/src/usbd_ctlreq.o \
|
core/src/usbd_ctlreq.o \
|
||||||
core/src/usbd_ioreq.o \
|
core/src/usbd_ioreq.o \
|
||||||
@ -336,63 +337,65 @@ export TOP_DIR
|
|||||||
export BUILD
|
export BUILD
|
||||||
export TARGET
|
export TARGET
|
||||||
###################################################
|
###################################################
|
||||||
all: $(BUILD)/firmware.dfu
|
all: $(OPENMV)
|
||||||
|
|
||||||
$(BUILD):
|
$(BUILD):
|
||||||
$(MKDIR) -p $@
|
$(MKDIR) -p $@
|
||||||
|
|
||||||
objs: | $(BUILD)
|
BOOTLOADER_OBJS:
|
||||||
|
$(MAKE) -C $(BOOT_DIR) BUILD=$(BUILD)/$(BOOT_DIR)
|
||||||
|
|
||||||
|
FIRMWARE_OBJS:
|
||||||
$(MAKE) -C $(CMSIS_DIR) BUILD=$(BUILD)/$(CMSIS_DIR)
|
$(MAKE) -C $(CMSIS_DIR) BUILD=$(BUILD)/$(CMSIS_DIR)
|
||||||
$(MAKE) -C $(STHAL_DIR) BUILD=$(BUILD)/$(STHAL_DIR)
|
$(MAKE) -C $(STHAL_DIR) BUILD=$(BUILD)/$(STHAL_DIR)
|
||||||
$(MAKE) -C $(FATFS_DIR) BUILD=$(BUILD)/$(FATFS_DIR)
|
$(MAKE) -C $(FATFS_DIR) BUILD=$(BUILD)/$(FATFS_DIR)
|
||||||
$(MAKE) -C $(MICROPY_DIR)/stmhal BUILD=$(BUILD)/$(MICROPY_DIR) BOARD=$(TARGET) QSTR_DEFS=$(OMV_QSTR_DEFS)
|
$(MAKE) -C $(MICROPY_DIR)/stmhal BUILD=$(BUILD)/$(MICROPY_DIR) BOARD=$(TARGET) QSTR_DEFS=$(OMV_QSTR_DEFS)
|
||||||
$(MAKE) -C $(OMV_DIR) BUILD=$(BUILD)/$(OMV_DIR)
|
|
||||||
$(MAKE) -C $(WINC1500_DIR) BUILD=$(BUILD)/$(WINC1500_DIR)
|
$(MAKE) -C $(WINC1500_DIR) BUILD=$(BUILD)/$(WINC1500_DIR)
|
||||||
|
$(MAKE) -C $(OMV_DIR) BUILD=$(BUILD)/$(OMV_DIR)
|
||||||
|
|
||||||
boot_objs: | $(BUILD)
|
# This target generates the main/app firmware image located at 0x08010000
|
||||||
$(MAKE) -C $(BOOT_DIR) BUILD=$(BUILD)/$(BOOT_DIR)
|
$(FIRMWARE): FIRMWARE_OBJS
|
||||||
|
|
||||||
$(BUILD)/$(BIN).bin: objs
|
|
||||||
$(CCP) -P -E -D$(TARGET) $(OMV_DIR)/stm32f4xx.ld.S > $(BUILD)/stm32f4xx.lds
|
$(CCP) -P -E -D$(TARGET) $(OMV_DIR)/stm32f4xx.ld.S > $(BUILD)/stm32f4xx.lds
|
||||||
$(CC) $(LDFLAGS) $(OBJ) $(LIB) -o $(FW_DIR)/$(BIN).elf
|
$(CC) $(LDFLAGS) $(FIRM_OBJ) -o $(FW_DIR)/$(FIRMWARE).elf
|
||||||
$(OBJCOPY) -Obinary $(FW_DIR)/$(BIN).elf $(FW_DIR)/$(BIN).bin
|
$(OBJCOPY) -Obinary $(FW_DIR)/$(FIRMWARE).elf $(FW_DIR)/$(FIRMWARE).bin
|
||||||
$(PYTHON) $(DFU) -b 0x08010000:$(FW_DIR)/$(BIN).bin $(FW_DIR)/$(BIN).dfu
|
$(PYTHON) $(DFU) -b 0x08010000:$(FW_DIR)/$(FIRMWARE).bin $(FW_DIR)/$(FIRMWARE).dfu
|
||||||
$(SIZE) $(FW_DIR)/$(BIN).elf
|
|
||||||
|
|
||||||
# This target generates the bootloader. It generats the bootloader binary twice,
|
# This target generates the bootloader. The bootloader binary is generated twice,
|
||||||
# The first time without padding, to generate the bootloader.dfu. Second time
|
# once without padding, to generate the bootloader.dfu file, and once with padding
|
||||||
# with padding up to the main fw image, to generate a contiguous firmware.bin image.
|
# up to the main fw image (0x08010000), to generate a contiguous firmware.bin image.
|
||||||
$(BUILD)/$(BOOT_BIN).bin: boot_objs
|
$(BOOTLOADER): BOOTLOADER_OBJS
|
||||||
$(CCP) -P -E -D$(TARGET) $(BOOT_DIR)/stm32f4xx.ld.S > $(BUILD)/$(BOOT_DIR)/stm32f4xx.lds
|
$(CCP) -P -E -D$(TARGET) $(BOOT_DIR)/stm32f4xx.ld.S > $(BUILD)/$(BOOT_DIR)/stm32f4xx.lds
|
||||||
$(CC) $(BOOT_LDFLAGS) $(BOOT_OBJ) -o $(FW_DIR)/$(BOOT_BIN).elf
|
$(CC) $(BOOT_LDFLAGS) $(BOOT_OBJ) -o $(FW_DIR)/$(BOOTLOADER).elf
|
||||||
$(OBJCOPY) -Obinary $(FW_DIR)/$(BOOT_BIN).elf $(FW_DIR)/$(BOOT_BIN).bin
|
$(OBJCOPY) -Obinary $(FW_DIR)/$(BOOTLOADER).elf $(FW_DIR)/$(BOOTLOADER).bin
|
||||||
$(PYTHON) $(DFU) -b 0x08000000:$(FW_DIR)/$(BOOT_BIN).bin $(FW_DIR)/$(BOOT_BIN).dfu
|
$(PYTHON) $(DFU) -b 0x08000000:$(FW_DIR)/$(BOOTLOADER).bin $(FW_DIR)/$(BOOTLOADER).dfu
|
||||||
$(OBJCOPY) -Obinary --pad-to=0x08010000 $(FW_DIR)/$(BOOT_BIN).elf $(FW_DIR)/$(BOOT_BIN).bin
|
$(OBJCOPY) -Obinary --pad-to=0x08010000 $(FW_DIR)/$(BOOTLOADER).elf $(FW_DIR)/$(BOOTLOADER).bin
|
||||||
$(SIZE) $(FW_DIR)/$(BOOT_BIN).elf
|
|
||||||
|
|
||||||
$(BUILD)/firmware.dfu: $(BUILD)/$(BIN).bin $(BUILD)/$(BOOT_BIN).bin
|
# This target generates a combined bootloader+main firmware image.
|
||||||
cat $(FW_DIR)/$(BOOT_BIN).bin $(FW_DIR)/$(BIN).bin > $(FW_DIR)/firmware.bin
|
$(OPENMV): $(BUILD) $(FIRMWARE) $(BOOTLOADER)
|
||||||
$(PYTHON) $(DFU) -b 0x08000000:$(FW_DIR)/$(BOOT_BIN).bin -b 0x08010000:$(FW_DIR)/$(BIN).bin $(FW_DIR)/firmware.dfu
|
cat $(FW_DIR)/$(BOOTLOADER).bin $(FW_DIR)/$(FIRMWARE).bin > $(FW_DIR)/$(OPENMV).bin
|
||||||
|
$(PYTHON) $(DFU) -b 0x08000000:$(FW_DIR)/$(BOOTLOADER).bin -b 0x08010000:$(FW_DIR)/$(FIRMWARE).bin $(FW_DIR)/$(OPENMV).dfu
|
||||||
|
$(SIZE) $(FW_DIR)/$(BOOTLOADER).elf
|
||||||
|
$(SIZE) $(FW_DIR)/$(FIRMWARE).elf
|
||||||
|
|
||||||
size:
|
size:
|
||||||
$(SIZE) $(FW_DIR)/$(BIN).elf
|
$(SIZE) $(FW_DIR)/$(BOOTLOADER).elf
|
||||||
$(SIZE) $(FW_DIR)/$(BOOT_BIN).elf
|
$(SIZE) $(FW_DIR)/$(FIRMWARE).elf
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) -fr $(BUILD)
|
$(RM) -fr $(BUILD)
|
||||||
|
|
||||||
# Flash the main firmware image
|
|
||||||
flash_image::
|
|
||||||
../usr/pydfu.py -u $(FW_DIR)/$(BIN).dfu
|
|
||||||
|
|
||||||
# Flash the bootloader
|
# Flash the bootloader
|
||||||
flash_boot::
|
flash_boot::
|
||||||
../usr/pydfu.py -u $(FW_DIR)/$(BOOT_BIN).dfu
|
../usr/pydfu.py -u $(FW_DIR)/$(BOOTLOADER).dfu
|
||||||
|
|
||||||
# Flash the bootloader + main firmware image
|
# Flash the main firmware image
|
||||||
flash::
|
flash_image::
|
||||||
../usr/pydfu.py -m -u $(FW_DIR)/firmware.dfu
|
../usr/pydfu.py -u $(FW_DIR)/$(FIRMWARE).dfu
|
||||||
|
|
||||||
# Flash the bootloader + main firmware image
|
# Flash the bootloader + main firmware image (DFU)
|
||||||
|
flash_dfu::
|
||||||
|
../usr/pydfu.py -m -u $(FW_DIR)/$(OPENMV).dfu
|
||||||
|
|
||||||
|
# Flash the bootloader + main firmware image (binary)
|
||||||
flash_bin::
|
flash_bin::
|
||||||
../usr/pydfu.py -m -u $(FW_DIR)/firmware.bin
|
../usr/pydfu.py -m -u $(FW_DIR)/$(OPENMV).bin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user