Problems with pointers on STM32H725ZGT6
Hello
Global definition of pointers:
unsigned int *uIntUtilityTmpP;
unsigned int *uIntP_2_UtilityTmp;In a function I would like to initialize them with absolute values:
*uIntP_2_UtilityTmp=0x15;
*uIntUtilityTmpP=455;
uCharUtilityTmp=62;
sprintf(print_string,"1 -> *uIntP_2_UtilityTmp: 0x%x, *uIntUtilityTmpP: %d, uCharUtilityTmp: %d\n", *uIntP_2_UtilityTmp, *uIntUtilityTmpP, uCharUtilityTmp);
writeMessageRS232(PRIMARY_COM_PORT, (uint8_t *)print_string, strlen(print_string));The printout on COM port shows following:
1 -> *uIntP_2_UtilityTmp: 0x1c7, *uIntUtilityTmpP: 455, uCharUtilityTmp: 62
Problem which I have here is that both pointer have the same value. When I write to *uIntP_2_UtilityTmp=0x15 I can see in debugger that also *uIntUtilityTmpP was refreshed with the same value. The same is the case in the next step when I write *uIntUtilityTmpP=455; and then variable *uIntP_2_UtilityTmp gets the same value in this case 455 which is 0x1c7.
Why this is so? What to set in compiler or in microcontroler that this works properly? I am using
STM32CubeIDE, Version: 1.13.0, Build: 17399_20230707_0829 (UTC)
