2021-03-17 10:57 PM
Hi,
I am programming a STM32H7B3I-DK Disco board and am trying to profile the functions.
I have a freeRTOS task used as an I2C DMA driver handler. The code is:
/* Main i2c Handler Task */
static void i2c_1_HandlerTsk(void *argument)
{
osSemaphoreAcquire(sampleTimerSemHandle, 0);
/* Initialise the VCNL40x0 Prox Device*/
initProxProbe();
/* Start the sample clock */
HAL_TIM_Base_Start_IT(&htim5);
/* Main sample loop driven by Timer 5 Interrupt */
while(1)
{
if (osSemaphoreAcquire(sampleTimerSemHandle, SAMPLE_TIME_SEM_TIMEOUT / portTICK_PERIOD_MS) == osErrorTimeout)
{
/* TODO */
}
/* Get the proximiter 16 bit value from the device */
ReadProxiOnDemand(&proxValue) ;
/* Remove dc value and low pass filter the data */
LowPassFilt_U.ProxSig = proxValue;
LowPassFilt_step();
/* Apply Auto gain control and detect signal */
Detector_U.DetIp = LowPassFilt_U.ProxSig;
Detector_step();
if (prox.HoldOffTime == 0x00U)
{
/* Disable the holdoff function */
Detector_U.DisableHoldOff = 0x01U;
}
else
{
/* Enable the holdoff function */
Detector_U.DisableHoldOff = 0x00U;
Detector_U.BlockingLength = prox.HoldOffTime;
/* Toggle the Holdoff timer clock input */
Detector_U.Clock = !Detector_U.Clock;
}
}
}
The code is static, definitely gets executed. I have optimizations set to 0 so it shouldn't be optimized out and I have tried the code with inline disabled. When I run the profiler the function does not appear in the list of functions and neither do any of the others that this code calls, however a number of other functions another level down do get logged.
Another peculiar thing is that the Static Analyzer reports this function as "de3ad code" yet the code is executed and is included in the output map of the build.
The code runs perfectly.
Best regards
Rob
Solved! Go to Solution.
2021-03-18 12:15 AM
I found the problem.
My the function has very little code of its own and therefore does not get hit by the tracer. If you run the trace for a long time you might get one or two hits which are reported.
2021-03-18 12:15 AM
I found the problem.
My the function has very little code of its own and therefore does not get hit by the tracer. If you run the trace for a long time you might get one or two hits which are reported.