diff options
author | Paul Selkirk <paul@psgd.org> | 2018-04-06 16:14:43 -0400 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2018-04-06 22:34:05 -0400 |
commit | 6c7bd80b4e7bc5af1659b14b7fb0038f3dc53989 (patch) | |
tree | a10451c611dcf9f7d31a019c6bbc2e81fc8cd9ac /Makefile | |
parent | b35b87ea14016760786319a23b87792f1e1041de (diff) | |
parent | f508e24f5b872a8f7d642eb4fb2217dd1497de96 (diff) |
Merge branch 'profiling'
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -27,6 +27,16 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# A couple features that can be enabled at build time, but are not turned on +# by default: +# DO_PROFILING: Enable gmon profiling. See libraries/libprof/README.md for +# more details. +# DO_TASK_METRICS: Enable task metrics - average/max time between yields. This +# can be helpful when experimentally adding yields to improve responsiveness. +# +# To enable, run `make DO_PROFILING=1 DO_TASK_METRICS=1` +# (or DO_PROFILING=xyzzy - `make` just cares that the symbol is defined) + # export all variables to child processes by default .EXPORT_ALL_VARIABLES: @@ -51,6 +61,9 @@ LIBCLI_BLD = $(LIBS_DIR)/libcli LIBTFM_SRC = $(CRYPTECH_ROOT)/sw/thirdparty/libtfm LIBTFM_BLD = $(LIBS_DIR)/libtfm +LIBPROF_SRC = $(LIBS_DIR)/libprof +LIBPROF_BLD = $(LIBS_DIR)/libprof + LIBS = $(MBED_DIR)/libstmf4.a # linker script @@ -114,6 +127,9 @@ CFLAGS += -I$(MBED_DIR)/targets/cmsis/TARGET_STM/TARGET_STM32F4 CFLAGS += -I$(MBED_DIR)/targets/cmsis/TARGET_STM/TARGET_STM32F4/$(BOARD) CFLAGS += -I$(MBED_DIR)/targets/hal/TARGET_STM/TARGET_STM32F4 CFLAGS += -I$(MBED_DIR)/targets/hal/TARGET_STM/TARGET_STM32F4/$(BOARD) +ifdef DO_TASK_METRICS +CFLAGS += -DDO_TASK_METRICS +endif %.o : %.c $(CC) $(CFLAGS) -c -o $@ $< @@ -121,7 +137,13 @@ CFLAGS += -I$(MBED_DIR)/targets/hal/TARGET_STM/TARGET_STM32F4/$(BOARD) %.o : %.S $(CC) $(CFLAGS) -c -o $@ $< +ifdef DO_PROFILING +CFLAGS += -pg -DDO_PROFILING +LIBS += $(LIBPROF_BLD)/libprof.a +all: hsm +else all: board-test cli-test libhal-test hsm bootloader +endif $(MBED_DIR)/libstmf4.a: .FORCE $(MAKE) -C $(MBED_DIR) @@ -141,6 +163,9 @@ $(LIBHAL_BLD)/libhal.a: $(LIBTFM_BLD)/libtfm.a .FORCE $(LIBCLI_BLD)/libcli.a: .FORCE $(MAKE) -C $(LIBCLI_BLD) +$(LIBPROF_BLD)/libprof.a: .FORCE + $(MAKE) -C $(LIBPROF_BLD) + libhal-test: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a .FORCE $(MAKE) -C projects/libhal-test @@ -177,3 +202,4 @@ distclean: clean $(MAKE) -C $(MBED_DIR) clean $(MAKE) -C $(LIBTFM_BLD) clean $(MAKE) -C $(LIBCLI_BLD) clean + $(MAKE) -C $(LIBPROF_BLD) clean |