kopia lustrzana https://github.com/OpenRTX/OpenRTX
196 wiersze
5.6 KiB
Makefile
196 wiersze
5.6 KiB
Makefile
##
|
|
## OpenDMR - Open Source Firmware for DMR Radios
|
|
##
|
|
|
|
##
|
|
## List here your source files (both .s, .c and .cpp)
|
|
##
|
|
SRC := tests/platform/MD380_display.c
|
|
|
|
##
|
|
## Drivers' source files and include directories
|
|
##
|
|
DRIVERS_INC := -Iplatform/mcu/STM32F4xx -Iplatform/mcu/STM32F4xx/drivers/usb
|
|
DRIVERS_SRC := \
|
|
platform/mcu/STM32F4xx/drivers/usb/usb_bsp.c \
|
|
platform/mcu/STM32F4xx/drivers/usb/usb_core.c \
|
|
platform/mcu/STM32F4xx/drivers/usb/usb_dcd.c \
|
|
platform/mcu/STM32F4xx/drivers/usb/usb_dcd_int.c \
|
|
platform/mcu/STM32F4xx/drivers/usb/usbd_desc.c \
|
|
platform/mcu/STM32F4xx/drivers/usb/usbd_core.c \
|
|
platform/mcu/STM32F4xx/drivers/usb/usbd_ioreq.c \
|
|
platform/mcu/STM32F4xx/drivers/usb/usbd_req.c \
|
|
platform/mcu/STM32F4xx/drivers/usb/usbd_usr.c \
|
|
platform/mcu/STM32F4xx/drivers/gpio.c \
|
|
platform/mcu/STM32F4xx/drivers/usb_vcom.c \
|
|
platform/mcu/STM32F4xx/drivers/delays.c \
|
|
\
|
|
platform/drivers/display/HX83XX_md380.c
|
|
|
|
|
|
##
|
|
## List here additional static libraries with relative path
|
|
##
|
|
LIBS :=
|
|
|
|
##
|
|
## List here additional include directories (in the form -Iinclude_dir)
|
|
##
|
|
INCLUDE_DIRS := -Iopenrtx/include/interfaces
|
|
|
|
##
|
|
## List here additional defines
|
|
##
|
|
DEFINES := $(DEFINES)
|
|
|
|
##
|
|
## Define used to select target processor
|
|
##
|
|
TARGET := -DSTM32F40_41xxx
|
|
|
|
##
|
|
## System clock frequency, in hertz. Must be defined and set to correct value
|
|
## in order to make drivers working correctly
|
|
##
|
|
CLK_FREQ := -DHSE_VALUE=8000000
|
|
|
|
|
|
##
|
|
## Optimization level
|
|
##
|
|
OPTLEVEL := -O0
|
|
#OPTLEVEL:= -O2
|
|
#OPTLEVEL:= -O3
|
|
#OPTLEVEL:= -Os
|
|
|
|
##
|
|
## Device-specific source files and include directories, e.g. startup code
|
|
##
|
|
DEVICE_INC := \
|
|
-Iplatform/mcu/CMSIS/Include -Iplatform/mcu/CMSIS/Device/ST/STM32F4xx/Include
|
|
|
|
DEVICE_SRC := \
|
|
platform/mcu/STM32F4xx/boot/startup.c \
|
|
platform/mcu/STM32F4xx/boot/libc_integration.cpp \
|
|
platform/mcu/CMSIS/Device/ST/STM32F4xx/Source/system_stm32f4xx.c
|
|
|
|
##
|
|
## Operating system's source files and include directories
|
|
##
|
|
OS_INC := \
|
|
-Irtos/uC-OS3/Ports/ARM-Cortex-M/ARMv7-M -Irtos/uC-OS3/Source -Irtos/uC-OS3/Cfg \
|
|
-Irtos/uC-CPU/ARM-Cortex-M/ARMv7-M -Irtos/uC-CPU -Irtos/uC-CPU/Cfg \
|
|
-Irtos/uC-LIB -Irtos/uC-LIB/Cfg
|
|
|
|
OS_SRC := \
|
|
rtos/uC-OS3/Source/__dbg_uCOS-III.c \
|
|
rtos/uC-OS3/Source/os_cfg_app.c \
|
|
rtos/uC-OS3/Source/os_core.c \
|
|
rtos/uC-OS3/Source/os_dbg.c \
|
|
rtos/uC-OS3/Source/os_flag.c \
|
|
rtos/uC-OS3/Source/os_mem.c \
|
|
rtos/uC-OS3/Source/os_msg.c \
|
|
rtos/uC-OS3/Source/os_mutex.c \
|
|
rtos/uC-OS3/Source/os_prio.c \
|
|
rtos/uC-OS3/Source/os_q.c \
|
|
rtos/uC-OS3/Source/os_sem.c \
|
|
rtos/uC-OS3/Source/os_stat.c \
|
|
rtos/uC-OS3/Source/os_task.c \
|
|
rtos/uC-OS3/Source/os_tick.c \
|
|
rtos/uC-OS3/Source/os_time.c \
|
|
rtos/uC-OS3/Source/os_tmr.c \
|
|
rtos/uC-OS3/Source/os_var.c \
|
|
rtos/uC-OS3/Cfg/os_app_hooks.c \
|
|
rtos/uC-CPU/cpu_core.c \
|
|
rtos/uC-LIB/lib_ascii.c \
|
|
rtos/uC-LIB/lib_math.c \
|
|
rtos/uC-LIB/lib_mem.c \
|
|
rtos/uC-LIB/lib_str.c \
|
|
\
|
|
rtos/uC-OS3/Ports/ARM-Cortex-M/ARMv7-M/os_cpu_c.c \
|
|
rtos/uC-OS3/Ports/ARM-Cortex-M/ARMv7-M/os_cpu_a.S \
|
|
rtos/uC-CPU/ARM-Cortex-M/ARMv7-M/cpu_c.c \
|
|
rtos/uC-CPU/ARM-Cortex-M/ARMv7-M/cpu_a.s
|
|
|
|
# rtos/uC-LIB/Ports/ARM-Cortex-M4/lib_mem_a.s \
|
|
##
|
|
## Exceptions support. Uncomment to disable them and save code size
|
|
##
|
|
#EXCEPT := -fno-exceptions -fno-rtti -D__NO_EXCEPTIONS
|
|
|
|
##############################################################################
|
|
## You should not need to modify anything below ##
|
|
##############################################################################
|
|
|
|
ALL_INC := -Iinclude $(OS_INC) $(DEVICE_INC) $(DRIVERS_INC) $(INCLUDE_DIRS)
|
|
ALL_SRC := $(SRC) $(OS_SRC) $(DEVICE_SRC) $(DRIVERS_SRC)
|
|
CONFIGS := $(TARGET) $(CLK_FREQ) $(OPTLEVEL) -DDONT_USE_CMSIS_INIT
|
|
|
|
ifeq ("$(VERBOSE)","1")
|
|
Q :=
|
|
ECHO := @true
|
|
else
|
|
Q := @
|
|
ECHO := @echo
|
|
endif
|
|
|
|
## Replaces both "foo.cpp"-->"foo.o" and "foo.c"-->"foo.o"
|
|
OBJ := $(addsuffix .o, $(basename $(ALL_SRC)))
|
|
|
|
CXXFLAGS := $(ALL_INC) -mcpu=cortex-m4 -mthumb -mfloat-abi=hard \
|
|
-mfpu=fpv4-sp-d16 $(CONFIGS) $(DEFINES) $(EXCEPT) -c -g -std=c++11
|
|
CFLAGS := $(ALL_INC) -mcpu=cortex-m4 -mthumb -mfloat-abi=hard \
|
|
-mfpu=fpv4-sp-d16 $(CONFIGS) $(DEFINES) $(EXCEPT) -c -g
|
|
AFLAGS := -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
|
LFLAGS := -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 \
|
|
-Wl,--gc-sections -Wl,-Map,main.map $(OPTLEVEL) -nostdlib \
|
|
-Wl,-T./platform/mcu/STM32F4xx/linker_script.ld
|
|
DFLAGS := -MMD -MP
|
|
|
|
LINK_LIBS := $(LIBS) -Wl,--start-group -lc -lgcc -lm -Wl,--end-group
|
|
|
|
CC := arm-none-eabi-gcc
|
|
CXX := arm-none-eabi-g++
|
|
AS := arm-none-eabi-as
|
|
CP := arm-none-eabi-objcopy
|
|
SZ := arm-none-eabi-size
|
|
|
|
all: main.bin
|
|
|
|
main.bin: main.elf
|
|
$(ECHO) "[CP ] main.hex"
|
|
$(Q)$(CP) -O ihex main.elf main.hex
|
|
$(ECHO) "[CP ] main.bin"
|
|
$(Q)$(CP) -O binary main.elf main.bin
|
|
$(Q)$(SZ) main.elf
|
|
|
|
main.elf: $(OBJ) #all-recursive
|
|
$(ECHO) "[LD ] main.elf"
|
|
$(Q)$(CXX) $(LFLAGS) -o main.elf $(OBJ) $(LINK_LIBS)
|
|
|
|
%.o: %.s
|
|
$(ECHO) "[AS ] $<"
|
|
$(Q)$(AS) $(AFLAGS) $< -o $@
|
|
|
|
%.o : %.c
|
|
$(ECHO) "[CC ] $<"
|
|
$(Q)$(CC) $(DFLAGS) $(CFLAGS) $< -o $@
|
|
|
|
%.o : %.cpp
|
|
$(ECHO) "[CXX ] $<"
|
|
$(Q)$(CXX) $(DFLAGS) $(CXXFLAGS) $< -o $@
|
|
|
|
flash: main_wrapped.bin
|
|
$(ECHO) "[DFU ] $<"
|
|
$(Q)./scripts/md380_dfu.py upgrade $<
|
|
|
|
main_wrapped.bin: main.bin
|
|
$(ECHO) "[WRAP] $<"
|
|
$(Q)./scripts/md380_fw.py --wrap $< $@
|
|
|
|
clean:
|
|
-rm -f $(OBJ) main.elf main.hex main.bin main.map main_wrapped.bin $(OBJ:.o=.d)
|
|
|
|
#pull in dependecy info for existing .o files
|
|
-include $(OBJ:.o=.d)
|