2018-04-09 07:58 AM
Hello,
I have a Nucleo-L476RG and I am trying to debug using openocd. I am able to reach main() function, but when it
calls SystemClock_Config() get stuck in:while(LL_RCC_PLL_IsReady() != 1)
The firmware does not get stuck when running without debug. This happens only in debug mode.
void SystemClock_Config(void)
{
/* MSI configuration and activation */
LL_FLASH_SetLatency(LL_FLASH_LATENCY_4);
LL_RCC_MSI_Enable();
while(LL_RCC_MSI_IsReady() != 1)
{
};
/* Main PLL configuration and activation */
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_MSI, LL_RCC_PLLM_DIV_1, 40, LL_RCC_PLLR_DIV_2);
LL_RCC_PLL_Enable();
LL_RCC_PLL_EnableDomain_SYS();
while(LL_RCC_PLL_IsReady() != 1)
{
};
/* Sysclk activation on the main PLL */
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
{
};
/* Set APB1 & APB2 prescaler*/
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
#ifndef RTOS_FREERTOS
/* Set systick to 1ms in using frequency set to 80MHz */
/* This frequency can be calculated through LL RCC macro */
/* ex: __LL_RCC_CALC_PLLCLK_FREQ(__LL_RCC_CALC_MSI_FREQ(LL_RCC_MSIRANGESEL_RUN, LL_RCC_MSIRANGE_6),
LL_RCC_PLLM_DIV_1, 40, LL_RCC_PLLR_DIV_2)*/
LL_Init1msTick(80000000);
#endif
/* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
LL_SetSystemCoreClock(80000000);
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
#stm32l4 #debug_mode
Solved! Go to Solution.
2018-04-09 08:30 PM
Hi,
I figured out the problem. I was not calling 'load' command after 'monitor reset init'. So the correct commands are:
$ arm-none-eabi-gdb build/hello-world.elf
$ (gdb) target remote localhost:3333
$ (gdb) monitor reset init
$ (gdb) load
$ (gdb) break main
$ (gdb) continue
2018-04-09 09:21 AM
>>The firmware does not get stuck when running without debug. This happens only in debug mode.
And what tool chain are you using?
2018-04-09 08:30 PM
Hi,
I figured out the problem. I was not calling 'load' command after 'monitor reset init'. So the correct commands are:
$ arm-none-eabi-gdb build/hello-world.elf
$ (gdb) target remote localhost:3333
$ (gdb) monitor reset init
$ (gdb) load
$ (gdb) break main
$ (gdb) continue
2018-04-09 10:30 PM
arm-none-eabi-gcc