diff --git a/README.md b/README.md index 1943ef2d90a85e73bf96f24c41932868a9ce319e..ea7b61ace1666c64527247abfc27fbf6a3d4213a 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 54ea8bd2d90477fb651ae6a79b37ce82a7b3a9f1..09741d467b57b1e919dbda804fb23bea24f69cc3 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"); }