This document contains useful information for embedded software developers who wish to migrate their code from IAR tools to CyberTHOR Studios GNU tools (and vice versa). The IAR compiler command options shown relate to ICCH8. At present, this guide contains the following:
Compiler Options
Compiler Directives
Intrinsic Functions.
C/Math Library Functions.
Revision History:
Version Number | Date | Overview of changes |
1.0 | 23-August-2004 | Created. |
2.0 | 31-August-2004 | A new chapter ‘C & Math library Functions’ is added.
The equivalent GNU directive for IAR ‘#pragma monitor’ is corrected. A new topic with information regarding options only in GNU is introduced. |
3.0 | 31-August-2004 | GCC inline codes for functions tas(), trapa, dadd(), dsub(), write_mac() added.
All Intrinsic functions are modified to support various H8 targets. |
4.0 | 31-August-2004 | GCC inline functions dadd(), dsub(), mac(), rotlw() are modified. |
5.0 | 31-August-2004 | GCC inline functions set_imask_ccr(), set_imask_exr() are modified. |
6.0 | 26-September-2007 | Document name is changed to IAR - GNUH8 Migration Guide. |
7.0 | 01-October-2008 | Reference links povided in tables are removed. Reference link to gcc and as manuals are provided below the tables. |
8.0 | 29-January-2009 | Added 'extern' keyword for GNU intrinsic functions. Modified logic of 'set_imask_ccr' function. |
9.0 | 20-October-2016 | Added new responsive template |
Please note that this is an intermediate guide, which will be improved and enhanced periodically.
Please do not hesitate to send any of your suggestions or
ideas. You may log in your suggestions on our web site https://gcc-renesas.com/.
You will need to register first, after which you can either add a new support query at the following link: https://gcc-renesas.com/my-support-requests/tickettrackingsystem/addticket, or ask a question here: https://gcc-renesas.com/forum/ask/.
Please note that in order to be able to add a new support query or ask a question you must be logged in.
IAR Compiler Options |
Equivalent GCC compiler options |
-Aprefix |
-Wa, -al=file |
-a filename |
-S filename |
-c |
-fsigned-char |
-Dsymb[xx] |
-D<sym> |
-e |
Please invoke gcc with -–target-help for target specific help. |
-g |
Refer –W[options] |
-Iprefix |
-I<path> |
-K |
Supported by default |
-n filename |
-E -o filename |
-o filename |
-o filename |
-r[012][i][n] |
-g[level] |
-s[0–9] |
-O[1-3] |
-Usymb |
-U<sym> |
-vn |
-m |
-w |
-w |
-y |
-fwritable-strings |
-z[0-9] |
-Os |
-2 |
Only 32-bit floating point support for all H8 variants. |
Options only in GCC:
-fomit-frame-pointer |
In case of GCC, register r6 is used as the frame pointer. To avoid it from being
pushed and popped during a function call, |
For more information on the above compiler command line
options, please refer to the
gcc manual.
IAR Directives |
Equivalent GNU directive or method |
interrupt [0x8] void ext_0() { P0 = 6; } |
#define VECT_SECT __attribute__((section (".vects"))) typedef void (*fp) (void); extern void start (void); /*start function*/ void ext_0() __attribute__ ((interrupt_handler)); /* Interrupt handler function */ VECT_TYPE fp HardwareVectors[] VECT_SECT = { start,0,0,0,0,0,0,0,ext_0,0,0,0,0,0,0,0 } void ext_0() { P0 = 6; } |
#pragma function=monitor int mon_func() { .... .... .... } |
int mon_func(void) __attribute__((monitor)); int mon_func(void) { .... .... .... } |
#pragma memory=contseg/dataseg e.g. #pragma memory=constseg(_cseg) const int d1; const char[]=”Hello World”; |
const int d1 __attribute__ ((section(“_cseg”))); const char[] __attribute__((section(“_cseg”)))={"Hello World"}; Please note this requires an entry in the linker section for the memory location of “_cseg”. For ex. in the linker script _cseg <addr> :{ *(_cseg); } > memory region [ram/rom] |
sfr identifier = constant-expression sfr P0 = 0xFFFF80; /* Defines P0 */ P0.2 = 1; /* P0 = XXXXX1XX*/ |
#define identifier *(unsigned char *)(constant-expression) #define P0 *(unsigned char *)(0xFFFF80) |
sfrp identifier = constant-expression |
#define identifier *(unsigned short int*)(constant-expression)
|
#pragma memory=tiny |
variable declaration __attribute__ ((tiny_data)); |
#pragma codeseg |
Though Pragma is not available the functionality can be achieved using
|
For more information on the above compiler directives, please refer to the
gcc manual.
IAR Intrinsic functions |
Equivalent GCC inline code |
void and_ccr(unsigned char mask) |
Asm ("andc.b %0,ccr"::"g"(mask))
Please replace occurrence of and_ccr(mask) with above. |
void and_exr(unsigned char mask) |
Asm ("andc.b %0l,exr"::"r"(mask))
Please replace occurrence of and_exr(mask) with above. This is available only for H8S and H8SX. |
void dadd (unsigned char size, char *ptr1, char *ptr2, char *rst ) |
extern __inline__ void dadd(unsigned char size, char *ptr1, char *ptr2,char *rst) { asm ("mov.b %0l,r4l"::"r"(size):"r4"); #if defined __H8300__ || defined __NORMAL_MODE__ asm ("mov.w %0,r3"::"r"(ptr1):"r3"); asm ("mov.w %0,r5"::"r"(ptr2):"r5"); asm ("mov.w %0,r1"::"r"(rst):"r1"); asm ("andc #0xde:8, ccr\n" "0:\n\t" "mov.b @r3+, r0l\n\t " "mov.b @r5+, r2l\n\t " "addx.b r2l, r0l\n\t" "daa r0l\n\t" "mov.b r0l,@r1\n\t" "adds #1,r1\n\t" "dec.b r4l\n\t" "bne 0b\n\t" ); #else asm ("mov.l %0,er3"::"r"(ptr1):"er3"); asm ("mov.l %0,er5"::"r"(ptr2):"er5"); asm ("mov.l %0,er1"::"r"(rst):"er1"); asm ("andc #0xde:8, ccr\n" "0:\n\t" "mov.b @er3+, r0l\n\t " "mov.b @er5+, r2l\n\t " "addx.b r2l, r0l\n\t" "daa r0l\n\t" "mov.b r0l,@er1\n\t" "inc.l #1,er1\n\t" "dec.b r4l\n\t" "bne 0b\n\t" ); #endif } |
void do_byte_eepmov(char *source, char *dest, unsigned char count ) |
extern __inline__ void do_byte_eepmov(char *src, char *dest, unsigned char count) { asm("mov.b %0l,r4l"::"r"(count):"r4"); asm("extu.w r4"); #if defined __H8300__ || defined __NORMAL_MODE__ asm("mov.w %0,r5"::"r"(src):"r5"); asm("push r6"); asm("mov.w %0,r6"::"r"(dest):"r6"); asm("eepmov"); asm("pop r6"); #else asm("mov.l %0,er5"::"r"(src):"er5"); asm("push er6"); asm("mov.l %0,er6"::"r"(dest):"er6"); asm("eepmov"); asm("pop er6"); #endif } |
void do_word_eepmov(char *source, char *dest, unsigned char count ) |
extern __inline__ void do_word_eepmov(unsigned char *src, unsigned char *dest, unsigned short count) { asm("mov.w %0,r4"::"r"(count):"r4"); asm("mov.l %0,er5"::"r"(src):"er5"); asm("push er6"); asm("mov.l %0,er6"::"r"(dest):"er6"); asm("\n00:\n\t" "eepmov.w\n\t" "mov.w r4,r4\n\t" "bne 00" ); asm("pop er6"); }For H8S only. |
void dsub (unsigned char size, char *ptr1, char *ptr2, char *rst) |
extern __inline__ void dsub(unsigned char size, char *ptr1, char *ptr2,char *rst) { asm ("mov.b %0l,r4l"::"r"(size):"r4"); #if defined __H8300__ || defined __NORMAL_MODE__ asm ("mov.w %0,r3"::"r"(ptr1):"r3"); asm ("mov.w %0,r5"::"r"(ptr2):"r5"); asm ("mov.w %0,r1"::"r"(rst):"r1"); asm ("andc #0xde:8, ccr\n" "0: \n\t" "mov.b @r3+, r0l\n\t " "mov.b @r5+, r2l\n\t " "subx.b r2l, r0l\n\t" "das r0l\n\t" "mov.b r0l,@r1\n\t" "adds #1,r1\n\t" "dec.b r4l\n\t" "bne 0b \n\t" ); #else asm ("mov.l %0,er3"::"r"(ptr1):"er3"); asm ("mov.l %0,er5"::"r"(ptr2):"er5"); asm ("mov.l %0,er1"::"r"(rst):"er1"); asm ("andc #0de, ccr\n" "0: \n\t" "mov.b @er3+, r0l\n\t " "mov.b @er5+, r2l\n\t " "subx.b r2l, r0l\n\t" "das r0l\n\t" "mov.b r0l,@er1\n\t" "inc.l #1,er1\n\t" "dec.b r4l\n\t" "bne 0b\n\t" ); #endif } |
void *func_stack_base(void) |
extern __inline__ void *func_stack_base(void) { void *sp; #if defined __H8300__ || defined __NORMAL_MODE__ asm("mov.w r7,%0":"=g"(sp)); #else asm("mov.l er7,%0":"=g"(sp)); #endif return(sp); } |
unsigned char get_imask_ccr(void) |
extern __inline__ unsigned char get_imask_ccr(void) { unsigned char imask; asm("stc ccr,r0l":::"r0"); asm("and.b #0x80,r0l"); asm("rotl.b r0l"); asm("mov.b r0l, %0l":"=g"(imask)); return(imask); } |
unsigned char get_imask_exr(void) |
extern __inline__ unsigned char get_imask_exr(void) { unsigned char imask; asm("stc exr,r0l":::"r0"); asm("and.b #0x07,r0l"); asm("mov.b r0l, %0l":"=g"(imask)); return(imask); }This is available only for H8S and H8SX. |
void mac(long val, int *ptr1, int *ptr2, unsigned long count) |
extern __inline__ void mac(long val, int *ptr1, int *ptr2, unsigned long count) { asm ("mov.l %0,er2"::"g"(count):"er2"); asm ("mov.l %0,er3"::"g"(ptr1):"er3"); asm ("mov.l %0,er0"::"g"(ptr2):"er0"); asm ("mov.l %0,er1"::"g"(val):"er1"); asm ("clrmac"); asm ("ldmac er1,macl"); asm ("mov.l er2,er2\n\t" "beq 1f\n" "0:\n\t" "mac @er0+,@er3+\n\t" "dec.l #1,er2\n\t" "bne 0b\n" "1:\n\t" ); asm ("stmac macl,er2"); } This is available only for H8S and H8SX. |
void no_operation(void) |
extern __inline__ void no_operation(void) { asm ("nop"); } |
void or_ccr(unsigned char mask) |
asm ("orc.b %0,ccr"::"g"(mask))
|
void or_exr(unsigned char mask) |
asm ("orc.b %0,exr"::"r"(mask))
|
unsigned char read_ccr(void) |
extern __inline__ unsigned char read_ccr(void) { unsigned char ccr_val; asm("stc ccr,r0l":::"r0"); asm("mov.b r0l, %0l":"=g"(ccr_val)); return(ccr_val); } |
unsigned char read_exr(void) |
extern __inline__ unsigned char read_exr(void) { unsigned char exr_val; asm("stc exr,r0l":::"r0"); asm("mov.b r0l, %0l":"=g"(exr_val)); return(exr_val); }This is available only for H8S and H8SX. |
long read_hi_mac(void) |
extern __inline__ long read_hi_mac(void) { long lmach; asm("stmac mach,er0":::"er0"); asm("mov.l er0, %0"::"r"(lmach)); return(lmach); }For H8S only. |
long read_mac(void) |
extern __inline__ long read_mac(void) { long lmacl; asm("stmac macl,er0":::"er0"); asm("mov.l er0, %0"::"r"(lmacl)); return(lmacl); }This is available only for H8S and H8SX. |
void repeat_mac(int *ptr1, int *ptr2, unsigned long count) |
extern __inline__ void repeat_mac(int *ptr1, int *ptr2, unsigned long count) { asm ("mov.l %0,er6"::"g"(count)); asm ("mov.l %0,er5"::"g"(ptr1)); asm ("mov.l %0,er0"::"g"(ptr2)); asm ("mov.l er6,er6\n\t" "beq Rep_Mac_1\nRep_Mac_0:\n\t" "mac @er0+,@er5+\n\t" "dec.l #1,er6\n\t" "bne Rep_Mac_0\nRep_Mac_1:" ); }This is available only for H8S and H8SX. |
char rotlc(int count, char data) int rotlw(int count, int data) long rotll(int count, long data) char rotrc(int count, char data) int rotrw(int count, int data) long rotrl(int count, long data) |
extern __inline__ int rotlw(int count, int data) { int ires; asm("mov.w %0,r0"::"r"(count):"r0"); asm("mov.w %0,r1"::"r"(data):"r1"); asm("mov.w r0, r0"); asm("beq 1f\n" " 0:\n\t" "rotl.w r1\n\t" "dec.w #1, r0\n\t" "bne 0b\n" "1:" ); asm("mov.w r1, %0":"=g"(ires)); return(ires); } |
void set_imask_ccr(unsigned char mask) |
extern __inline__ void set_imask_ccr(unsigned char mask) { if(mask==1) asm("orc.b #0x80, ccr"); else asm("andc.b #0x7f,ccr"); } |
void set_imask_exr(unsigned char mask) |
extern __inline__ void set_imask_exr(unsigned char mask) { switch(mask) { case 0 : asm("andc.b #0xf8, exr"); break; case 7 : asm("orc.b #0x07, exr"); break; default: asm("stc exr,r0h"); asm("and.b #0xf8, r0h"); asm ("mov %0l, r0l"::"r"(mask)); asm("or.b r0l,r0h"); asm("ldc r0h,exr"); break; } }This is available only for H8S and H8SX. |
void set_interrupt_mask(char mask) |
extern __inline__ void set_interrupt_mask(char mask) { switch(mask) { case 0 : asm("andc #63,ccr"); break; case 1 : asm("andc #127,ccr"); asm("orc #64,ccr"); break; case 2 : asm("orc #128,ccr"); asm("andc #191,ccr"); break; case 3 : asm("orc #192,ccr"); break; } } |
void single_mac(int *ptr1, int *ptr2) |
extern __inline__ void single_mac(int *ptr1, int *ptr2) { asm("mov.l %0,er0"::"g"(ptr2):"er0"); asm("mov.l %0,er1"::"g"(ptr1):"er1"); asm("mac @er1+, @er0+"); }This is available only for H8S and H8SX. |
void sleep(void) |
extern __inline__ void sleep(void) { asm("sleep"); } |
void tas(char *addr) |
extern __inline__ void tas(char *addr) { asm("mov.l %0, er1"::"r"(addr):"er1"); asm("tas @er1"); }For H8S only. |
void trapa(unsigned int trap_no) |
asm ("trapa %0"::"g"(trap_no)) Please replace occurrences of trapa(trap_no) with above. |
void write_ccr(unsigned char value) |
extern __inline__ void write_ccr(unsigned char value) { asm("mov.b %0l,r0l"::"r"(value):"r0"); asm("ldc r0l, ccr"); } |
void write_exr(unsigned char value) |
extern __inline__ void write_exr(unsigned char value) { asm("mov.b %0l,r0l"::"r"(value):"r0"); asm("ldc r0l, exr"); }This is available only for H8S and H8SX. |
void write_ext_mac(long hi_val, long lo_val) |
extern __inline__ void write_ext_mac(long hi_val, long lo_val) { asm("mov.w %0,er0"::"r"(hi_val):"er0"); asm("mov.w %0,er1"::"r"(lo_val):"er1"); asm("ldmac er1, macl"); asm("ldmac er0, mach"); } This is available only for H8S and H8SX. |
void write_mac(long val) |
extern __inline__ void write_mac(long val) { asm("clrmac\n\t"); asm("mov.l %0,er0"::"r"(val):"er0"); asm("ldmac er0, macl"); } This is available only for H8S and H8SX. |
void xor_ccr(unsigned char mask) |
asm("xorc.b %0,ccr"::"g"(mask))
|
void xor_exr(unsigned char value) |
asm("xorc.b %0,exr"::"g"(value))
|
For more information on assembler constraints, please refer to the gcc manual.
For more information on assembler command line options, please refer to the as manual.
GNU C library namely Newlib is under free software license. The Newlib supports various processors and architectures.
1. Complete set of
Standard input/output functions.
2. Float parameters support
for Math library.
3. The library can be built with integer only
support. This in turn reduces the load.
4. Option is available
to build the libraries with floating point support.
5. A
customizable math error handler matherr() is available.
6. All
the functions are reentrant.
Drawbacks Involved:
1. malloc() is used in every stdio
routine.
2. There is no support for low-level routines to
connect to the target.
No. | Function |
Low-level routines (icclbutl.h) | |
1 | _formated_read |
2 | _formated_write |
3 | _medium_read |
4 | _medium_write |
5 | _small_write |
No. | Function | Equivalent GNU function |
Mathematics Functions (ctype.h) | ||
1 | Exp10 | pow(10.0,argument); |
No. | Function |
General Utilities (stdlib.h) | |
1 | Bsearch |
2 | Qsort |
C library Math Functions only in GNU:
No. | Function | Description |
Character type handling routines (ctype.h)
|
||
1 | Isascii | ASCII character predicate |
2 | Toascii | Control character predicate |
3 | Iswalnum | Alphanumeric wide character test |
4 | Iswalpha | Alphabetic wide character test |
5 | Iswcntrla | Wide character cntrl test |
6 | Iswdigit | Decimal digit wide character test |
7 | Iswgraph | Graphic wide character test |
8 | Iswlower | Lowercase wide character test |
9 | Iswprint | Printable wide character test |
10 | Iswpunct | Punctuation wide character test |
11 | Iswspace | Wide character space test |
12 | Iswupper | Uppercase wide character test |
13 | Iswxdigit | Hexadecimal digit wide character test |
14 | Iswctype | Extensible wide character test |
15 | Wctype | Get wide character classification type |
16 | Towlower | Translate wide characters to lower case |
17 | Towupper | Translate wide characters to upper case |
18 | Towctrans | Extensible wide character case mapping |
19 | Wctrans | Get wide character translation type |
No. | Function | Description |
Mathematics Functions (math.h)
|
||
1 | Acosf | Arc cosine |
2 | acosh, acoshf | Inverse hyperbolic cosine |
3 | Asinf | Arc sine |
4 | asinh, asinhf | Inverse hyperbolic sine |
5 | Atanf | Arc tangent |
6 | atan2f | Arc tangent of y/x |
7 | atanh, atanhf | Inverse hyperbolic tangent |
8 | jN,jNf,yN,yNf | Bessel functions |
9 | Coshf | Hyperbolic cosine |
10 | erf, erff, erfc, erfcf | Error function |
11 | Expf | Exponential |
12 | Fabsf | Absolute value (magnitude) |
13 | floorf, ceilf | Floor and ceiling |
14 | Fmodf | Floating point remainder (modulo) |
15 | Frexpf | Split floating point number |
16 | gamma, gammaf, lgamma, lgammaf, gamma_r, hypot, hypotf | Distance from origin |
17 | isnan, isnanf, isinf, isinff, finite, finitef | Test for exceptional numbers |
18 | Ldexpf | Load exponent |
19 | Logf | Natural logarithms |
20 | log10f | Base 10 logarithms |
21 | Powf | x to the power y |
22 | remainder, remainderf | Round and remainder |
23 | Sqrtf | Positive square root |
24 | sinf, cosf | Sine or cosine |
25 | Sinhf | Hyperbolic sine |
26 | Tanf | Tangent |
27 | Tanhf | Hyperbolic tangent |
28 | cbrt, cbrtf | Cube root |
29 | copysign, copysignf | Sign of y, magnitude of x |
30 | expm, expmf | Exponential minus 1 |
31 | ilogb, ilogbf | Get exponent of floating point number |
32 | infinity, infinityf | Representation of infinity |
33 | logp, logpf | Log of 1 + x |
34 | Matherr | Modifiable math error handler |
35 | modf, modff | Split fractional and integer parts |
36 | nan, nanf | Representation of infinity |
37 | nextafter, nextafterf | Get next number |
38 | scalbn, scalbnf | Scale by integer |
No. | Function | Description |
General Utilities (stdlib.h)
|
||
1 | Assert | Macro for Debugging Diagnostics |
2 | Atexit | Request execution of functions at program exit |
3 | Atoff | String to double or float |
4 | Ecvt, ecvtf, fcvt, fcvtf | Double or float to string |
5 | Gvcvt, gcvtf | Format double or float as string |
6 | Ecvtbuf, fcvtbuf | Double or float to string |
7 | __env_lock, __env_unlock | Lock environ variable |
8 | Getenv | Look up environment variable |
9 | Mallinfo, malloc_stats, mallopt | Malloc support |
10 | __malloc_lock, __malloc_unlock | Lock malloc pool |
11 | Mblen | Minimal multibyte length function |
12 | Mbstowcs | Minimal multibyte string to wide char converter |
13 | Mbtowc | Minimal multibyte to wide char converter |
14 | Rand48, drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48, lcong48 | Pseudo random number generators and initialization routines |
15 | Strtof | String to double or float |
16 | System | Execute command string |
17 | Wcstombs | Minimal wide char string to multibyte string converter |
18 | Wctomb | Minimal wide char to multibyte converter |
No. | Function | Description |
String and Memory routines (string.h)
|
||
1 | Bcmp | Compare two memory areas |
2 | Bcopy | Copy memory regions |
3 | Bzero | Initialize memory to zero |
4 | Index | Search for character in string |
5 | Memccpy | Copy memory regions with end token check |
6 | Mempcpy | Copy memory regions and return end pointer |
7 | Rindex | Reverse search for character in string |
8 | Strcasecmp | Case insensitive character string compare |
9 | Strlwr | Force string to lower case |
10 | Strncasecmp | Case insensitive character string compare |
11 | strtok_r, strsep | Get next token from a string |
12 | Strupr | Force string to uppercase |
13 | Swab | Swap adjacent bytes |
No. | Function | Description |
Input/output routines (stdio.h)
|
||
1 | Clearerr | Clear file or stream error indicator |
2 | Fclose | Close a file |
3 | Feof | Test for end of file |
4 | Ferror | Test whether read/write error has occurred |
5 | Fflush | Flush buffered file output |
6 | Fgetc | Get a character from a file or stream |
7 | Fgetpos | Record position in a stream or file |
8 | Fgets | Get character string from a file or stream |
9 | Fiprintf | Format output to file (integer only) |
10 | Fopen | Open a file |
11 | Fdopen | Turn open file into a stream |
12 | Fputc | Write a character on a stream or file |
13 | Fputs | Write a character string in a file or stream |
14 | Fread | Read array elements from a file |
15 | Freopen | Open a file using an existing file descriptor |
16 | fseek, fseeko | Set file position |
17 | Fsetpos | Restore position of a stream or file |
18 | ftell, ftello | Return position in a stream or file |
19 | Fwrite | Write array elements |
20 | Getc | Read a character (macro) |
21 | Getw | Read a word (int) |
22 | Iprintf | Write formatted output (integer only) |
23 | mktemp, mkstemp | Generate unused file name |
24 | Perror | Print an error message on standard error |
25 | Putc | Write a character (macro) |
26 | Putw | Write a word (int) |
27 | Remove | Delete a file's name |
28 | Rename | Rename a file |
29 | Rewind | Reinitialize a file or stream |
30 | Setbuf | Specify full buffering for a file or stream |
31 | Setvbuf | Specify file or stream buffering |
32 | Siprintf | Write formatted output (integer only) |
33 | fprintf, asprintf, snprintf | Format output |
34 | Fscanf | Scan and format input |
35 | Tmpfile | Create a temporary file |
36 | Tmpnam, | Name for a temporary file |
37 | Vprintf, vfprintf, vsprintf | Format argument list |
Large file input / output: | ||
38 | Fopen64 | Open a large file |
39 | Freopen64 | Open a large file using an existing file descriptor |
40 | Ftello64 | Return position in a stream or file |
41 | Fseeko64 | Set file position for large file |
42 | Fgetpos64 | Record position in a large stream or file |
43 | Fsetpos64 | Restore position of a large stream or file |
44 | Tmpfile64 | Create a large temporary file |
Along with all the above, following set of routines are provided in the newlib library:
1. Wide character strings (wchar.h):
Please refer http://sources.redhat.com/newlib/libc.html#SEC144
2. Signal handling (signal.h):
Please refer http://sources.redhat.com/newlib/libc.html#SEC169
3. Time functions (time.h):
Please refer http://sources.redhat.com/newlib/libc.html#SEC172
4. Locale specific routines (locale.h):
Please refer http://sources.redhat.com/newlib/libc.html#SEC183
Useful Links:
http://sources.redhat.com/newlib/libc.html
http://sources.redhat.com/newlib/libm.html