regarding public symbols used by compiler and linker

Started by niraj_chavda14 July 26, 2007
Hi to all,

I am want some information regarding public symbols used by keil
compiler.

while single stepping through my code for lpc2214(arm7) I came
across some public symbols like
?C?SDIV ,?C?FCAST, ?C?UDIV, ?C?CASTF etc..

Can anybody tell me
1)what is the purpose of this public symbols.
2)please suggest me the link from where to get the
description of working and task of this public
symbols
3)are they relocateable? can I place them into ram?

>From their names I assume that they are for providing some basic
services to upper level functions but

they are not giving desired results while used by functions
located in ram using __ram attribute. i.e only few functions in ram
and remaining code in flash.
Thanks

An Engineer's Guide to the LPC2100 Series

niraj_chavda14 Wrote
>I am want some information regarding public symbols used by keil
>compiler.
>
>while single stepping through my code for lpc2214(arm7) I came
>across some public symbols like
>?C?SDIV ,?C?FCAST, ?C?UDIV, ?C?CASTF etc..
>
>Can anybody tell me
>1)what is the purpose of this public symbols.

They are from the basic C language support library. At a guess they are
signed division, float cast, unsigned division and a cast from float. But
these just guesses, educated perhaps, but still guesses.

>2)please suggest me the link from where to get the
> description of working and task of this public
> symbols

There probably isn't one except internally at Keil. I've only rarely seen
compiler internals like this documented. If for no other reason than the
companies don't want to have to preserve the functions and their calling
conventions as they update the compiler. I have, more frequently, seen the
floating point libraries documented so they can be called from asm or be
used in interrupt routines or RTOS tasks.

>3)are they relocateable? can I place them into ram?

Probably but you'd be better off re-designing your RAM based code to avoid
them.

>From their names I assume that they are for providing some basic
>services to upper level functions but
>
> they are not giving desired results while used by functions
>located in ram using __ram attribute. i.e only few functions in ram
>and remaining code in flash.

And if you relocate them to RAM your flash based code will have problems
calling them.

Robert
--------------------------------
mail2web - Check your email from the web at
http://link.mail2web.com/mail2web
--- In l..., "subscriptions@..."
wrote:
>
> niraj_chavda14 Wrote
> >I am want some information regarding public symbols used by keil
> >compiler.
> >
> >while single stepping through my code for lpc2214(arm7) I came
> >across some public symbols like
> >?C?SDIV ,?C?FCAST, ?C?UDIV, ?C?CASTF etc..
> >
> >Can anybody tell me
> >1)what is the purpose of this public symbols.
>
> They are from the basic C language support library. At a guess
they are
> signed division, float cast, unsigned division and a cast from
float. But
> these just guesses, educated perhaps, but still guesses.
>
> >2)please suggest me the link from where to get the
> > description of working and task of this public
> > symbols
>
> There probably isn't one except internally at Keil. I've only
rarely seen
> compiler internals like this documented. If for no other reason
than the
> companies don't want to have to preserve the functions and their
calling
> conventions as they update the compiler. I have, more frequently,
seen the
> floating point libraries documented so they can be called from asm
or be
> used in interrupt routines or RTOS tasks.
>
> >3)are they relocateable? can I place them into ram?
>
> Probably but you'd be better off re-designing your RAM based code
to avoid
> them.
>
> >From their names I assume that they are for providing some basic
> >services to upper level functions but
> >
> > they are not giving desired results while used by functions
> >located in ram using __ram attribute. i.e only few functions in
ram
> >and remaining code in flash.
>
> And if you relocate them to RAM your flash based code will have
problems
> calling them.
>
> Robert

Thanks for your interest

Actully I want to use a ram function in my code ( using __ram
attribute) I am operating a division operation in that function but
it is not giving desired result and always gives 0 as answer.

So I suspect that this is happening because these public symbols are
still located in flash.

I would like to point out here is that the problem in division
occurs when my variables involved in division operation are global.

I hope somebody can help me or atleast can explain me the reason of
this behavior.

Thanks
niraj_chavda14 Wrote
> >3)are they relocateable? can I place them into ram?
>
> Probably but you'd be better off re-designing your RAM based code
to avoid
> them.
>
> >From their names I assume that they are for providing some basic
> >services to upper level functions but
> >
> > they are not giving desired results while used by functions
> >located in ram using __ram attribute. i.e only few functions in ram
> >and remaining code in flash.
>
> And if you relocate them to RAM your flash based code will have problems
> calling them.
>
>Actully I want to use a ram function in my code ( using __ram
>attribute) I am operating a division operation in that function but
>it is not giving desired result and always gives 0 as answer.

You may have gotten "lucky". As I recall RAM and Flash address spaces are
too widely separated for a simple call which I suspect is what the compiler
is using internally. Does the locater not give any warnings or errors?

>So I suspect that this is happening because these public symbols are
>still located in flash.

It wouldn't surprise me. Note though that relocating those function to RAM
is likely to give you the same problem for functions in Flash.

The real question this raises though is why do you have this function in
RAM? The only uses I can see are for IAP (which can certainly avoid the
use of such functions) or possibly for interrupts which usually can avoid
such functions.

Robert
--------------------------------
mail2web.com What can On Demand Business Solutions do for you?
http://link.mail2web.com/Business/SharePoint