Skip to content

Commit ed68d0b

Browse files
committed
Use PRODUCT to define build configuration for umm_malloc
1 parent 5d7fe2f commit ed68d0b

9 files changed

Lines changed: 50 additions & 11 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ The reason for this is the way the configuration override heirarchy
102102
works. The priority for configuration overrides is as follows:
103103

104104
1. Command line defines using `-D UMM_xxx`
105-
2. A custom config filename using `-D UMM_CFGFILE="<filename.cfg>"`
105+
2. A custom config filename using `-D UMM_MALLOC_CFGFILE="<filename.cfg>"`
106106
3. The default config filename `path/to/config/umm_malloc_cfgport.h`
107107
4. The default configuration in `src/umm_malloc_cfg.h`
108108

adaptabuild_module.mak

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ $(MODULE)_INCPATH += $(PRODUCT)/config/$(MCU)
7171
$(MODULE)_CDEFS :=
7272
$(MODULE)_CDEFS +=
7373

74-
$(call log_notice,UMM_CONFIG is $(UMM_CFGFILE))
74+
$(call log_notice,UMM_MALLOC_CFGFILE is $(UMM_MALLOC_CFGFILE))
7575

76-
ifneq (,$(UMM_CFGFILE))
77-
$(MODULE)_CDEFS += UMM_CFGFILE=\"$(UMM_CFGFILE).h\"
76+
ifneq (,$(UMM_MALLOC_CFGFILE))
77+
$(MODULE)_CDEFS += UMM_MALLOC_CFGFILE=$(UMM_MALLOC_CFGFILE)
7878
endif
7979

8080
$(MODULE)_CFLAGS :=

adaptabuild_product.mak

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,46 @@
44
# Here is where you specify your product options
55
# ----------------------------------------------------------------------------
66

7-
PRODUCT_LIST := unittest
7+
# The umm_malloc library can be build with a number of different options, and
8+
# we control the build by setting the UMM_MALLOC_CFGFILE on the command line
9+
#
10+
# The following configurations can be built as separate products, each one has
11+
# a corresponding .h file
12+
#
13+
# default
14+
# enable_critical_depth_check
15+
# enable_info
16+
# enable_inline_metrics
17+
# enable_integrity_checks
18+
# enable_poison_check
19+
# enable_first_fit
20+
#
21+
PRODUCT_LIST := default \
22+
enable_info \
23+
enable_critical_depth_check \
24+
enable_inline_metrics \
25+
enable_integrity_check \
26+
enable_poison_check \
27+
enable_first_fit
828

929
ifneq ($(filter $(PRODUCT),$(PRODUCT_LIST)),)
10-
# Set PRODUCT_MAIN here based on $(PRODUCT)
11-
# The unittest product typically does not need PRODUCT_MAIN
30+
# Set PRODUCT_MAIN here based on $(PRODUCT)
31+
# The unittest product typically does not need PRODUCT_MAIN
32+
ifeq (default,$(PRODUCT))
33+
UMM_MALLOC_CFGFILE := \"options/default.h\"
34+
else ifeq (enable_info,$(PRODUCT))
35+
UMM_MALLOC_CFGFILE := \"options/enable_umm_info.h\"
36+
else ifeq (enable_critical_depth_check,$(PRODUCT))
37+
UMM_MALLOC_CFGFILE := \"options/enable_critical_depth_check.h\"
38+
else ifeq (enable_inline_metrics,$(PRODUCT))
39+
UMM_MALLOC_CFGFILE := \"options/enable_inline_metrics.h\"
40+
else ifeq (enable_integrity_check,$(PRODUCT))
41+
UMM_MALLOC_CFGFILE := \"options/enable_integrity_check.h\"
42+
else ifeq (enable_poison_check,$(PRODUCT))
43+
UMM_MALLOC_CFGFILE := \"options/enable_poison_check.h\"
44+
else ifeq (enable_first_fit,$(PRODUCT))
45+
UMM_MALLOC_CFGFILE := \"options/enable_first_fit.h\"
46+
endif
1247
else
1348
$(error PRODUCT must be one of $(PRODUCT_LIST))
1449
endif

src/options/enable_first_fit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define UMM_FIRST_FIT
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define UMM_INLINE_METRICS
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define UMM_INTEGRITY_CHECK

src/options/enable_poison_check.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define UMM_POISON_CHECK

src/umm_malloc_cfg.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* of priority
2525
*
2626
* 1. Pass in the override values on the command line using -D UMM_xxx
27-
* 2. Pass in the filename holding override values using -D UMM_CFGFILE
27+
* 2. Pass in the filename holding override values using -D UMM_MALLOC_CFGFILE
2828
* 3. Set up defaults in a file called umm_malloc_cfgport.h
2929
*
3030
* NOTE WELL: For the command line -D options to take highest priority, your
@@ -128,8 +128,8 @@
128128
* ----------------------------------------------------------------------------
129129
*/
130130

131-
#ifdef UMM_CFGFILE
132-
#include UMM_CFGFILE
131+
#ifdef UMM_MALLOC_CFGFILE
132+
#include UMM_MALLOC_CFGFILE
133133
#else
134134
#include <umm_malloc_cfgport.h>
135135
#endif

0 commit comments

Comments
 (0)