summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Palsson <karlp@etactica.com>2021-09-20 19:05:26 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2022-01-26 23:40:29 +0100
commite141ef35b9a93ed174f206bf8cdae0c34c0a7fd2 (patch)
tree291edf56f26c28e5c33ab9fcaadc58d8aa5313b1
parent27f7154ec6fdcc58e575d235bd5917fc4e447119 (diff)
cortex-debug: add blocking ITM helpers.
Sometimes you really would like to slow things down to get trace out.
-rw-r--r--cortex_m/debug.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/cortex_m/debug.h b/cortex_m/debug.h
index 5375e70..8134829 100644
--- a/cortex_m/debug.h
+++ b/cortex_m/debug.h
@@ -18,6 +18,32 @@ struct ITM_reg_t {
volatile uint32_t TCR;
uint32_t _reserved4[76];
volatile uint32_t LSR;
+
+ // FIXME - only supports first 32 stimulus ports
+ void stim_blocking(unsigned stim, uint8_t data) {
+ if (!(this->TER[0] & (1<<stim))) {
+ return;
+ }
+ while (!(this->STIM[stim].u8 & 1))
+ ;
+ this->STIM[stim].u8 = data;
+ }
+ void stim_blocking(unsigned stim, uint16_t data) {
+ if (!(this->TER[0] & (1<<stim))) {
+ return;
+ }
+ while (!(this->STIM[stim].u16 & 1))
+ ;
+ this->STIM[stim].u16 = data;
+ }
+ void stim_blocking(unsigned stim, uint32_t data) {
+ if (!(this->TER[0] & (1<<stim))) {
+ return;
+ }
+ while (!(this->STIM[stim].u32 & 1))
+ ;
+ this->STIM[stim].u32 = data;
+ }
};
struct DWT_reg_t {