@@ -4,15 +4,17 @@ MAKEFLAGS=--warn-undefined-variables
4
4
# Default to a silent build. Run make with --trace for a verbose build.
5
5
.SILENT :
6
6
7
-
8
7
# Mac and Linux stat have different options required, set them up here
9
8
ifeq ($(shell uname) , Darwin)
10
- STAT = "stat -f '%z'"
9
+ STAT = "stat -f '%z'"
11
10
else
12
- STAT = "stat -c '%s'"
11
+ STAT = "stat -c '%s'"
13
12
endif
14
13
15
14
BOARD ?= qemu_mps2_an385
15
+
16
+ $(info Building for $(BOARD))
17
+
16
18
BOARD_DIR := boards/$(BOARD )
17
19
18
20
BUILD_DIR := build/$(BOARD )
@@ -53,25 +55,24 @@ endif
53
55
include $(BOARD_DIR ) /Makefile
54
56
55
57
# 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 \
63
64
64
65
# Add application sources
65
66
SRCS += \
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 ) \
75
76
76
77
# Use Memfault SDK worker to gather initial Memfault SDK sources and include dirs
77
78
MEMFAULT_SDK_ROOT := ../..
@@ -85,34 +86,33 @@ CFLAGS += $(foreach each, $(MEMFAULT_COMPONENTS), -DMEMFAULT_COMPONENT_$(each)_)
85
86
# Intentionally using a wildcard to trap any new features added- it's nice to
86
87
# have them enabled in this example app.
87
88
SRCS += \
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 \
91
92
92
93
# Fixup build path for objects of the Memfault SDK, all build output kept within build/
93
94
OBJS := $(subst $(MEMFAULT_SDK_ROOT ) ,memfault-firmware-sdk,$(SRCS:%=$(BUILD_DIR ) /%.o ) )
94
95
95
96
INCLUDE_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 ) \
104
105
105
106
# generic (non-arch-specific) CFLAGS
106
107
CFLAGS += \
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 ) \
116
116
117
117
# Enable the self test by default
118
118
MEMFAULT_DEMO_CLI_SELF_TEST ?= 1
@@ -121,14 +121,14 @@ CFLAGS += -DMEMFAULT_DEMO_CLI_SELF_TEST=$(MEMFAULT_DEMO_CLI_SELF_TEST)
121
121
LINKER_SCRIPT = $(BOARD_DIR ) /linker.ld
122
122
123
123
LDFLAGS += \
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 \
132
132
133
133
.PHONY : all
134
134
all : $(ELF )
@@ -142,11 +142,11 @@ $(SRCS): $(FREERTOS_DIR)/.clonedone
142
142
# If CFLAGS differ from last build, rebuild all files
143
143
RAW_CFLAGS := $(CFLAGS ) $(LDFLAGS )
144
144
CFLAGS_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
+ )
150
150
.PHONY : CFLAGS_STALE
151
151
$(BUILD_DIR ) /cflags : $(CFLAGS_STALE ) Makefile
152
152
mkdir -p $(dir $@ )
0 commit comments