Skip to main content
DK.7
Associate III
January 8, 2022
Solved

Why can't I find out the memory value?

Could someone tell me, what I'm doing wrong? Why can't I find out the memory value in "Memory browser" window?

Very simple code:

 uint8_t p = HAL_GPIO_ReadPin(LED_GPIO_Port, LED_Pin);

 printf("Address of variable 'p' is: %p\r\n", &p); // 0x20004ff7

This topic has been closed for replies.
waclawek.jan
waclawek.janBest answer
Super User
January 8, 2022

Variable p might've been optimized out. Try to qualify it as volatile.

[EDIT] If you can't display content of RAM as such, it might be also that the debugger does not work properly for whatever reason. "Blue pill" also sounds like a potential problem with not having a geniune STM32...

JW

9 replies

MM..1
Super User
January 8, 2022

As you write simple code... Hear you about registers?

Your memory browser you open in debuger run ?

DK.7
DK.7Author
Associate III
January 8, 2022

Yes, I heard about the registers.

And yes I opened it is in debugger run!

But I do not understand what you want to say?!?

MM..1
Super User
January 9, 2022

I want say, that your code is compiled and optimized to use register

or by higher level of optimize is wiped out and showed address is stack.

because value p isnt used anywhere.

TDK
January 8, 2022

The "Expressions" or "Variables" tab would be a more appropriate place to view the value of a variable.

"If you feel a post has answered your question, please click ""Accept as Solution""."
DK.7
DK.7Author
Associate III
January 8, 2022

I'm study the addresses and pointers in С. Therefore, I need to use window of "Memory Browser"...

TDK
January 8, 2022

It's not clear from your screenshot if you're in debug mode at all. Even if you are, it does not appear execution is paused. The memory browser won't work unless you are in debug mode and execution is paused. It does not update continuously or when not connected to the chip.

You don't mention what chip you're on (STM32F103?), but unavailable addresses will show up as ???. If you only have 20kB of RAM, this is why the vast majority of the addresses show up as ???.

On top of those, the "Memory Browser" in Eclipse is not the most robust thing. Its functionality is the combination of several third-party tools that do not always work seamlessly together. Expect it to be finicky. You can also use the "Memory" tab with varying results.

"If you feel a post has answered your question, please click ""Accept as Solution""."
DK.7
DK.7Author
Associate III
January 8, 2022

Sorry, I have a "BluePill" stm32f103c8t6, RAM=20K, Flash=64K.

CubeIDE v1.8.0.

Operating system is Debian 11.

The chip is connected and debugger is running, not stopped and not on a pause.

Do you think on another board it will work?0693W00000HqyTPQAZ.png

TDK
January 8, 2022

> The chip is connected and debugger is running, not stopped and not on a pause.

Reread my answer about being paused.

"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
waclawek.janBest answer
Super User
January 8, 2022

Variable p might've been optimized out. Try to qualify it as volatile.

[EDIT] If you can't display content of RAM as such, it might be also that the debugger does not work properly for whatever reason. "Blue pill" also sounds like a potential problem with not having a geniune STM32...

JW