@@ -4,15 +4,17 @@ MAKEFLAGS=--warn-undefined-variables
44# Default to a silent build. Run make with --trace for a verbose build.
55.SILENT :
66
7-
87# Mac and Linux stat have different options required, set them up here
98ifeq ($(shell uname) , Darwin)
10- STAT = "stat -f '%z'"
9+ STAT = "stat -f '%z'"
1110else
12- STAT = "stat -c '%s'"
11+ STAT = "stat -c '%s'"
1312endif
1413
1514BOARD ?= qemu_mps2_an385
15+
16+ $(info Building for $(BOARD))
17+
1618BOARD_DIR := boards/$(BOARD )
1719
1820BUILD_DIR := build/$(BOARD )
@@ -53,25 +55,24 @@ endif
5355include $(BOARD_DIR ) /Makefile
5456
5557# Gather list of FreeRTOS sources
56- FREERTOS_SRCS = \
57- $(FREERTOS_DIR ) /tasks.c \
58- $(FREERTOS_DIR ) /queue.c \
59- $(FREERTOS_DIR ) /list.c \
60- $(FREERTOS_DIR ) /timers.c \
61- $(FREERTOS_DIR ) /portable/GCC/$(FREERTOS_PORT ) /port.c \
62- $(FREERTOS_DIR ) /portable/MemMang/heap_4.c \
58+ FREERTOS_SRCS += \
59+ $(FREERTOS_DIR ) /tasks.c \
60+ $(FREERTOS_DIR ) /queue.c \
61+ $(FREERTOS_DIR ) /list.c \
62+ $(FREERTOS_DIR ) /timers.c \
63+ $(FREERTOS_DIR ) /portable/MemMang/heap_4.c \
6364
6465# Add application sources
6566SRCS += \
66- src/main.c \
67- src/compact_log.cpp \
68- src/console.c \
69- src/heap_task.c \
70- src/metrics.c \
71- src/memfault/memfault_platform_port.c \
72- $(BOARD_DIR ) /startup.c \
73- $(BOARD_DIR ) /memfault_platform_impl.c \
74- $(FREERTOS_SRCS ) \
67+ src/main.c \
68+ src/compact_log.cpp \
69+ src/console.c \
70+ src/heap_task.c \
71+ src/metrics.c \
72+ src/memfault/memfault_platform_port.c \
73+ $(BOARD_DIR ) /startup.c \
74+ $(BOARD_DIR ) /memfault_platform_impl.c \
75+ $(FREERTOS_SRCS ) \
7576
7677# Use Memfault SDK worker to gather initial Memfault SDK sources and include dirs
7778MEMFAULT_SDK_ROOT := ../..
@@ -85,34 +86,33 @@ CFLAGS += $(foreach each, $(MEMFAULT_COMPONENTS), -DMEMFAULT_COMPONENT_$(each)_)
8586# Intentionally using a wildcard to trap any new features added- it's nice to
8687# have them enabled in this example app.
8788SRCS += \
88- $(MEMFAULT_COMPONENTS_SRCS ) \
89- $(wildcard $(MEMFAULT_SDK_ROOT ) /ports/freertos/src/* .c) \
90- $(MEMFAULT_SDK_ROOT ) /ports/panics/src/memfault_platform_ram_backed_coredump.c \
89+ $(MEMFAULT_COMPONENTS_SRCS ) \
90+ $(wildcard $(MEMFAULT_SDK_ROOT ) /ports/freertos/src/* .c) \
91+ $(MEMFAULT_SDK_ROOT ) /ports/panics/src/memfault_platform_ram_backed_coredump.c \
9192
9293# Fixup build path for objects of the Memfault SDK, all build output kept within build/
9394OBJS := $(subst $(MEMFAULT_SDK_ROOT ) ,memfault-firmware-sdk,$(SRCS:%=$(BUILD_DIR ) /%.o ) )
9495
9596INCLUDE_PATHS += \
96- -I$(FREERTOS_DIR ) /include \
97- -I. \
98- -Isrc \
99- -Isrc/memfault \
100- -I$(MEMFAULT_COMPONENTS_INC_FOLDERS ) \
101- -I$(MEMFAULT_SDK_ROOT ) /ports/include \
102- -I$(MEMFAULT_SDK_ROOT ) \
103- -I$(FREERTOS_DIR ) /portable/GCC/$(FREERTOS_PORT ) \
97+ -I$(FREERTOS_DIR ) /include \
98+ -I. \
99+ -Isrc \
100+ -Isrc/memfault \
101+ -I$(MEMFAULT_COMPONENTS_INC_FOLDERS ) \
102+ -I$(MEMFAULT_SDK_ROOT ) /ports/include \
103+ -I$(MEMFAULT_SDK_ROOT ) \
104+ -I$(FREERTOS_DIR ) /portable/GCC/$(FREERTOS_PORT ) \
104105
105106# generic (non-arch-specific) CFLAGS
106107CFLAGS += \
107- -nostartfiles \
108- -mthumb \
109- -mcpu=cortex-m3 \
110- -Werror \
111- -Wall \
112- -Wextra \
113- -ggdb3 \
114- -Og \
115- -MD \
108+ -nostartfiles \
109+ -Werror \
110+ -Wall \
111+ -Wextra \
112+ -ggdb3 \
113+ -Og \
114+ -MD \
115+ $(ARCH_CFLAGS ) \
116116
117117# Enable the self test by default
118118MEMFAULT_DEMO_CLI_SELF_TEST ?= 1
@@ -121,14 +121,14 @@ CFLAGS += -DMEMFAULT_DEMO_CLI_SELF_TEST=$(MEMFAULT_DEMO_CLI_SELF_TEST)
121121LINKER_SCRIPT = $(BOARD_DIR ) /linker.ld
122122
123123LDFLAGS += \
124- -Wl,-T$(LINKER_SCRIPT ) \
125- -Wl,--gc-sections \
126- --specs=nano.specs \
127- --specs=rdimon.specs \
128- -Wl,-lc \
129- -Wl,-lrdimon \
130- -Wl,-Map=$(BUILD_DIR ) /main.map \
131- -Wl,--build-id \
124+ -Wl,-T$(LINKER_SCRIPT ) \
125+ -Wl,--gc-sections \
126+ --specs=nano.specs \
127+ --specs=rdimon.specs \
128+ -Wl,-lc \
129+ -Wl,-lrdimon \
130+ -Wl,-Map=$(BUILD_DIR ) /main.map \
131+ -Wl,--build-id \
132132
133133.PHONY : all
134134all : $(ELF )
@@ -142,11 +142,11 @@ $(SRCS): $(FREERTOS_DIR)/.clonedone
142142# If CFLAGS differ from last build, rebuild all files
143143RAW_CFLAGS := $(CFLAGS ) $(LDFLAGS )
144144CFLAGS_STALE = \
145- $(shell \
146- if ! (echo "$(RAW_CFLAGS ) " | diff -q $(BUILD_DIR ) /cflags - > /dev/null 2>&1) ; then \
147- echo CFLAGS_STALE; \
148- fi \
149- )
145+ $(shell \
146+ if ! (echo "$(RAW_CFLAGS ) " | diff -q $(BUILD_DIR ) /cflags - > /dev/null 2>&1) ; then \
147+ echo CFLAGS_STALE; \
148+ fi \
149+ )
150150.PHONY : CFLAGS_STALE
151151$(BUILD_DIR ) /cflags : $(CFLAGS_STALE ) Makefile
152152 mkdir -p $(dir $@ )
0 commit comments