cancel
Showing results for 
Search instead for 
Did you mean: 

STM32cubeide how to display variables in hex format?

Raymond Buck
Senior

When debugging using SWD if I stop at a breakpoint to check the value of a variable, the variable value is displayed in decimal. This is really annoying.

How do I change the environment to permanently display variable values in hex when I hover over them? I do not have the variables in the watch window. I realize I can change the number format if the variable is in the watch window. But that means adding every variable to the watch window.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

> Unfortunately that does not work on my system.

Don't click the tab. Click the down arrow on the top right of the variable tab to change the default number format.

Works for me. Win10 STM32CubeIDE.

Make a screenshot to show what you're doing instead. Sounds like you're not understanding.

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

View solution in original post

8 REPLIES 8
TDK
Guru

It displays the value in hex at the bottom of the expression window, along with binary and octal.

0693W000001shIyQAI.png

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

TDK, that works fine for a single variable. But it is useless for an array. I have several uint8_t arrays. The individual elements of the array in the Value column of the Expression window display as decimal values. The Hex display doesn't show the individual elements of the array. In fact, I don't know what that number refers to.

The hex values of the attached screen shot are 0x00, 0x04, 0xA3, 0x68, 0xAD, 0x7A. That is what I would like the Value column to display.

Sorry for the image size. I don't know how to make the image larger.

0693W000001shM7QAI.jpg

TDK
Guru

Pick hex format as the default number format for variables.

0693W000001shMCQAY.png

After that, values in hover will be displayed in hex by default.

0693W000001shMHQAY.png

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

Unfortunately that does not work on my system. The only option I have when I click the Variables tab is to close the tab or detach it. I can click on the individual variables in the tab and change the number format to Hex. But that has no effect on the variable when I hover over it in the code window.

Are you running STM32cubeide or some other software? I notice above the Number Format you have a tab that says Layout. I don't have anything like that.

Raymond Buck
Senior

TDK,

Further testing reveals changing number format to hex does work if..............

I change the number format to hex but when I hover over the variable in the Expression window, it continues to display in decimal. HOWEVER, if I close STM32cubeide, restart it, and restart the debug session, now when I hover over the variable it displays the value in hex in the Expression window. I have to do this for any variable I want to display as hex. I guess that is just one of the quirks of STM32cubeide.

TDK
Guru

> Unfortunately that does not work on my system.

Don't click the tab. Click the down arrow on the top right of the variable tab to change the default number format.

Works for me. Win10 STM32CubeIDE.

Make a screenshot to show what you're doing instead. Sounds like you're not understanding.

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

Attached is a screenshot. I don't see a down arrow on the variable tab. However, as I mentioned in my last post it does work if I set the variables to hex and restart STM32cubeide. So I guess it is working well enough for debugging purposes.0693W000001shtQQAQ.jpg

Raymond Buck
Senior

TDK, I see what you mean now. The down arrow is on the far right of the toolbar above the Value column. That works and changes the variables to hex.

0693W000001shuTQAQ.jpg