PSoC Creator 3.3 SP1, CMSIS, Link Time Optimization and sprintf() results in error | Cypress Semiconductor
PSoC Creator 3.3 SP1, CMSIS, Link Time Optimization and sprintf() results in error
I'm working with the CMSIS DSP libraries on a PSoC 5LP. The CMSIS lookup tables need a lot of program space (~93% of flash used with only minimal application code), so I decided to enable 'link time optimization'. This punched the flash usage to below 10%.
Now, I want to use functions like sprintf() etc, but this throws me the 'issue 1' error described here:
So, even if the knowledge base article is tagged for PSoC 4, the solution posted at the end of the article also applies to PSoC 5LP:
disable LTO for Cm3Start.c file. This adds only ~1.5% percent to the flash usage, so now I'm at ~10% flash usage, but at least the application compiles without errors.
Hope this will help other users if they encounter the same problem.
- Please remove the PSoC 4 tag of the KBA - it seems that this error also applies to PSoC 5LP.
- Also please review the KBA statement which states that the LTO settings will be removed on PSoC Creator 3.2 and later. I'm on 3.3 SP1 (126.96.36.19943) and still have those options. Please note: I'm glad that those options are still there, otherwise I'd have to manually remove unused data from CMSIS files - some kind of a No-Go.
- Please review support case #3160570872 to see why 'remove unused sections' isn't enough when using CMSIS - it seems LTO must be used also in this case, otherwise CMSIS will use most of the available memory.
- Also note that the KBA is missleading regarding the solution: the statement 'To resolve this issue in PSoC Creator 3.1 or earlier, turn off LTO for...' is posted for issue 2 (PSoC 4 related), but the same solution also applies for issue 1 (at least the project compiles without errors...).