Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12746 Discussions

How to enable reduced-footprint C library?

Altera_Forum
Honored Contributor II
1,220 Views

_Reen struct thread-local data is allocated at the top of the task’s stack. Therefore, 

you need to make allowance when allocating memory for stacks. In 

general, the _reent structure consumes approximately 900 bytes of data 

for the normal C library, or 90 bytes for the reduced-footprint C library. 

 

How can I enable reduced-footprint C library?? 

 

I have try to check 'Small C Library' in system property setting, but after compiling project, the  

sizeof(struct _reent) still equals to 892 bytes. 

 

Anyone help? 

 

Because I'm not familiar with struct _reent. 

Another question is on which condition shall I base to decide whether enable 'Thread Safe C Library' or not? 

Thanks in advance, 

David
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
530 Views

Hi David, 

 

in your IDE click right mouse button and properties --> c/c++ build, tool settings --> general --> optimise size 

 

good luck 

 

Cheers and merry x-mass http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif  

 

Danny
0 Kudos
Altera_Forum
Honored Contributor II
530 Views

Hi, danny 

 

I have tried, but  

sizeof(struct _reent) still equals to 892 bytes. 

 

Anyone help? 

 

 

Thanks in advance 

David
0 Kudos
Altera_Forum
Honored Contributor II
530 Views

I cann&#39;t recall if there is a "no reentrance" flag for it. 

I am not sure if the default newlib is configured to configure.host.smallc. 

Maybe you should try another lib set, than the default newlib. 

Rebuild newlib with smallc or use uClibc. 

 

If you are using uC/OSII, you should not use default libs. You should use most of them of of 

the uC/OSII&#39;s lib. 

 

You can use -nostdinc and -nostdlib flags to select the includes and libs on gcc.
0 Kudos
Reply