Topic : Function getting incorrectly removed during build

Forum : ST7/STM8

Original Post
Post Information Post
March 10, 2010 - 5:25pm
Guest

Hi,

I am experiencing a problem where the RKit-STM8 build tools are sometimes removing a function because it appears "uncalled" but actually it is called. Optimization is disabled (Size / 0), but I tried enabling it (Size / 3), and found it to make no difference. I do find that shortening the size of the function in which this problem occurs seems to cause the problem to disappear, but I am not sure why. Could you please help me determine what is going on here? If you email me I may be able to send you portions of the source code, but I do not want to post it to the forum.

From bad map file:
REMOVED UNCALLED SEGMENTS:
--------------------------
?PR??I2C_DEINIT?STM8S_I2C: Function ?I2C_DEINIT in file was not called

From good map file:
TYPE BASE LENGTH RELOCATION SEGMENT NAME
---- ---- ------ ---------- ------------
CODE 00B003H 000025H INSECTION ?PR??I2C_DEINIT?STM8S_I2C

Image of correctly generated call instruction:
http://img363.imageshack.us/img363/1307/goodcallblur.png

Image of incorrectly generated call instruction:
http://img251.imageshack.us/img251/4656/badcallblur.png

Here is my version information:
Ride7: 7.26.09.0351
RKit-STM8 for Ride7: 2.26.09.0317

Replies
Post Information Post
+1
0
-1
March 12, 2010 - 3:20pm
Raisonance Support Team

Hi Jacob,

Thanks for your detailed report. We have succesfully reproduced and fixed the problem. It can arise on projects with a very large number of externs, which was the case with your Args.h "EXT" trick (which I will not disclose here ;^)

In such cases the linker can mess up a fixup, hence will not correctly resolve an object address, which was the case of your I2C_Deinit() function.

The problem has been fixed. We were about to release a new RKit-STM8 but we will perform a new validation pass that includes this fix, so hopefully you will have a corrected RKit within few days.

BTW although I only spent few hours on it I wanted to congratulate you and your team for the quality of your code, very well documented and appropriately structured for an 8-bit architecture!

Best Regards,
Bruno

+1
0
-1
March 12, 2010 - 4:22pm
Guest

Thanks again for all of your efforts; we are looking forward to the new release!