From 7717d7b6e24b4d361ca7c5e7ef12f056e898e357 Mon Sep 17 00:00:00 2001 From: Per <Per Lindgren> Date: Tue, 28 Feb 2017 11:11:08 +0000 Subject: [PATCH] doc --- README.md | 15 ++++++++++----- include/SRP.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1943ef2..ea7b61a 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,11 @@ For further info on gdb debugging in eclipse see e.g., http://gnuarmeclipse.gith The trace_printf is redirected to the ITM port, and you should get a trace of your program in the terminal. Notice, that setting breakpoints in the code may be a bit wonky, we use macros and that confuses the eclipse gdb interface. -The `BREAKPOINT` macro infers a compiler barrier that "should" allow you to put breakpoints in the code. Stepping in code that -is creating interrupts is also wonky, e.g., if sigle stepping over a `JOB_REQUEST` (that "pends" the corresponding interrupt handler), -the pend bit is correctly handeled. This is not a problem for this project only, but a general problem of the gdb integration, so -be aware. +The `BREAKPOINT` macro infers a compiler barrier that "should" allow you to break at those +(there are two such `BREAKPOINT`s in the exampe, try put a breakpoint on those to see how it works) . Stepping in code that +causes interrupts is also wonky, e.g., when sigle stepping over a `JOB_REQUEST` (that "pends" the corresponding interrupt handler), +the pend bit is not correctly handeled (and the corresponding interrupt not taken). These problems are present for this project only, +but general to the gdb debug integration, so be aware. ## Problems @@ -66,7 +67,11 @@ ordinary file but rather a (linux/posix) FIFO, allowing the openocd to pipe data and restart it, and try to launch the debugger again. ## Tips - +If you want, you can inspect the `BASEPRI` register (you find it under Registers) to see the system ceiling, but be aware that the priority is the hardware prio, shifted. +(See how we use the `__set_BASEPRI_MAX` in the `LOCK` macro.) +The current running priority is a bit harder to see, however you see the call stack (in the Debug window, and we know the prio +for each task/job/interrupt handler). Notice, the call stack shows the name of the handlers, but we have defined +the mapping, so its easy to reverse, right! diff --git a/include/SRP.h b/include/SRP.h index 54ea8bd..09741d4 100644 --- a/include/SRP.h +++ b/include/SRP.h @@ -12,7 +12,7 @@ #define Ceiling(R) (R##_Ceiling) #define Code(J) (J##_Code) #define IRQn(J) (J##_IRQn) -#define H(X) (16-X) +#define H(X) ((1 << __NVIC_PRIO_BITS)-X) #define IRQh(J) (J##_IRQh) #define BARRIER_LOCK { asm volatile("dsb\n" "isb\n" ::: "memory"); } -- GitLab