<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Manipulating Standard Libraries (C51S.LIB)</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/18127/manipulating-standard-libraries-c51s-lib</link><description> So I want to replace a standard function in the C51S library. Shouldn&amp;#39;t be too hard, right? 
 
I rewrote the function (?C?LMUL to be specific) in assembly and compiled it using the A51 assembler. (processes it without complaint) The code looks like this</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Manipulating Standard Libraries (C51S.LIB)</title><link>https://community.arm.com/thread/111150?ContentTypeID=1</link><pubDate>Wed, 03 Nov 2004 16:45:41 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e1b09c07-57df-4957-9809-7005bfe42cb1</guid><dc:creator>Garrett Chandler</dc:creator><description>&lt;p&gt;Thanks to all of you for your help and suggestions - I now have it working seamlessly. (The linking process at least - I&amp;#39;ll have to finish debuging my new LMUL code tomorrow.)&lt;br /&gt;
&lt;br /&gt;
For posterity (as well as the purpose of science) I figured it best if I posted back the solution to the problem.&lt;br /&gt;
&lt;br /&gt;
The source code eneded up looking like this...&lt;br /&gt;
&lt;pre&gt;
; Going Public
PUBLIC ?C?LMUL

; Segment Definition
?PR?LMUL	SEGMENT	CODE

; Module Start
RSEG	?PR?LMUL
?C?LMUL:
MOV	...
...
END
&lt;/pre&gt;
As you can see, I had to throw a label in there at the top of the routine and declare THAT as public at the start of the file.&lt;br /&gt;
&lt;br /&gt;
This ASM file was added to my source group and uV2 substitutes it for the STDF without complaint. What a great tool.&lt;br /&gt;
&lt;br /&gt;
Like I said, this links perfectly - I checked the machine code. As for why my new rounine not working, I don&amp;#39;t think that problem is associated with the topic of this thread, but if in the end it is - I will be back to correct myself for anyone else reading for sure.&lt;br /&gt;
&lt;br /&gt;
Thanks again for everyone&amp;#39;s input.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manipulating Standard Libraries (C51S.LIB)</title><link>https://community.arm.com/thread/96687?ContentTypeID=1</link><pubDate>Wed, 03 Nov 2004 09:23:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f583f403-3a96-438f-a78b-2ed4752295f0</guid><dc:creator>Jon Ward</dc:creator><description>&lt;p&gt;&lt;i&gt;You mention including it in the linkage &amp;quot;before&amp;quot; the KEIL libraries. In uVision, would I do this on the BankerLinker Misc tab or as a preprocessor directive in the C code that I am trying to roll this new LMUL into.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
You can do it this way or an easier way is to just add the LIB file to the project just like it was a C or ASM file.  uVision knows how to handle it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Jon&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manipulating Standard Libraries (C51S.LIB)</title><link>https://community.arm.com/thread/111138?ContentTypeID=1</link><pubDate>Wed, 03 Nov 2004 07:32:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3e1ba79d-ee7b-4dc5-a0fa-ee423ab8a311</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;I can not say this is the cause, but on some library work I have seen the NAME pseudo-op being extremely important.  Try inserting a NAME statement.&lt;br /&gt;
Oh, i recall, if you copy a module to another name to make two slighbtly different libray functions and forget to change the NAME statement in the modified copy, all hell breaks lose with meaningless error messages and who knows what.&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manipulating Standard Libraries (C51S.LIB)</title><link>https://community.arm.com/thread/96690?ContentTypeID=1</link><pubDate>Wed, 03 Nov 2004 06:47:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:dc0aabd8-6f57-45d1-bb5d-19c581439887</guid><dc:creator>Keil Software Support Intl.</dc:creator><description>&lt;p&gt;A segment is not a symbol, therefore you get syntax error.&lt;br /&gt;
&lt;br /&gt;
See: &lt;a href="http://www.keil.com/appnotes/docs/apnt_149.asp"&gt;http://www.keil.com/appnotes/docs/apnt_149.asp&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This explains how to structure assembler files. Also you find plenty of examples under &lt;a href="http://www.keil.com/support/"&gt;http://www.keil.com/support&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
As a general rule: do not modify C51 run-time libraries. Just add your modifications to an own library.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manipulating Standard Libraries (C51S.LIB)</title><link>https://community.arm.com/thread/72839?ContentTypeID=1</link><pubDate>Tue, 02 Nov 2004 23:12:27 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c1a76e3e-6561-4c08-8196-54960d97934a</guid><dc:creator>Garrett Chandler</dc:creator><description>&lt;p&gt;Jon:&lt;br /&gt;
&lt;br /&gt;
I had tried making the symbol public also, but when assembling the following...&lt;br /&gt;
&lt;pre&gt;
; Segment Definition
?C?LMUL	SEGMENT	CODE

; Going Public...
PUBLIC ?C?LMUL

; Module Start
RSEG	?C?LMUL
MOV	...
...
END
&lt;/pre&gt;
... I get error 33 from the assembler, ie conflicting attributes - &amp;quot;A symbol may not contain the attributes PUBLIC and EXTRN simultaneously&amp;quot; - on the &amp;#39;PUBLIC ?C?LMUL&amp;#39; line.&lt;br /&gt;
&lt;br /&gt;
I agree with you 110% that replacing this in the standard library is not a best practice - I just needed a quick proof of concept.&lt;br /&gt;
&lt;br /&gt;
As for making my own library, that sounds like a better direction of travel - but I don&amp;#39;t know how to get my routine to be called instead of the standard LMUL.&lt;br /&gt;
&lt;br /&gt;
You mention including it in the linkage &amp;quot;before&amp;quot; the KEIL libraries.  In uVision, would I do this on the BankerLinker Misc tab or as a preprocessor directive in the C code that I am trying to roll this new LMUL into.&lt;br /&gt;
&lt;br /&gt;
Your help is greatly appreciated!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Manipulating Standard Libraries (C51S.LIB)</title><link>https://community.arm.com/thread/43079?ContentTypeID=1</link><pubDate>Tue, 02 Nov 2004 21:47:09 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:74ed61e2-f3e5-4c3a-9617-54d54316fe71</guid><dc:creator>Jon Ward</dc:creator><description>&lt;p&gt;It doesn&amp;#39;t appear that you made ?C?LMUL PUBLIC.&lt;br /&gt;
&lt;br /&gt;
Also, why replace these files in the library?  You can create your own library and just include it in the linkage BEFORE the Keil libraries.  Replacing the modules in the Keil libraries is potentially going to cause you lots of problems in the future.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Jon&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>