FreeRTOS-Kernel/FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/Makefile
Florian La Roche 995a030a92
MPS2_AN385 improvements (#1225)
* MPS2_AN385 improvements

Sync various MPS2_AN385 CORTEX-M3 QEMU targets and improve their
Makefiles and cleanup gcc support:
- FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2:
  - Makefile
    - output image size after linking
    - move -nostartfiles from compiler to linker flags
    - modernize compiler warning flags
    - add --gc-sections to linker flags
  - TCPEchoClient_SingleTasks.c: fix compiler warnings
  - main.c: fix compiler warnings (remove unused code)
  - main_networking.c
    - remove ipLOCAL_MAC_ADDRESS (unknown)
    - fix compiler warnings about unused params
  - startup.c: main(void), remove unused includes,
    silence  unused params
  - syscalls.c: remove unused defines, silence unused params,
    more compact _sbrk()
- FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/build/gcc:
  - Makefile
    - CFLAGS/LDFLAGS in more readable lines
    - move -nostartfiles to linker flags
    - comment out -specs=rdimon.specs as it is not needed
  - startup_gcc.c: fix typo in comment, remove unused uart code
- FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC
  - Makefile
    - after compilation output size of image
    - remove -DQEMU_SOC_MPS2, not needed
    - update many CFLAGS/LDFLAGS settings to more modern gcc/source
    - -ffunction-sections -fdata-sections is moved to CFLAGS
  - startup.c: sync with other ports
  - syscall.c: _write(): param buf is not unused, silence unused params

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>

* remove ipLOCAL_MAC_ADDRESS completely and fix formatting errors

remove ipLOCAL_MAC_ADDRESS completely and fix formatting errors

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2024-06-04 20:08:16 +05:30

97 lines
2.7 KiB
Makefile

CC = arm-none-eabi-gcc
SIZE = arm-none-eabi-size
BIN := freertos_tcp_mps2_demo.axf
BUILD_DIR := build
FREERTOS_DIR_REL := ../../../FreeRTOS
FREERTOS_DIR := $(abspath $(FREERTOS_DIR_REL))
KERNEL_DIR := $(FREERTOS_DIR)/Source
FREERTOS_PLUS_DIR_REL := ../../../FreeRTOS-Plus
FREERTOS_PLUS_DIR := $(abspath $(FREERTOS_PLUS_DIR_REL))
INCLUDE_DIRS += -I.
FREERTOS_TCP = ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP
# Demo Source Files
SOURCE_FILES += startup.c
SOURCE_FILES += syscalls.c
SOURCE_FILES += main.c
SOURCE_FILES += main_networking.c
SOURCE_FILES += TCPEchoClient_SingleTasks.c
INCLUDE_DIRS += -ICMSIS
# FreeRTOS Kernel
INCLUDE_DIRS += -I$(KERNEL_DIR)/include
SOURCE_FILES += $(KERNEL_DIR)/tasks.c
SOURCE_FILES += $(KERNEL_DIR)/list.c
SOURCE_FILES += $(KERNEL_DIR)/queue.c
SOURCE_FILES += $(KERNEL_DIR)/timers.c
SOURCE_FILES += $(KERNEL_DIR)/event_groups.c
# FreeRTOS Kernel ARM Cortex-M3 Port
INCLUDE_DIRS += -I$(KERNEL_DIR)/portable/GCC/ARM_CM3
SOURCE_FILES += $(KERNEL_DIR)/portable/GCC/ARM_CM3/port.c
SOURCE_FILES += ${KERNEL_DIR}/portable/MemMang/heap_3.c
# FreeRTOS+TCP
INCLUDE_DIRS += -I${FREERTOS_TCP}/source/include/
SOURCE_FILES += $(wildcard ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-TCP/source/*.c )
# FreeRTOS+TCP Port for ARM MPS2 SoC
INCLUDE_DIRS += -I${FREERTOS_TCP}/source/portable/NetworkInterface/MPS2_AN385/ether_lan9118
INCLUDE_DIRS += -I${FREERTOS_TCP}/source/portable/Compiler/GCC
SOURCE_FILES += ${FREERTOS_TCP}/source/portable/BufferManagement/BufferAllocation_2.c
SOURCE_FILES += ${FREERTOS_TCP}/source/portable/NetworkInterface/MPS2_AN385/NetworkInterface.c
SOURCE_FILES += ${FREERTOS_TCP}/source/portable/NetworkInterface/MPS2_AN385/ether_lan9118/smsc9220_eth_drv.c
DEFINES := -DHEAP3
CPPFLAGS += $(DEFINES)
CFLAGS += -mthumb -mcpu=cortex-m3
ifeq ($(DEBUG), 1)
CFLAGS += -g3 -Og -ffunction-sections -fdata-sections
else
CFLAGS += -Os -ffunction-sections -fdata-sections
endif
CFLAGS += -MMD
CFLAGS += -Wall -Wextra -Wshadow
#CFLAGS += -Wpedantic -fanalyzer
#CFLAGS += -flto
CFLAGS += $(INCLUDE_DIRS)
LDFLAGS = -T mps2_m3.ld
LDFLAGS += -Xlinker -Map=${BUILD_DIR}/output.map
LDFLAGS += -Xlinker --gc-sections
LDFLAGS += -nostartfiles -specs=nano.specs -specs=nosys.specs -specs=rdimon.specs
OBJ_FILES := $(SOURCE_FILES:%.c=$(BUILD_DIR)/%.o)
.PHONY: clean
$(BUILD_DIR)/$(BIN) : $(OBJ_FILES)
$(CC) $(CFLAGS) $(LDFLAGS) $+ -o $(@)
$(SIZE) $(@)
%.d: %.c
@set -e; rm -f $@; \
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
INCLUDES := $(SOURCE_FILES:%.c=$(BUILD_DIR)/%.d)
-include $(INCLUDES)
${BUILD_DIR}/%.o : %.c Makefile
-mkdir -p $(@D)
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
clean:
-rm -rf build