Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IAR Workbench Simulator on a STM32G0 get stuck at wait till PLL is ready

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.

like image 702
user217354 Avatar asked Oct 30 '25 02:10

user217354


1 Answers

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.

like image 163
Clifford Avatar answered Nov 01 '25 12:11

Clifford



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!