Skip to content

Commit

Permalink
Inherit CMSIS CCFLAGS when generating mbed project
Browse files Browse the repository at this point in the history
  • Loading branch information
mansnils committed Jan 14, 2020
1 parent 0e2b5a9 commit cd311a8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tensorflow/lite/micro/tools/make/helper_functions.inc
Expand Up @@ -2,6 +2,9 @@
# Reverses a space-separated list of words.
reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))

# Get macros only (i.e. the ones starting with -D) from two lists and remove duplicates
getmacros = $(patsubst -D%,%,$(filter -D%,$(sort $(filter -D%, $(1)) $(filter -D%, $(2)))))

# Look for platform or target-specific implementation files to replace reference
# implementations with, given a tag. These are expected to occur in subfolders
# of a directory where a reference implementation exists, and have the same
Expand Down Expand Up @@ -92,6 +95,12 @@ $(PRJDIR)$(3)/$(1)/.vscode/tasks.json : tensorflow/lite/micro/tools/make/templat
@cp $$< $$@

generate_$(3)_$(1)_project: $(addprefix $(PRJDIR)$(3)/$(1)/, $(4) $(5) $(2))
ifeq (mbed, $(1))
$(eval macrolist := $(call getmacros, $7, $8))
$(eval jsonfilename := $(PRJDIR)$(3)/$(1)/mbed_app)
@awk 'FNR==NR{ if (/}/) p=NR; next} 1; FNR==(p-1){ n=split("$(macrolist)",a," "); print(" ,\"macros\": [");for (i=1; i <= n; i++){ printf(" \"%s\"", a[i]); if(i<n){printf(",\n")}}printf("\n ]\n")}' \
$(jsonfilename).json $(jsonfilename).json > $(jsonfilename).tmp && mv $(jsonfilename).tmp $(jsonfilename).json
endif

list_$(3)_$(1)_files:
@echo $(4) $(5)
Expand Down

0 comments on commit cd311a8

Please sign in to comment.