Skip to main content
Associate II
February 15, 2024
Solved

How can I locate the starting address of a variable in STM32CubeIDE?

like the following code:

 

 

 

int ANDresult = i&j;

 

 

 

The value of ANDresult is 0x20022002. In our assignment our professor asked us to write down the address of the variable ANDresult, I tried to add ANDresult as an expression in the Memory monitor but the CubeIDE redirected to the address 0x20022002, which obviously is not the address of ANDresult.

Thanks!

Debugger: STLink V2

MCU:STM32F103VET6

This topic has been closed for replies.
Guillaume K
Guillaume KBest answer
ST Employee
February 15, 2024

Hi

STM32CUbeIDE 's Memory Monitor requires an address. When you give the Memory monitor the variable name "ANDresult", it believes it is an address. Just give Memory monitor the address to the variable: &ANDResult.

Another approach would be to use the "Variables" window or the "Expressions" window to see directly ANDresult .

7 replies

Peter BENSCH
ST Technical Moderator
February 15, 2024

Welcome @OW1TY2, to the community!

Where do you get the certainty that this is NOT the address?

Have you looked at the memory structure of the STM32F103xE, which you can find in the data sheet?

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
OW1TY2Author
Associate II
February 15, 2024

Because the content of the memory address 0x20022002 are all "?", and I'm certain that 0x20022002 shall be the exact value stored in the variable ANDresult.

Like this:

OW1TY2_0-1707990080842.png

 

AScha.3
Super User
February 15, 2024

You have to "pause" debug, to see the (updated) values .

If you feel a post has answered your question, please click on " Best Answer ".
Peter BENSCH
ST Technical Moderator
February 15, 2024

OK, now I've checked the data sheet myself: the STM32F103VET6 has 512KB flash and therefore 64KB SRAM, which in fact cover an address space between 0x20000000 and 0x2000FFFF. So if you are now talking about 0x20022002, this may well be the value of ANDresult and therefore the result of the AND function.

What is the value (not the adress) of i and j?

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Guillaume K
Guillaume KBest answer
ST Employee
February 15, 2024

Hi

STM32CUbeIDE 's Memory Monitor requires an address. When you give the Memory monitor the variable name "ANDresult", it believes it is an address. Just give Memory monitor the address to the variable: &ANDResult.

Another approach would be to use the "Variables" window or the "Expressions" window to see directly ANDresult .

OW1TY2Author
Associate II
February 16, 2024

So does it mean that to locate the address (not value) of a variable in Memory, I have to add a "&" before it?

Guillaume K
ST Employee
February 16, 2024