[ECOS] POSIX main thread

Sergei Gavrikov sergei.gavrikov@gmail.com
Fri Apr 10 21:03:00 GMT 2009

On Fri, Apr 10, 2009 at 08:03:29PM +0200, Szentirmai Gergely wrote:
> Hello
> I had to add POSIX compatibility to my project, because FAT support is  
> depending on it. It's ok, but I don't need POSIX compat to create a  
> thread, and call main(). It eats 8k from my SRAM, and that hurts much!

Hm. POSIX compat or LINUX compat? It's possible do not include posix
package to buid eCos `fatfs1' test

ecosconfig new <target>
ecosconfig add CYGPKG_LINUX_COMPAT
ecosconfig add CYGPKG_BLOCK_LIB
ecosconfig add fileio fatfs
ecosconfig tree
make -s
make -s -C fs/fat/current/ tests

The fatfs1's size is

arm-eabi-size install/tests/fs/fat/current/tests/fatfs1 
   text	   data	    bss	    dec	    hex	filename
  48088	    956	  15148	  64192	   fac0	install/tests/fs/fat/current/tests/fatfs1

> As I see from the source pthread.cxx there is no upportunitiy to disable  
> this feature.
> Would not be it usefull? Or there is a reason, why it is not available.  
> As a secound option, I would make a main_thread_stack_size option in  
> posix thread configuration in the cdl.

If your main() will be just a paleholder, decrease it's stack. If you
import the below, for example, before to type 'ecosconfig tree'

    user_value 128;

you will decrease .bss. It's just an example! Unfortunately, AFAIK,
FATFS will suck in any case, you can think, I will decrease .bss, and
all will be okay, but FATFS sucks a heap too

arm-eabi-nm install/tests/fs/fat/current/tests/fatfs1 | grep alloc
68010aa4 T cyg_fd_alloc
68010b1c T cyg_file_alloc
68013dd0 D cygmem_memalloc_heaps
6800cc94 T fatfs_node_alloc
6800f9d0 T malloc

Yet another "reserve" to decrease amount of used RAM is to decrease


Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list