cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 SystemCoreClock access crashes the program during HAL initialization

David PICARD
Associate II
Posted on December 22, 2016 at 13:14

I'm trying to blink a LED on a Nucleo-L476 with CubeMX and ST's HAL. It worked perfectly on Windows (System Workbench). Now, I'm trying to do the same on Linux with CubeMX and Qt Createor (my favorite IDE) and OpenOCD. I am now able to compile and debug the target.

However, the program crashes during HAL initialization. More precisely, when it tries to access the

SystemCoreClock

variable. The following code is called from

HAL_Init();

in

main()

:

__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)

{ /*Configure the SysTick to have interrupt in 1ms time basis*/ HAL_SYSTICK_Config(SystemCoreClock/1000); // *** crash here *** /*Configure the SysTick IRQ priority */ HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority ,0); /* Return function status */ return HAL_OK; }

I could replace

SystemCoreClock

by a constant, but the variable needs to be modified further down the line anyway.

SystemCoreClock

is declared in system_stm32l4xx.h and defined in system_stm32l4xx.c. Both files are part of the project.

Any idea ?

Version : CubeMX v4.0 , STM32L4 package v1.6.0.

https://community.st.com/tags#/?tags=hal%20library

https://community.st.com/tags#/?tags=systick

#stm32l4 #cubemx #hal-library #systick
1 REPLY 1
David PICARD
Associate II
Posted on December 26, 2016 at 09:02

Follow-up here :

https://community.st.com/0D50X00009XkYVkSAN