cancel
Showing results for 
Search instead for 
Did you mean: 

How to interpret the "Expressions" of Arrays in Debug mode of CubeIDE?

A.D.
Associate III

I can't really see how the "Expression" window in the STM32CubeIDE in Debug mode is interpreting arrays.

I have an array "receiveData" with 7 uint8_t elements that I receive via UART.

When I check out this array under "Expressions" I see that the array has 7 elements, just as expected. But while the value is != 0, all array elements are shown with value 0! I would have expected the first to Hex-digits from "value" belonging to element 0, the next two digits to element 1 and so on.

And in the detailed window at the bottom of the screenshot it only shows 6 times "\0" under details, not 7 times.

So my two questions are:

  • Why are all elements 0, while the value of the array in general is != 0?
  • Why is the "Details" parameter showing less elements than the array actually has?

 0693W000000VJ28QAG.png

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

The Value for receiveData is the address of the array, not the values within the array.

It has 7 elements, which matches the definition. The first element is index 0.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

6 REPLIES 6
TDK
Guru

The Value for receiveData is the address of the array, not the values within the array.

It has 7 elements, which matches the definition. The first element is index 0.

If you feel a post has answered your question, please click "Accept as Solution".
A.D.
Associate III

Oh right, it is the address, that makes sense.

But still, under "details" it does show only 6 elements, not 7.

TDK
Guru

Looks like it's interpreting it as a string and leaving off the terminating null character, but including null characters "within" the string. Who knows.

If you feel a post has answered your question, please click "Accept as Solution".
A.D.
Associate III

I guess that makes sense. OK, thanks for the quick answers!

help some project on git u-blox NUCLEO-64 STM32L476RG

some project on git u-blox NUCLEO-64 STM32L476RG