mongoose/examples/stm32/stm32-freertos-tcp/Makefile

90 lines
3.4 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
2021-10-22 18:34:44 +08:00
PROJECT_ROOT_PATH = $(realpath $(CURDIR)/../../..)
2021-07-29 21:28:20 +08:00
DOCKER ?= docker run --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
MONGOOSE_FLAGS = -DMG_ARCH=MG_ARCH_FREERTOS -DMG_ENABLE_FREERTOS_TCP -DMG_ENABLE_FILE=0
2021-10-22 18:34:44 +08:00
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
2021-10-22 18:34:44 +08:00
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
2021-10-22 18:34:44 +08:00
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
2021-10-22 18:34:44 +08:00
SOURCES += $(FREERTOS_PLUS_TCP_PATH)/portable/NetworkInterface/STM32Fxx/stm32fxx_hal_eth.c
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
2022-02-14 19:32:01 +08:00
$(PROG).elf: Makefile
2021-05-11 16:12:06 +08:00
@mkdir -p $(dir $@)
2022-02-14 19:32:01 +08:00
$(DOCKER) arm-none-eabi-gcc $(SOURCES) $(ARCH)/boot.s $(CFLAGS) $(LINKFLAGS) -o $@
$(DOCKER) arm-none-eabi-size -A $@
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:
2022-02-14 19:32:01 +08:00
@rm -rf firmware.*