cancel
Showing results for 
Search instead for 
Did you mean: 

Evaluation of commented variables

vbk22398
Associate III

/* USER CODE END 4 */
/*

void calculate_DAC_OUTPUT_Freq(void)
{
sysclk = HAL_RCC_GetSysClockFreq();
//uint32_t data = SystemCoreClock;

pclk1 = HAL_RCC_GetPCLK1Freq();

prescaler_bits = (RCC->CFGR & RCC_CFGR_PPRE1) >> RCC_CFGR_PPRE1_Pos;

timer_clock = pclk1;

if (prescaler_bits != 0) {
timer_clock = 2 * pclk1;
}

timer_prescaler = htim2.Instance->PSC;
period = htim2.Instance->ARR;

timer_frequency = (double) timer_clock
/ ((timer_prescaler + 1) * (period + 1));

dac_output_frequency = timer_frequency / NP;
}

*/
/* USER CODE END 4 */


The above user-defined function is commented. But if I see the variables which are declared globally in debug mode, those variables inside this function is getting updated. If I am not calling this function provided that this function is commented also, how come these variables expressions being evaluated.? And sometimes the variables for which I need to see the live values is not being possible. It will show "failed to evaluate expression". Somebody help me in this issue. 

1 REPLY 1

Suggests they are computed elsewhere, or removed by the linker via dead code/data removal.

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