cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX Generated Linker File Update Breaks C++

CodyPlexus
Visitor

A recent update to CubeMX (Version 6.15.0) has caused newly generated linker files (Such as CM7/stm32h747xx_flash_CM7.ld) to generate with the following code:

 

  /* Remove information from the standard libraries */
  /DISCARD/ :
  {
    libc.a:* ( * )
    libm.a:* ( * )
    libgcc.a:* ( * )
  }

 

Previously, we generated this code on version 6.14.1 and got the following instead:

 

  /* Remove information from the standard libraries */
  /DISCARD/ :
  {
    libc.a ( * )
    libm.a ( * )
    libgcc.a ( * )
  }

 

This change causes the new version to unconditionally discard C++ standard library code which is a valid thing to do for pure C code, but not for C++ which leverages generated C as ST addressed in this forum post. https://community.st.com/t5/stm32cubemx-mcus/compilation-failure-after-upgrade-to-stm32cubemx-6-15/td-p/837335 

I believe the previous versions only discarded the unused sections, which would allow it to discard for C and stay around if linked to via C++.

We are a C++ shop and heavily leverage ST hardware in our designs. Is ST no longer supporting C++ usage with CubeMX?



For context and reproducibility, we are generating this code for a stm32h747xi processor. I have attached the IOC from the older version of CubeMX. An upgraded CubeMX will try to migrate it which changes nothing other than the version encoded into the IOC. I have confirmed other IOCs for other processors will also generate with this new discard code.

0 REPLIES 0