[ECOS] POSIX main thread

Szentirmai Gergely reg@t-online.hu
Sun Apr 12 15:29:00 GMT 2009


POSIX compatibility, not Linux compat. I'm not using the command line 
ecos config, rather than the configtool GUI. In the ISO C startup 
section, I have found abelity to define the calling mode of main(), and 
the default stacksize. My coniguration is to call main() from 
cyg_user_start context. This way ecos does not allocate stack for 
starting main. This way, the

CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE   option is disabled. So, I can't set the value (in the GUI of course). 

When I use POSIX layer, pthread.cxx allocates a stack whether there is a 
main() function, or not. The size of this stack is depending on 

PTHREAD_STACK_MINIMUM is given, but I think 
CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE  should be active even if there is a 
POSIX compatibility layer added.

Thank you!
Gergely Szentirmai

Sergei Gavrikov írta:
> 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
> Sergei

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