Cleanup Makefile
This commit is contained in:
@@ -42,6 +42,7 @@ HOST_CC := gcc
|
|||||||
endif
|
endif
|
||||||
HOST_OUTPUT_DIR=Objects/host
|
HOST_OUTPUT_DIR=Objects/host
|
||||||
|
|
||||||
|
# DFU packing address to use
|
||||||
DEVICE_DFU_ADDRESS=0x08000000
|
DEVICE_DFU_ADDRESS=0x08000000
|
||||||
DEVICE_DFU_VID_PID=0x28E9:0x0189
|
DEVICE_DFU_VID_PID=0x28E9:0x0189
|
||||||
# Enumerate all of the include directories
|
# Enumerate all of the include directories
|
||||||
@@ -63,16 +64,19 @@ MHP30_STARTUP_DIR = ./Startup
|
|||||||
MHP30_INC_DIR = ./Core/BSP/MHP30
|
MHP30_INC_DIR = ./Core/BSP/MHP30
|
||||||
MHP30_LD_FILE = ./Core/BSP/MHP30/stm32f103.ld
|
MHP30_LD_FILE = ./Core/BSP/MHP30/stm32f103.ld
|
||||||
|
|
||||||
FRTOS_CMIS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
|
|
||||||
FRTOS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/include
|
|
||||||
DRIVER_INC_DIR =./Core/Drivers
|
|
||||||
BSP_INC_DIR = ./Core/BSP
|
|
||||||
THREADS_INC_DIR = ./Core/Threads
|
|
||||||
PINE_INC_DIR = ./Core/BSP/Pine64
|
PINE_INC_DIR = ./Core/BSP/Pine64
|
||||||
PINE_VENDOR_INC_DIR = ./Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Include
|
PINE_VENDOR_INC_DIR = ./Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Include
|
||||||
PINE_VENDOR_USB_INC_DIR = ./Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Include/Usb
|
PINE_VENDOR_USB_INC_DIR = ./Core/BSP/Pine64/Vendor/SoC/gd32vf103/Common/Include/Usb
|
||||||
PINE_NMSIS_INC_DIR = ./Core/BSP/Pine64/Vendor/NMSIS/Core/Include
|
PINE_NMSIS_INC_DIR = ./Core/BSP/Pine64/Vendor/NMSIS/Core/Include
|
||||||
PINE_FREERTOS_PORT_INC_DIR = ./Core/BSP/Pine64/Vendor/OS/FreeRTOS/Source/portable/GCC
|
PINE_FREERTOS_PORT_INC_DIR = ./Core/BSP/Pine64/Vendor/OS/FreeRTOS/Source/portable/GCC
|
||||||
|
|
||||||
|
SOURCE_MIDDLEWARES_DIR = ./Middlewares
|
||||||
|
FRTOS_CMIS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
|
||||||
|
FRTOS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/include
|
||||||
|
DRIVER_INC_DIR =./Core/Drivers
|
||||||
|
BSP_INC_DIR = ./Core/BSP
|
||||||
|
THREADS_INC_DIR = ./Core/Threads
|
||||||
|
|
||||||
SOURCE_THREADS_DIR = ./Core/Threads
|
SOURCE_THREADS_DIR = ./Core/Threads
|
||||||
SOURCE_CORE_DIR = ./Core/Src
|
SOURCE_CORE_DIR = ./Core/Src
|
||||||
SOURCE_BRIEFLZ_DIR = ./Core/brieflz
|
SOURCE_BRIEFLZ_DIR = ./Core/brieflz
|
||||||
@@ -80,10 +84,9 @@ SOURCE_DRIVERS_DIR = ./Core/Drivers
|
|||||||
INC_PD_DRIVERS_DIR = ./Core/Drivers/usb-pd/include
|
INC_PD_DRIVERS_DIR = ./Core/Drivers/usb-pd/include
|
||||||
PD_DRIVER_TESTS_DIR = ./Core/Drivers/usb-pd/tests
|
PD_DRIVER_TESTS_DIR = ./Core/Drivers/usb-pd/tests
|
||||||
PD_DRIVER_DIR = ./Core/Drivers/usb-pd
|
PD_DRIVER_DIR = ./Core/Drivers/usb-pd
|
||||||
SOURCE_MIDDLEWARES_DIR = ./Middlewares
|
|
||||||
# Find-all's used for formatting
|
# Find-all's used for formatting
|
||||||
ALL_INCLUDES = $(shell find ./Core -type d \( -path $(BRIEFLZ_INC_DIR) -o -path $(PD_DRIVER_DIR) \) -prune -false -o \( -type f \( -name '*.h' -o -name '*.hpp' \) \) )
|
|
||||||
|
|
||||||
|
ALL_INCLUDES = $(shell find ./Core -type d \( -path $(BRIEFLZ_INC_DIR) -o -path $(PD_DRIVER_DIR) \) -prune -false -o \( -type f \( -name '*.h' -o -name '*.hpp' \) \) )
|
||||||
ALL_SOURCE = $(shell find ./Core -type d \( -path $(SOURCE_BRIEFLZ_DIR) -o -path $(PD_DRIVER_DIR) \) -prune -false -o \( -type f \( -name '*.c' -o -name '*.cpp' \) \) )
|
ALL_SOURCE = $(shell find ./Core -type d \( -path $(SOURCE_BRIEFLZ_DIR) -o -path $(PD_DRIVER_DIR) \) -prune -false -o \( -type f \( -name '*.c' -o -name '*.cpp' \) \) )
|
||||||
|
|
||||||
# Device dependent settings
|
# Device dependent settings
|
||||||
@@ -100,14 +103,10 @@ LDSCRIPT=$(MINIWARE_LD_FILE)
|
|||||||
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
|
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
|
||||||
-D ARM_MATH_CM3 \
|
-D ARM_MATH_CM3 \
|
||||||
-D STM32F10X_MD
|
-D STM32F10X_MD
|
||||||
DEV_LDFLAGS=-Wl,--gc-sections
|
DEV_LDFLAGS=
|
||||||
DEV_AFLAGS=
|
DEV_AFLAGS=
|
||||||
DEV_CFLAGS= -D GCC_ARMCM3 \
|
DEV_CFLAGS=
|
||||||
-D ARM_MATH_CM3 \
|
DEV_CXXFLAGS=
|
||||||
-D STM32F10X_MD
|
|
||||||
DEV_CXXFLAGS= -D GCC_ARMCM3 \
|
|
||||||
-D ARM_MATH_CM3 \
|
|
||||||
-D STM32F10X_MD
|
|
||||||
CPUFLAGS= -mcpu=cortex-m3 \
|
CPUFLAGS= -mcpu=cortex-m3 \
|
||||||
-mthumb \
|
-mthumb \
|
||||||
-mfloat-abi=soft
|
-mfloat-abi=soft
|
||||||
@@ -130,14 +129,10 @@ LDSCRIPT=$(MHP30_LD_FILE)
|
|||||||
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
|
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
|
||||||
-D ARM_MATH_CM3 \
|
-D ARM_MATH_CM3 \
|
||||||
-D STM32F10X_MD
|
-D STM32F10X_MD
|
||||||
DEV_LDFLAGS= -Wl,--gc-sections
|
DEV_LDFLAGS=
|
||||||
DEV_AFLAGS=
|
DEV_AFLAGS=
|
||||||
DEV_CFLAGS= -D GCC_ARMCM3 \
|
DEV_CFLAGS=
|
||||||
-D ARM_MATH_CM3 \
|
DEV_CXXFLAGS=
|
||||||
-D STM32F10X_MD
|
|
||||||
DEV_CXXFLAGS= -D GCC_ARMCM3 \
|
|
||||||
-D ARM_MATH_CM3 \
|
|
||||||
-D STM32F10X_MD
|
|
||||||
CPUFLAGS= -mcpu=cortex-m3 \
|
CPUFLAGS= -mcpu=cortex-m3 \
|
||||||
-mthumb \
|
-mthumb \
|
||||||
-mfloat-abi=soft
|
-mfloat-abi=soft
|
||||||
@@ -165,15 +160,12 @@ bootldr_size=0x0
|
|||||||
# Flags
|
# Flags
|
||||||
CPUFLAGS= -march=rv32imac \
|
CPUFLAGS= -march=rv32imac \
|
||||||
-mabi=ilp32 \
|
-mabi=ilp32 \
|
||||||
-mcmodel=medany -fsigned-char -fno-builtin -fsingle-precision-constant \
|
-mcmodel=medany -fsigned-char -fno-builtin -nostartfiles
|
||||||
-DRTOS_FREERTOS -DDOWNLOAD_MODE=DOWNLOAD_MODE_FLASHXIP
|
DEV_LDFLAGS=-nostartfiles --specs=patch.specs
|
||||||
|
DEV_AFLAGS=
|
||||||
|
DEV_GLOBAL_DEFS= -DRTOS_FREERTOS -DDOWNLOAD_MODE=DOWNLOAD_MODE_FLASHXIP
|
||||||
DEV_LDFLAGS=-nostartfiles -Xlinker --gc-sections -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek --specs=patch.specs
|
DEV_CFLAGS=
|
||||||
DEV_AFLAGS=-nostartfiles -ffreestanding -fno-common -Os -flto
|
DEV_CXXFLAGS=
|
||||||
DEV_GLOBAL_DEFS=
|
|
||||||
DEV_CFLAGS= -MMD -MP -MF "$(@:%.o=%.d)" -MT "$@"
|
|
||||||
DEV_CXXFLAGS= -MMD -MP -MF "$(@:%.o=%.d)" -MT "$@"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INCLUDES = -I$(APP_INC_DIR) \
|
INCLUDES = -I$(APP_INC_DIR) \
|
||||||
@@ -200,12 +192,12 @@ $(shell find $(DEVICE_BSP_DIR) -type f -name '*.cpp') \
|
|||||||
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
|
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
|
||||||
|
|
||||||
# code optimisation ------------------------------------------------------------
|
# code optimisation ------------------------------------------------------------
|
||||||
OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant
|
OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -ffreestanding -fno-common
|
||||||
|
|
||||||
# global defines ---------------------------------------------------------------
|
# global defines ---------------------------------------------------------------
|
||||||
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U
|
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U
|
||||||
|
|
||||||
DEBUG=-g3
|
DEBUG=-g3
|
||||||
ifdef swd_enable
|
ifdef swd_enable
|
||||||
GLOBAL_DEFINES += -DSWD_ENABLE
|
GLOBAL_DEFINES += -DSWD_ENABLE
|
||||||
endif
|
endif
|
||||||
@@ -247,6 +239,7 @@ LINKER_FLAGS= -Wl,--gc-sections \
|
|||||||
-Wl,--undefined=pxCurrentTCB \
|
-Wl,--undefined=pxCurrentTCB \
|
||||||
-Wl,--defsym=__FLASH_SIZE__=$(flash_size) \
|
-Wl,--defsym=__FLASH_SIZE__=$(flash_size) \
|
||||||
-Wl,--defsym=__BOOTLDR_SIZE__=$(bootldr_size) \
|
-Wl,--defsym=__BOOTLDR_SIZE__=$(bootldr_size) \
|
||||||
|
-Wl,--print-memory-usage \
|
||||||
-flto \
|
-flto \
|
||||||
--specs=nosys.specs \
|
--specs=nosys.specs \
|
||||||
--specs=nano.specs \
|
--specs=nano.specs \
|
||||||
@@ -299,8 +292,6 @@ CXXFLAGS=$(DEV_CXXFLAGS) \
|
|||||||
$(CHECKOPTIONS) \
|
$(CHECKOPTIONS) \
|
||||||
-std=c++14 \
|
-std=c++14 \
|
||||||
$(OPTIM) \
|
$(OPTIM) \
|
||||||
-fno-common \
|
|
||||||
-ffreestanding \
|
|
||||||
-fno-rtti \
|
-fno-rtti \
|
||||||
-fno-exceptions \
|
-fno-exceptions \
|
||||||
-fno-non-call-exceptions \
|
-fno-non-call-exceptions \
|
||||||
@@ -322,17 +313,17 @@ CFLAGS=$(DEV_CFLAGS) \
|
|||||||
-MMD \
|
-MMD \
|
||||||
-std=gnu99 \
|
-std=gnu99 \
|
||||||
$(OPTIM) \
|
$(OPTIM) \
|
||||||
-fno-common \
|
|
||||||
-ffreestanding \
|
|
||||||
-T$(LDSCRIPT) \
|
-T$(LDSCRIPT) \
|
||||||
-c
|
-c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AFLAGS= $(CPUFLAGS) \
|
AFLAGS= $(CPUFLAGS) \
|
||||||
$(DEV_AFLAGS) \
|
$(DEV_AFLAGS) \
|
||||||
$(DEBUG) \
|
$(GLOBAL_DEFINES) \
|
||||||
$(ASM_INC) \
|
$(OPTIM) \
|
||||||
|
$(DEBUG) \
|
||||||
|
$(ASM_INC) \
|
||||||
$(INCLUDES)
|
$(INCLUDES)
|
||||||
|
|
||||||
|
|
||||||
@@ -354,8 +345,6 @@ default : firmware-EN
|
|||||||
firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin $(HEXFILE_DIR)/$(model)_%.dfu
|
firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin $(HEXFILE_DIR)/$(model)_%.dfu
|
||||||
@true
|
@true
|
||||||
|
|
||||||
ALL_FIRMWARE_TARGETS=$(addprefix firmware-,$(ALL_LANGUAGES))
|
|
||||||
all: $(ALL_FIRMWARE_TARGETS)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# The rule to create the target directory
|
# The rule to create the target directory
|
||||||
|
|||||||
Reference in New Issue
Block a user