CodeProver: Non-terminating loop: condition var is read from HW in interrupt

2 次查看(过去 30 天)
simplified embedded C code:
void main()
{
...
do
{
uint16 voltage = GetVoltage();
} while (voltage > 60);
// voltage is high enough to continue
...
}
uint16 GetVoltage()
{
return m_voltage;
}
interrupt void ReadAdc()
{
if(ADC.ConversionDone = true)
{
m_voltage = ADC.Result;
}
}
Code Prover error for "do":
Non-terminating loop
The loop is infinite or contains a run-time error.
Loop may be infinite.
Is that because Code Prover doesn't know what the ADC.Result returns (it could be 0 forever (which would be OK for this code), or a value bigger than 60)?
Or because of an incorrect interrupt configuration in Polyspace?
I tried adding ReadAdc() to -cyclic-tasks or -interrupts, but that didn't help.

回答(0 个)

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by