AnsweredAssumed Answered

[bug] SysTick_Handler optimised out of F4 HAL project

Question asked by MWP on Mar 22, 2018
Latest reply on Mar 23, 2018 by MWP

Hi all,


So i've been banging my head up against a wall trying to work out what's been going on here...


Somehow SysTick_Handler() and so HAL_IncTick() are being optimized out (or just not included) in my Release build.

The code/project runs just fine on the target STM32F401 when complied as a Debug build.


When built as a Release build (gcc options are below), the jump location for int15 (SysTick) is the Default_Handler.

I cant understand why this is happening. The HAL libraries are unmodified, and the HAL_IncTick() increments uwTick which is a volatile uint_32. I do use HAL_Delay(), so uwTick is referred to in the normal running of the program.


Has anyone come across this problem before?


The Release GCC options are:

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -ffreestanding -fsingle-precision-constant -flto -Wall -Wno-discarded-qualifiers  -DSTM32F4 -DSTM32F401xC -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -DHSE_VALUE=16000000  -std=gnu11 -Wbad-function-cast


GCC version is:

arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]


Cube is latest version as of today, Cube F4 package version is: