[Cryptech-Commits] [sw/stm32] branch profiling updated: Correct offset to get the PC.
git at cryptech.is
git at cryptech.is
Sat May 6 17:08:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
paul at psgd.org pushed a commit to branch profiling
in repository sw/stm32.
The following commit(s) were added to refs/heads/profiling by this push:
new 4d69f1a Correct offset to get the PC.
4d69f1a is described below
commit 4d69f1a0ef2ef3aa23b0ac9f1b9cbc84582136a7
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Sat May 6 13:07:59 2017 -0400
Correct offset to get the PC.
A previous version of this code ran over the RTOS, where threads used the
Process Stack, while the SysTick interrupt used the Main Stack. Now
everything's on the main stack, so we need to account for 2 extra words
that SysTick_Handler pushes on the stack at entry.
---
libraries/libprof/README.txt | 4 ++--
libraries/libprof/profil.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libraries/libprof/README.txt b/libraries/libprof/README.txt
index da138c2..9db27a6 100644
--- a/libraries/libprof/README.txt
+++ b/libraries/libprof/README.txt
@@ -53,8 +53,8 @@ In the OpenOCD console, enable semihosting:
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`.
-After invoking `profile stop`, it takes almost 2 minutes to write gmon.out
-over OpenOCD to the host.
+After invoking `profile stop`, it can take several minutes to write
+gmon.out over OpenOCD to the host.
In the projects/hsm directory, run gprof to analyse the gmon.out file:
diff --git a/libraries/libprof/profil.c b/libraries/libprof/profil.c
index 07761dd..004af77 100644
--- a/libraries/libprof/profil.c
+++ b/libraries/libprof/profil.c
@@ -30,7 +30,7 @@ extern void set_SysTick_hook(void (*hook)(void));
/* sample the current program counter */
static void SysTick_hook(void) {
- size_t pc = (size_t)((uint32_t *)__get_MSP())[5];
+ size_t pc = (size_t)((uint32_t *)__get_MSP())[7];
if (pc >= prof.lowpc && pc < prof.highpc) {
size_t idx = PROFIDX (pc, prof.lowpc, prof.scale);
prof.counter[idx]++;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Commits
mailing list