cancel
Showing results for 
Search instead for 
Did you mean: 

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

OW1TY2
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Guillaume K
ST Employee

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 .

View solution in original post

7 REPLIES 7
Peter BENSCH
ST Employee

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.

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

 

Peter BENSCH
ST Employee

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.

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

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

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 .

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