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_PLLRDY or 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 sets RCC_CR_PLLRDY and 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 SIMULATION build that skips or stubs the hardware accesses in your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With