From f508e24f5b872a8f7d642eb4fb2217dd1497de96 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Thu, 21 Sep 2017 11:24:02 -0400 Subject: cleanup --- Makefile | 8 ++------ libraries/libprof/README.txt | 18 ++++++++++-------- libraries/libprof/gmon.c | 1 + projects/hsm/Makefile | 1 - 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index e349ab1..2b421f5 100644 --- a/Makefile +++ b/Makefile @@ -128,6 +128,8 @@ endif $(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 @@ -157,14 +159,8 @@ $(LIBPROF_BLD)/libprof.a: .FORCE libhal-test: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a .FORCE $(MAKE) -C projects/libhal-test -ifdef DO_PROFILING -CFLAGS += -pg -DDO_PROFILING -hsm: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a $(LIBCLI_BLD)/libcli.a $(LIBPROF_BLD)/libprof.a .FORCE - $(MAKE) -C projects/hsm -else hsm: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a $(LIBCLI_BLD)/libcli.a .FORCE $(MAKE) -C projects/hsm -endif bootloader: $(BOARD_OBJS) $(LIBS) $(LIBHAL_BLD)/libhal.a .FORCE $(MAKE) -C projects/bootloader diff --git a/libraries/libprof/README.txt b/libraries/libprof/README.txt index f0b8ee8..f0bacc7 100644 --- a/libraries/libprof/README.txt +++ b/libraries/libprof/README.txt @@ -24,7 +24,7 @@ How to build From the top level, run - make DO_PROFILING=1 hsm + $ make DO_PROFILING=1 hsm By default, all code is profiled, *except* the profiling code itself, because that would cause fatal recursion. @@ -38,24 +38,26 @@ before you try to use it as a remote file system. I recommend executing the following in the projects/hsm directory, so that gmon.out ends up in the same directory as hsm.elf. -Start OpenOCD: +Start the debugger: - $ openocd -f /usr/share/openocd/scripts/board/stm32f4discovery.cfg & + $ ../../bin/debug hsm -Connect to OpenOCD: +In another window, connect to OpenOCD: $ telnet localhost 4444 In the OpenOCD console, enable semihosting: > arm semihosting enable + > exit -In another window, start the debugger: +Then connect to the Cryptech management console: - $ ../../bin/debug hsm + $ cryptech_console -In the CLI, type `profile start`, then start the unit test or whatever -will be exercising the hsm. Afterwards, in the CLI, type `profile stop`. +In the Cryptech console, type `profile start`, then start the unit test or +whatever will be exercising the hsm. Afterwards, in the console, type +`profile stop`. After invoking `profile stop`, it can take several minutes to write gmon.out over OpenOCD to the host. diff --git a/libraries/libprof/gmon.c b/libraries/libprof/gmon.c index 92054fc..317a173 100644 --- a/libraries/libprof/gmon.c +++ b/libraries/libprof/gmon.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "gmon.h" #include "profil.h" #include diff --git a/projects/hsm/Makefile b/projects/hsm/Makefile index 9a75b92..3430e14 100644 --- a/projects/hsm/Makefile +++ b/projects/hsm/Makefile @@ -26,7 +26,6 @@ LDFLAGS += -Wl,--gc-sections ifdef DO_PROFILING OBJS += $(TOPLEVEL)/memfunc.o -LIBS += $(LIBPROF_BLD)/libprof.a LDFLAGS += --specs=rdimon.specs -lc -lrdimon endif -- cgit v1.2.3