mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-13 16:27:43 -04:00
* Enable libunitymemory extension to track dynamic memory usage during unit tests * Use UnityMemory in timers_utest.c * Add fake_assert.h to allow mocking of configASSERT calls * Add .editorconfig to make github show indentation correctly * Add unity memory and fake_assert to queue_utest.c * Add -fsanitize=address CFLAG when running unit tests * Define mtCOVERAGE_TEST_MARKER macro to include mtCOVERAGE_TEST_MARKER lines in coverage figures * Add additional memory check / protection CFLAGS for CMock tests * Fix out of bounds array access in list_utest.c * Move the fake_assert.h include to the top of FreeRTOSConfig.h
65 lines
1.8 KiB
Makefile
65 lines
1.8 KiB
Makefile
# Various directory locations
|
|
|
|
UT_ROOT_DIR_REL :=.
|
|
UT_ROOT_DIR := $(abspath $(UT_ROOT_DIR_REL))
|
|
|
|
BUILD_DIR := $(UT_ROOT_DIR)/build
|
|
DOC_DIR := $(BUILD_DIR)/doc
|
|
COVERAGE_DIR := $(BUILD_DIR)/coverage
|
|
BIN_DIR := $(BUILD_DIR)/bin
|
|
GENERATED_DIR := $(BUILD_DIR)/generated
|
|
LIB_DIR := $(BUILD_DIR)/lib
|
|
|
|
|
|
FREERTOS_DIR_REL := ../../../FreeRTOS
|
|
FREERTOS_DIR := $(abspath $(FREERTOS_DIR_REL))
|
|
|
|
KERNEL_DIR_REL := ../../../FreeRTOS/Source
|
|
KERNEL_DIR := $(abspath $(KERNEL_DIR_REL))
|
|
|
|
CMOCK_DIR := $(UT_ROOT_DIR)/CMock
|
|
CMOCK_SRC_DIR := $(CMOCK_DIR)/src
|
|
UNITY_DIR := $(CMOCK_DIR)/vendor/unity
|
|
UNITY_SRC_DIR := $(UNITY_DIR)/src
|
|
UNITY_INC_DIR := $(UNITY_DIR)/src
|
|
UNITY_BIN_DIR := $(UNITY_DIR)/auto
|
|
UNITY_EXTRAS_DIR := $(UNITY_DIR)/extras
|
|
UNITY_MEM_SRC_DIR := $(UNITY_EXTRAS_DIR)/memory/src
|
|
|
|
CMOCK_EXEC_DIR := $(CMOCK_DIR)/lib
|
|
|
|
# Include directory location
|
|
INCLUDE_DIR := -I$(KERNEL_DIR)/include -I. -I$(UT_ROOT_DIR)/config
|
|
INCLUDE_DIR += -I$(UNITY_INC_DIR)
|
|
INCLUDE_DIR += -I$(CMOCK_SRC_DIR)
|
|
INCLUDE_DIR += -I$(UNITY_MEM_SRC_DIR)
|
|
|
|
CPPFLAGS :=
|
|
CFLAGS := $(INCLUDE_DIR) -O0 -ggdb -pthread --std=c99 -Werror -Wall
|
|
CFLAGS += -fsanitize=address,undefined -fsanitize-recover=address
|
|
CFLAGS += -fstack-protector-all
|
|
CFLAGS += -Wformat -Werror=format-security -Werror=array-bounds
|
|
CFLAGS += -D_FORTIFY_SOURCE=2
|
|
|
|
LDFLAGS := -L$(LIB_DIR) -Wl,-rpath,$(LIB_DIR)
|
|
LDFLAGS += -fsanitize=address,undefined
|
|
LDFLAGS += -pthread
|
|
LDFLAGS += -lunity
|
|
LDFLAGS += -lunitymemory
|
|
LDFLAGS += -lcmock
|
|
LDFLAGS += -lgcov
|
|
|
|
export BUILD_DIR
|
|
export DOC_DIR
|
|
export GENERATED_DIR
|
|
export COVERAGE_DIR
|
|
export BIN_DIR
|
|
export UNITS
|
|
export CFLAGS
|
|
export LDFLAGS
|
|
export CPPFLAGS
|
|
export CMOCK_EXEC_DIR
|
|
export KERNEL_DIR
|
|
export UNITY_BIN_DIR
|
|
export LIB_DIR
|
|
export UT_ROOT_DIR
|