cancel
Showing results for 
Search instead for 
Did you mean: 

memory value change after click reset chip

hjuns
Associate III

Hello,

I use CubeIDE 1.3.0, STM32F769II.

When i debug variable value.

I found value having strange value.

It always happen when i click "reset chip".

0693W000001r9I4QAI.jpg

Memory address is 0x20012C0.

when i start debug. It have 0 value.

0693W000001r9IEQAY.jpg

But when i click "reset chip". 0x20012C0 memory value is changed.

How can i fix it.

Please help me.

Thanks.

7 REPLIES 7
TDK
Guru

Some variables get initialized during boot. This address could be within one of them. Why do you think it's a problem or that it should be 0?

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

Place a data breakpoint on that address, or single-step from the reset vector.

JW

Review .MAP file, check stack settings.

Walk the Reset_Handler code.

Could also be debugger related.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hjuns
Associate III

This address is .data sector, not .bss.

It is initialized global address sector.

So it should be set 0.

You are right.

I set break point this address.

Reset_Handler change value sometimes.

But i allocate 0x20012C0 address into .data sector (Initialized global variable) not .bss .

finally 0x20012C0 address value should be set to 0.

Because it initialized global variable.

Reset_Handler:  
  ldr   sp, =_estack      /* set stack pointer */
 
/* Copy the data segment initializers from flash to SRAM */  
  movs  r1, #0
  b  LoopCopyDataInit
 
CopyDataInit:
  ldr  r3, =_sidata
  ldr  r3, [r3, r1]
  str  r3, [r0, r1]
  adds  r1, r1, #4
    
LoopCopyDataInit:
  ldr  r0, =_sdata
  ldr  r3, =_edata
  adds  r2, r0, r1
  cmp  r2, r3
  bcc  CopyDataInit
  ldr  r2, =_sbss
  b  LoopFillZerobss
/* Zero fill the bss segment. */  
FillZerobss:
  movs  r3, #0
  str   r3, [r2]
  adds  r2, r2, #4
    
LoopFillZerobss:
  ldr  r3, = _ebss
  cmp  r2, r3
  bcc  FillZerobss

Reset_Handler set 0 in CopyDataInit function.

LoopFillzerobss function change 0x20012C0 address value.

How can i do that. :sad_but_relieved_face:

TDK
Guru

Usually you just define variables and let the linker sort out where to put them. That way there is a clear separation between .data and .bss. The default startup script relies on this to be the case.

> But i allocate 0x20012C0 address into .data sector (Initialized global variable) not .bss .

How did you do this? What does your linker file look like?

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

Thank you for your answer.

0693W000001rFHCQA2.jpg

I define large size variable.

"Para" variable allocated 0x200004b4 ~ 0x20002014.