cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I find out the memory value?

DK.7
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

9 REPLIES 9
MM..1
Chief II

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

Your memory browser you open in debuger run ?

TDK
Guru

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".

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?!?

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

TDK
Guru

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".

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

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

> 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".

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.