mongoose/examples/stm32-freertos-tcp/Makefile

99 lines
3.7 KiB
Makefile
Raw Normal View History

2021-05-11 16:12:06 +08:00
# FreeRTOS/{FreeRTOS-Kernel V10.4.3,FreeRTOS-Plus-TCP V2.3.2}
PROG = firmware
ARCH = stm32f7
PROJECT_ROOT_PATH = $(realpath $(CURDIR)/../..)
DOCKER ?= docker run -it --rm -v $(PROJECT_ROOT_PATH):$(PROJECT_ROOT_PATH) -w $(CURDIR) mdashnet/armgcc
FREERTOS_KERNEL_PATH ?= $(PROJECT_ROOT_PATH)/test/freertos-kernel
FREERTOS_PLUS_TCP_PATH ?= $(PROJECT_ROOT_PATH)/test/freertos-tcp
2021-07-24 10:44:00 +08:00
MONGOOSE_FLAGS = -DMG_ARCH=MG_ARCH_FREERTOS_TCP
MCU_FLAGS = -mcpu=cortex-m7 -mthumb -mfloat-abi=softfp -mfpu=vfpv4
#-mcpu=cortex-m7 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard
INCLUDES = -I$(PROJECT_ROOT_PATH) -I$(ARCH) -I$(FREERTOS_KERNEL_PATH)/include -I$(FREERTOS_PLUS_TCP_PATH)/include
INCLUDES += -I$(FREERTOS_PLUS_TCP_PATH)/tools/tcp_utilities/include
INCLUDES += -I$(FREERTOS_PLUS_TCP_PATH)/../Utilities/include
#INCLUDES += -IH2
#INCLUDES += -I/Users/lsm/src/htibosch/plus/stm32F7/ST_Library/include
INCLUDES += -IHAL
INCLUDES += -I$(FREERTOS_PLUS_TCP_PATH)/portable/Compiler/GCC
INCLUDES += -I$(FREERTOS_PLUS_TCP_PATH)/portable/NetworkInterface/STM32Fxx
INCLUDES += -I$(FREERTOS_PLUS_TCP_PATH)/portable/NetworkInterface/include
NETFLAGS = -DSTM32F7xx -DSTM32F746xx -Wno-sign-compare -Wno-unused-function #-Wno-cpp
CFLAGS = -g3 -O0 -W -Wall $(MCU_FLAGS)
CFLAGS += $(INCLUDES) $(MONGOOSE_FLAGS) $(NETFLAGS) $(EXTRA)
LINKFLAGS = -T$(ARCH)/link.ld -mcpu=cortex-m7 -mthumb -nostartfiles --specs rdimon.specs -Wl,--gc-sections
SOURCES = main.c $(PROJECT_ROOT_PATH)/mongoose.c
SOURCES += $(wildcard HAL/*.c)
#SOURCES += -I$(realpath $(FREERTOS_KERNEL_PATH)/../../stm32F7/ST_Library/sources)/
# FreeRTOS kernel sources
SOURCES += $(wildcard $(FREERTOS_KERNEL_PATH)/*.c)
SOURCES += $(FREERTOS_KERNEL_PATH)/portable/MemMang/heap_5.c
SOURCES += $(FREERTOS_KERNEL_PATH)/portable/GCC/ARM_CM7/r0p1/port.c
# FreeRTOS TCP stack sources
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/FreeRTOS_ARP.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/FreeRTOS_DHCP.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/FreeRTOS_DNS.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/FreeRTOS_IP.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/FreeRTOS_Sockets.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/FreeRTOS_Stream_Buffer.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/FreeRTOS_TCP_IP.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/FreeRTOS_TCP_WIN.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/FreeRTOS_UDP_IP.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/portable/NetworkInterface/Common/phyHandling.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/portable/BufferManagement/BufferAllocation_1.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/portable/NetworkInterface/STM32Fxx/NetworkInterface.c
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/portable/NetworkInterface/STM32Fxx/stm32fxx_hal_eth.c
OBJECTS = obj/boot.o $(SOURCES:%.c=obj/%.o)
2021-05-11 16:12:06 +08:00
2021-07-29 21:21:20 +08:00
example:
true
build: $(PROG).hex
2021-05-11 16:12:06 +08:00
$(PROG).bin: $(PROG).elf
2021-05-12 01:05:03 +08:00
$(DOCKER) arm-none-eabi-objcopy -O binary $< $@
2021-05-11 16:12:06 +08:00
$(PROG).hex: $(PROG).bin
2021-05-12 01:05:03 +08:00
$(DOCKER) arm-none-eabi-objcopy -I binary -O ihex --change-address 0x8000000 $< $@
2021-05-11 16:12:06 +08:00
$(PROG).elf: $(OBJECTS) Makefile
$(DOCKER) arm-none-eabi-gcc $(OBJECTS) $(LINKFLAGS) -o $@
$(DOCKER) arm-none-eabi-size -A $@
2021-05-11 16:12:06 +08:00
obj/%.o: %.c
@mkdir -p $(dir $@)
2021-05-12 01:05:03 +08:00
$(DOCKER) arm-none-eabi-gcc $(CFLAGS) -c $< -o $@
2021-05-11 16:12:06 +08:00
obj/boot.o: $(ARCH)/boot.s
2021-05-11 16:12:06 +08:00
@mkdir -p $(dir $@)
$(DOCKER) arm-none-eabi-as -g3 --warn --fatal-warnings $(MCU_FLAGS) $< -o $@
2021-05-12 01:05:03 +08:00
flash: $(PROG).bin
2021-05-12 03:44:14 +08:00
st-flash --reset write $< 0x8000000
2021-05-12 01:05:03 +08:00
2021-05-14 05:03:46 +08:00
openocd:
openocd -f openocd.cfg
ELF ?= $(PROG).elf
gdb: #$(PROG).elf
2021-05-12 01:05:03 +08:00
arm-none-eabi-gdb \
-ex 'set confirm off' \
2021-05-14 05:03:46 +08:00
-ex 'target extended-remote :3333' \
-ex 'monitor arm semihosting enable' \
2021-05-12 01:05:03 +08:00
-ex 'monitor reset halt' \
2021-05-14 05:03:46 +08:00
-ex 'load' \
2021-05-12 01:05:03 +08:00
-ex 'monitor reset init' \
-ex '$(GDBCMD)' \
2021-05-14 05:03:46 +08:00
-ex 'r' \
$(ELF)
2021-05-11 16:12:06 +08:00
clean:
@rm -rf *.{bin,elf,map,lst,tgz,zip,hex} obj