2018-12-12 03:03 AM
Hello!
The Cosmic compiler supports "weak" functions to override them in the future?
2018-12-12 04:32 AM
Yes.
Not limited to the "Cosmic" compiler, a label defined as "weak" might appear twice in a project.
In other words, the label can appear once, or twice with one occurence defined as "weak". In the latter case, the non-weak definition takes precedence.
This is e.g. used to supply default implementation for interrupt handlers.
2018-12-12 05:42 AM
Thanks for the answer!
As a matter of fact, I wanted to find the syntax [weak] for STVD / Cosmic for STM8. The CXSTM8 documentation did not find this =(
2018-12-12 06:06 AM
I did a project for a STM8 several years ago, with another toolchain (forgot its name ...).
Not sure who "invented" it, but the "weak" attribute is supported by all gcc-based toolchains for ARM/Cortex M, and AFAIK also the Keil and IAR one's.
The "weak" support includes the assembler and linker as well.
2018-12-27 10:40 PM
weak should be used when there is no other implementable way, because it is like a pandora box. You mayl see it as making your life easier at first...