Recompilation of libraries

  • christopher

    christopher - 2005-03-15

    Hi all,

    I am retargetting SDCC to infineon XC866 microcontroller.

    I recompiled all the library source files
    using small memory model and placed them in c:\sdcc\lib\xc866\small
    Example: c:\sdcc -c  -mxc866 vprintf.c

    Similarly for large model I recompiled all the library source files using large model and placed them in
    Example:c:\sdcc -c -mxc866 --model-large vprintf.c

    The following simple test  program does NOT work with large memory model where as it works fine with small memory model.

    /* test.c */
    #include <stdio.h>
    #include <xc866.h> //for sfr definitions
    void main()
    char str1[4] = "aaa", str2[4]="aaa";
    if (!strcmp(str1, str2))
    printf("PASS:TS_STRCMP_2 (s1=s2)\r\n" );

    This program is compiled using the following option:

    for small memory model
    sdcc -mxc866 test.c -L c:\sdcc\lib\xc866\small

    for large memory model
    sdcc -mxc866 --model-large --xram-loc 0xf000
    --xram-size 512 test.c -L c:\sdcc\lib\xc866\large

    Please let me know in case you find any of the compilation options have to be changed/missing/added for library files in large model or in compiling the test case?

    Thanks in advance,

    • Maarten Brock

      Maarten Brock - 2005-03-15


      What did you do to retarget SDCC? I see in the datasheet it's an 8051 derivative and it has several DPTR's. Did you try to optimize for that? In small model no xdata is used and thereby no dptr, in large everything goes to xdata.

      Basically, first try with SDCC as it is and only create and use your xc866.h. That should work and then continue with the retargetted version.

      Btw. which compiler do you use for retargetting? And feel free to upload improvements in the patches area.


    • christopher

      christopher - 2005-03-15

      Hello Mr. Maarten,

      Thanks for your reply.  I implemented a "putchar" routine for XC866. I want to compile this for memory model small & large. I am using sdcc v2.4.0. I request you to help me in this regard.


    • Maarten Brock

      Maarten Brock - 2005-03-16


      OK, so you're not retargetting the compiler at all, just using it as is (or was, as 2.4.0 is over a year old). Then there is no need to recompile the library. And there is no option -mxc866. Just put the putchar function in (one of) your source file(s) and run.

      Good luck,


Log in to post a comment.