Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Issues with GCC Link Time Optimization (LTO) Feature in PSoC ® Creator™ 3.1

Issues with GCC Link Time Optimization (LTO) Feature in PSoC ® Creator™ 3.1

Anonymous
Not applicable

Why GCC LTO does not work in PSoC ®Creator project and how to enable it?

 

The versions of GCC that ship with PSoC Creator (version 3.0 or later) are known to be susceptible to issues with the GCC Link Time Optimization (LTO) feature as described below.

Which PSoC ® Creator™ designs use GCC LTO?

1. If you are using PSoC Creator 3.1 with the GCC toolchain and you set the following in the Build Settings dialog, you are at risk.

Note: These settings were removed from PSoC Creator 3.2 to prevent users from encountering problems.

Link Time Optimization set to "True" under Compiler > Optimization

Optimization Level set to other than "None" under Linker > Optimization

2. If you are using any version of PSoC Creator with the GCC toolchain and you manually enabled LTO via the –flto command line argument in the Build Settings dialog, under Compiler or Linker > Command Line > Custom Flags, then you are at risk.

 

Issues with GCC Link Time Optimization (LTO) Feature in PSoC ® Creator™ 3.1

 

Issue 1 – GCC Linker Error: Referenced Symbol Defined in Discarded Section

If GCC LTO has been enabled for your design, the linker may choose to optimize your design erroneously. This will result in a GCC linker error, similar to the following:

`_sbrk' referenced in section `.text._sbrk_r' of <path>/arm-none-eabi/lib/armv6-m\libg_s.a(lib_a-sbrkr.o): defined in discarded section `.text' of .\CortexM0\ARM_GCC_484\Release\Cm0Start.o (symbol from plugin)

Note: Even if the design currently compiles cleanly, seemingly unrelated changes can possibly trigger the defect.

See also Overridden weak symbol being discarded when using -flto.

 

Issue 2 – Hard Fault During PSoC 4/PSoC 5LP Initialization

If GCC LTO has been enabled for your design and you are using any PSoC 4 or PSoC 5LP family device, the CPU may hard fault during initialization. This is due to a conflict between cross-module inlining and ISR remapping in the cy_boot Component version 4.20 or earlier.

To resolve this issue in PSoC Creator 3.2, update your cy_boot Component to version 5.0.

To resolve this issue in PSoC Creator 3.1 or earlier, turn off LTO for the Generated_Source/<PSoC4 | PSoC5>/cy_boot/Cm0Start.c file. Right-click on this file in the Workspace Explorer, and disable the compiler Link Time Optimization setting; see "How do I know if my design is using GCC LTO?"

 

Version: *A

Translation - Japanese: PSoC® Creator™ 3.1 GCC リンク タイム オプティマイゼーション (LTO) 機能における既知の問題 - KBA97708 - Community Translated (JA)

0 Likes
1706 Views