使用Jlink 连接Arm M0+的单片机,读取数据(32bit)偶发上图中的调动值(通过单片机跟踪调试发现未出现过该跳动值), 不知该现象是由于什么原因造成的,以及如何修改? Freemaster版本为 V3.1.2.4
Hello,
when accessing the target MCU over JTAG (JLink or other probe), FreeMASTER reads the memory asynchronously to main program execution. When reading 64bit (or misaligned 32bit) variables, it may happen the read occurs simultaneously with the CPU write cycle.
The read may return bad (inconsistent) data when the variable is just being modified.
This issue would not occur if you use UART or other "active" communication.
Regards,
Michal
Thanks for your reply,
Can I set a filter so that the point is not drawn?
There are some filtering options you can apply in the variable definition, but I do not think it will help with glitches like this.
I'm afraid there is no way the FreeMASTER can detect the value it reads is not correct.
Regards,
Michal
Thanks for your reply,
So there is no good way to solve this phenomenon,By the way,Does this happen if the variable is 8 bits or 16 bits?
Hello,
this issue will never happen on 8 bit variables. Theoretically, it also should not happen on 16 and 32 variables when they are aligned on their size.
CortexM4 may split the write operation to multiple bus cycles when writing un-aligned variables. So it writes one "half" of the value and then the second. The JTAG read operation issued by FreeMASTER may fall between these two cycles so the value is damaged.
You can check your variable address if it is aligned properly. If yes, I would also study if a correct str instruction was used by compiler when writing the variable. If yes, then something else is wrong.
Regards,
Michal
Hello,
I confirm that the variables are 32-bit aligned,but the kernel is ARM Cortex-M0+。