I have an example code that calls SystemClock_Config() in the main function.
When i launch the simulation from IAR Workbench the main function get stuck in the above call particularly when it does
/* Wait till PLL is ready */
while (READ_BIT(RCC->CR, RCC_CR_PLLRDY) == 0U)
{
if ((HAL_GetTick() - tickstart) > PLL_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
I just recently started playing around with this tool. I thought that the simulator was supposed to take care of this given there is no "PLL" since i don't have an HW.
It is an ARM I instruction set simulator, it does not simulate peripheral hardware, including the PLL.
You could manually set
RCC_CR_PLLRDYor skip the loop by setting the program counter to a point after the loop, or you could write a debugger script attached to a breakpoint that setsRCC_CR_PLLRDYand continues (if IAR had that capability).You will no doubt however encounter similar issues with any hardware peripherals,on or off chip.
An alternative is to use conditional compilation for a
SIMULATIONbuild that skips or stubs the hardware accesses in your code.