cancel
Showing results for 
Search instead for 
Did you mean: 

Override an autogenerated function in HAL SPI library

eds
Associate III

Hello everyone,

I'm working on a project using STM32 and I'm facing a recurring issue with the STM32CubeIDE and the HAL library concerning the SPI_DMATransmitReceiveCplt() function It is a static function so rewriting it in another source causes errors.

In my application, I need to override the SPI_DMATransmitReceiveCplt() function that is auto-generated by STM32CubeIDE as part of the SPI HAL. Every time I regenerate the code from the .ioc file, any custom attributes like __weak are reset, and my overriding function leads to redefinition errors.

Moreover, there is no designated user code section within this specific function where I can safely place my modifications to ensure they remain unaffected by code regeneration.

Here's what I am ideally looking to achieve:

  • Override the SPI_DMATransmitReceiveCplt() function without having to manually reinsert the __weak attribute or make other modifications after each regeneration.
  • Ensure that my overriding function remains in place and functional regardless of how many times I regenerate the HAL code.

Does anyone have experience with this issue or know of a method to make persistent modifications to auto-generated HAL code in STM32CubeIDE? 

 

0 REPLIES 0