Page 1 of 1

Process Stack Size

Posted: Wed Apr 18, 2012 10:05 pm
by pacoblackxx
Hi,

i saw the definitions below in the assembly file

main_stack_size EQU 0x00000400
00034
00035 ;// <h> Process Stack Configuration
00036 ;// <o> Process Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
00037 ;// </h>
00038 proc_stack_size EQU 0x00000400
00039
00040 ;// <h> C-runtime heap size
00041 ;// <o> C-runtime heap size (in Bytes) <0x0-0xFFFFFFFF:8>
00042 ;// </h>
00043 heap_size EQU 0x00000400

Is there any restriction for the process stack size?
I mean, < proc_stack_size EQU 0x00000400> means that the THD_WA_SIZE must be less than 1024bytes? (if the assembly file remain as-is)
can i use a bigger size?for example 4k.

main_stack_size EQU 0x00000400 : this is the stacksize of the main?
heap_size EQU 0x00000400 : and this the heap for the whole program?

thanx

Re: Process Stack Size

Posted: Thu Apr 19, 2012 7:48 am
by Giovanni
Hi,

The "process stack size" affects *only* the main() thread stack, other threads have their own stack and it is unrelated to that setting, you can increase it if your main() thread requires more stack.

The heap size is the C-runtime heap, the one used by the compiler for malloc() etc, it is unrelated to the OS heap.

Giovanni

Re: Process Stack Size

Posted: Thu Apr 19, 2012 6:47 pm
by pacoblackxx
If main() calls 4 threads, with 1kb stack each, should i set the main stack to 4kb? (99.9% no, but i am asking)

Also, FATfs has in the ff.h the code below:
#if _FS_REENTRANT
_SYNC_t sobj; /* Identifier of sync object */
#endif

what value should we define for the _SYNC_t?
the default is:
#define _SYNC_t HANDLE

Re: Process Stack Size

Posted: Thu Apr 19, 2012 6:50 pm
by Giovanni
No :-)

FatFS has already been ported, see the current implementation.

Giovanni

Re: Process Stack Size

Posted: Thu Apr 19, 2012 6:55 pm
by pacoblackxx
yes i know that it is ported, but when i set _FS_REENTRANT to 1 into ffconf.h, i get compilation errors( etc winsect in not a field of FATFS..)

or that chHeapFree() has too many arguments .

you have chHeapFree(NULL, mblock); instead of chHeapFree(mblock) in ff_memfree

you have to define _SYNC_ as Semaphore* i guess

Re: Process Stack Size

Posted: Thu Apr 19, 2012 7:40 pm
by Giovanni
I will look into that problem when merging the latest FatFS.

Giovanni