Hi,
I'm trying to use the weak attribute for the some public API definition to replace once the real APIs were NOT linked.
The step I did is like below:
1. Put kinds of components APIs /w weak attribute function definition in one "c" file, and build it out as a library. Name it "libweak" since all functions in it is weak definition.
And these APIs by components named "libweak.A", "libweak.B", "libweak.C" etc.
2. For these components APIs, there are strong implementation in other libraries, named "libstrong.A", "libstrong.B", "libstrong.C"
3. Now, in the final image linking once libstrong.B was removed, the final image may link libweak.B, libweak.A, libstrong.C.
while the expectation linking is libweak.B, libstrong.A, libstrong.C
* I don't know following info. will help:
The APIs of B were referenced by the c file in the project which produces the final image.
The Weak references and definitions has already referenced but didn't find the answer to this problem.
My Keil version is 5.17
Any idea on it ?
Thanks in advance
BR
hengxing
Hello Hengxing,
mdk 5.17 is too old, could you try it with the latest MDK 5.28a https://www.keil.com/download/ ?
thanks
zheng
Hello hengxing,
I made a short test based on your information. But all works as expected. See also the attached image for reference.
I also used the toolchain version 5.06u1, which is included in MDK 5.17. So, without more details from your side, it is hardly possible to comment on your issue.
Hello Andreas,
Because the files layout in my project is a little complicated and I don't know which part information may relate to the issue,
this results the issue can't produce. Anyway, I worked around the case after a few testing work.
The problem case in my side is :
1. Put all modules weak APIs(module A, B, C in previous mentioned) in a same "C" file, and produce a library libweak
My solution is :
In the step 1, pull different modules weak APIs in separated "C" file, and still produced a library libweak. After that, following steps
are same as before. This time, the final image like as expected: libweak.B, libstrong.A, libstrong.C
I'm still not sure the introduced steps are full to reproduce since my timing issue for isolating, but after this APIs reallocation, it solved my problem.
Thanks
Hengxing
Hello Zheng,
You're right, I've also met other build issue that confirmed w/ KEIL supporter "it need upgrade".
I'm suggesting my management to upgrade the latest MDK.