This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What is ?C?LIB_CODE

I found ?CO?LIB_CODE occupy a large address space in
every bank in my project.
What is ?C?LIB_CODE? I've search this keyword on web but I can't find any explanation. Would any one please explain this to me? It looks like I've used some library codes provided by Keil? what kind of codes would occupy this section?
Thank you.

  • It looks like I've used some library codes provided by Keil? what kind of codes would occupy this section?

    You've answered your own question. Yes, you've used some C standard library functions (and possibly some compiler runtime support functions, too).

    You didn't give any concrete figures (how large is "large"?), so it's quite impossible to know which routines you might have been calling. The usual suspects for are *printf(), *scanf() and floating-point math.

  • CODE 6398H 114BH UNIT ?C?LIB_CODE

    It occupy 4.3KB
    Yes, there are many printf in my project.

    As I know, the code size of one or more printf should be the same, isn't it?

    I found some sin, cos, ceil, floor and sqrt operations in my project. Also some floating point operations like
    tmp = (float)x + r * cos(angle);

    Why floating point operations takes code space in ?C?LIB_CODE ?

    Can I just put ?C?LIB_CODE in a bank rather than common bank?

    Thanks for your response.

  • I found some sin, cos, ceil, floor and sqrt operations in my project. Also some floating point operations like
    tmp = (float)x + r * cos(angle);

    Well, as the saying goes: "Don't do that, then!"

    Floating-point arithmetic is just about the last thing on earth you should use an 8051 for. Particularly if you're worried about code size, speed or anything else relating to general efficiency of the code.

    The price for violating this rule is a massive amount of run-time support code. Every single operation involving floating-point numbers will have to be delegated to a library routine. Library functions like sin() and cos() will probably end up outside the specialized library segment, but the implementations of '+', '-', '*', '/' and '=' will be in it.

  • "Why floating point operations takes code space in ?C?LIB_CODE ?"

    The processor does not have any support for floating point arithmetic, so it has to emulate everything, i.e. a help function in the library must perform the actual 'add' or 'subtract' or ...

  • Have you really?

    Putting "?C?LIB_CODE?" into the 'Search' box in the blue band along the top of this very page gives 195 hits - could you really not glean anything from any of them?