AnsweredAssumed Answered

[Bug] STM32Cube - HardFault handler has wrong name

Question asked by Vinci on Jan 17, 2016
Latest reply on Mar 22, 2016 by STM32Cube-T
Hello

I'd like to report a bug with the current version of STM32CubeMX 4.12.0 and the F4 libraries 1.10.1 concerning the code generation.

Currently if the user enables the hard fault interrupt the generation tools creates a void function called
void HardFault_IRQHandler(void)
{
  /* USER CODE BEGIN HardFault_IRQn 0 */
 
  /* USER CODE END HardFault_IRQn 0 */
  while (1)
  {
  }
  /* USER CODE BEGIN HardFault_IRQn 1 */
 
  /* USER CODE END HardFault_IRQn 1 */
}


But whoever wrote that code clearly didn't pay any attention to the name convention of the vectors in the startup files
g_pfnVectors:
  .word  _estack
  .word  Reset_Handler
  .word  NMI_Handler
  .word  HardFault_Handler
  .word  MemManage_Handler
  .word  BusFault_Handler
  .word  UsageFault_Handler
  .word  0
  .word  0
  .word  0
  .word  0
  .word  SVC_Handler
  .word  DebugMon_Handler
  .word  0
  .word  PendSV_Handler
  .word  SysTick_Handler


So even if a hard fault occurs the code would still only enter the handler defined as default according to the startup code, not the actual hard fault handler.
Please change either of those two, preferably the one from the code generation tool since the "IRQ"-prefix is confusing.

I guess other libraries are affected as well.

Best regards

Outcomes