2021-02-02 01:46 PM
I am using an STM32L4 MCU and IAR Embedded Workbench. I noted that when I start a debug session in the register window the "write-only" bits of a certain register are field with the letter "w" (for example in GPIOx_BSRR). I was wondering if this is the behavior just in the IAR debugger or it happens for other debuggers as well and is there a way to watch these bits in particular when they are written or not.
2021-02-02 03:02 PM
No, they read as 0.
JW
2021-02-03 01:36 AM
No what?! The debugger cannot read it because it returns 0 you mean? Or it can be read but it leads to 0? Does it depend on the debugger?
2021-02-03 02:24 AM
It depends on the exact bit definition as (hopefully) explained in the reference manual. And no, you will not get the state of that bit with any debugger.
2021-02-03 02:47 AM
Thanks, the second part addressed my question. "you will not get the state of that bit with any debugger"
I was kinda hoping that when they are "written" the debugger shows a change of state or something like that.
2021-02-03 02:52 AM
You can set a watchpoint on that register address to see when and what is written.
2021-02-03 03:02 AM
That's the point, how? the register window should watch that register itself but it does not show anything when those bits are written, I could try another way to watch them in the debugger but the result should be the same.
2021-02-03 03:27 AM
Your debugger should be able to set watchpoints, read the docs. In gdb I type e.g. "watch -l <expression>" . On running gdb at the moment I am not sure if e.g. is "GPIOA_>BSRR" or "&GPIOA_>BSRR"
2021-02-03 03:40 AM
What I meant was the debugger IS indeed watching them, they are different ways to watch though, when I open a register window for GPIOA for example all the registers are shown in that window, I could also set a watchpoint just for a certain register of the GPIOA, that should not change anything, I'll try though.
My point was looking at the register window (again in which the registers should be watched) when I write in a "write-only" bit the debugger does not show any change of state.
2021-02-03 05:00 AM
@Uwe Bonnes I tried different ways to watch the BSRR register for all of them the value was "unavailable".
Have you ever watched BSRR or any other "write-only" bit? What do you see/expect in watch?