aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2017-09-21 11:24:02 -0400
committerPaul Selkirk <paul@psgd.org>2017-09-21 17:02:07 -0400
commitf508e24f5b872a8f7d642eb4fb2217dd1497de96 (patch)
tree70cbf2d30b20deec0a5cc0568db2ff2871d7ca8f
parent72227852729ed3125af58cff3f593340b3247fed (diff)
cleanup
-rw-r--r--Makefile8
-rw-r--r--libraries/libprof/README.txt18
-rw-r--r--libraries/libprof/gmon.c1
-rw-r--r--projects/hsm/Makefile1
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 <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <stdint.h>
#include "gmon.h"
#include "profil.h"
#include <string.h>
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