-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile.stm32
56 lines (44 loc) · 1.82 KB
/
Makefile.stm32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
OPENCM3_DIR = lib/libopencm3
export OPENCM3_DIR
CPPFLAGS += -DSTM32
PLATFORM_SOURCES += stm32
export PLATFORM_SOURCES
BUILDDIR = build-$(TARGET)
export BUILDDIR
BINARY = $(BUILDDIR)/$(PROJECT_NAME)
include $(VARIANTS_DIR)/$(VARIANT)/sdkconfig
include $(ROOT)/main/component.mk
FREERTOS_SOURCE := lib/FreeRTOSv10.1.1/FreeRTOS/Source
FREERTOS_PORT_SOURCE := $(FREERTOS_SOURCE)/portable/GCC/$(FREERTOS_PORT)
FREERTOS_HEAP_IMPL := $(FREERTOS_SOURCE)/portable/MemMang/heap_4.c
INCLUDES =
INCLUDES += $(ROOT)/main
INCLUDES += $(ROOT)/components/os/include
INCLUDES += $(ROOT)/components/hal-common/include
INCLUDES += $(ROOT)/components/hal-stm32/include
INCLUDES += $(ROOT)/lib/wldb/include
INCLUDES += $(PLATFORMS_DIR)/stm32
INCLUDES += $(FREERTOS_SOURCE)/include
INCLUDES += $(FREERTOS_PORT_SOURCE)
CFLAGS += -DUSE_FREERTOS_SOURCE $(addprefix -I,$(INCLUDES))
CFLAGS += -DWLDB_WRITE_SIZE_MIN=2 -DWLDB_FS_DIRECT_READ
CFLAGS += -DCONFIG_PAGE_SIZE=$(CONFIG_PAGE_SIZE) -DCONFIG_BLOCK_SIZE=$(CONFIG_BLOCK_SIZE)
# Sources
WLDB_SRCDIR := lib/wldb/src
# Remove modules not supported on STM32
COMPONENT_SRCDIRS := $(filter-out bluetooth,$(COMPONENT_SRCDIRS))
COMPONENT_SRCDIRS := $(filter-out ota,$(COMPONENT_SRCDIRS))
COMPONENT_SRCDIRS := $(filter-out p2p,$(COMPONENT_SRCDIRS))
dir_sources = $(wildcard $(dir)/*.c)
MAIN_DIRS = $(addprefix main/,$(COMPONENT_SRCDIRS))
SRC_DIRS =
SRC_DIRS += $(FREERTOS_SOURCE) $(FREERTOS_PORT_SOURCE)
SRC_DIRS += components/hal-common components/hal-stm32 components/u8g2/u8g2/csrc
SRC_DIRS += $(MAIN_DIRS)
SOURCES := $(foreach dir,$(SRC_DIRS),$(dir_sources))
SOURCES += $(FREERTOS_HEAP_IMPL)
SOURCES += $(WLDB_SRCDIR)/wldb.c $(WLDB_SRCDIR)/wldb-libopencm3.c
export SOURCES
.DEFAULT_GOAL := all
release: $(BINARY).hex
cp -f $< $(RELEASES_DIR)/$(RELEASE_BASENAME).hex