Workspace usage trouble
Joel Sherrill
joel at OARcorp.com
Fri Jan 16 16:12:03 UTC 2004
Cedric Aubert wrote:
> Thanks a lot, I will try this but
> I take a look in the libc_start_hook() function and
> I have the reent structure allocated with calloc, so
> it should be in heap, no ?
>
> In fact, I have just look at the CVS, this feature is
> true since rtems-4.6.0-pre5 and rtems-4.6.0-branch but
> I use the rtems-4.6.0-pre4 so, reent struct still
> allocate
> in my heap.
>
> Any idea ?
Not off the cuff. If you have printk, you could
augment workspace_allocate to print out what size
blocks it is allocating.
Or .. even better.. define workspace_allocate as
a macro that calls the real workspace_allocate
(slightly renamed). Then the macro could print
the file, line number and arguments as strings.
Do you have a working printk?
> Cedric
>
>
>>-----Original Message-----
>>From: Joel Sherrill
>
> [mailto:joel.sherrill at oarcorp.com]
>
>>Sent: Friday, January 16, 2004 1:08 PM
>>To: cedric_aubert at yahoo.fr
>>Cc: RTEMS-USERS
>>Subject: Re: Workspace usage trouble
>>
>>
>>Cedric Aubert wrote:
>>
>>
>>>Hi all,
>>>
>>>I have some trouble with my workspace size. All
>
> work
>
>>>fine when I put some
>>>wrong number of task or semaphore or file
>
> dexcriptors
>
>>>but when I put the
>>>real number (with some upper number for task
>
> semaphore
>
>>>and file descriptor)
>>>that's don't work, it can't open allocate some task
>
> or
>
>>>other object in the
>>>workspace.
>>>
>>>So how can I see the available memory left in
>>>workspace ?
>>>
>>>
>>
>>I have worked up a routine to get information and
>
> free space left in the
>
>>heap but it has not been tested.
>>
>>
>>>How can I known witch object use the workspace ?
>>>
>>>What I missed to specifie ?
>>>
>>>I take a look in the condefs but it seem to have
>>>nothing forgotten.
>>>
>>>
>>>
>>
>>Given the inquiry yesterday on the list and a
>
> night's, I think I
>
>>remembered it:
>>
>>
>>/*
>> * reent struct allocation moved here from
>
> libc_start_hook() to avoid
>
>> * mutual exclusion problems when memory is
>
> allocated from the start hook.
>
>> *
>> * Memory is also now allocated from the workspace
>
> rather than the heap.
>
>> * -- ptorre 9/30/03
>> */
>>
>>The newlib C library reent extension was in the heap
>
> and is now in the
>
>>workspace.
>>That needs to be accounted for in confdefs.h on a
>
> per task basis.
>
>> Try this
>>hack/patch and see if it helps:
>>
>>$ cvs diff -u confdefs.h
>>Index: confdefs.h
>>
>
> ===================================================================
>
>>RCS file:
>
> /usr1/CVS/rtems/cpukit/sapi/include/confdefs.h,v
>
>>retrieving revision 1.55.2.1
>>diff -u -r1.55.2.1 confdefs.h
>>--- confdefs.h 4 Sep 2003 18:47:20 -0000
>
> 1.55.2.1
>
>>+++ confdefs.h 16 Jan 2004 12:05:46 -0000
>>@@ -805,12 +805,15 @@
>> #define CONFIGURE_OBJECT_TABLE_STUFF \
>> ( sizeof(Objects_Control *) + sizeof(rtems_name
>
> *) +
>
>>sizeof(rtems_name) )
>>
>>+#include <reent.h>
>>+
>> #define CONFIGURE_MEMORY_FOR_TASKS(_tasks) \
>> (((_tasks) + 1 ) * \
>> ((sizeof(Thread_Control) + CONTEXT_FP_SIZE + \
>> STACK_MINIMUM_SIZE + sizeof(
>
> RTEMS_API_Control ) + \
>
>> CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API + \
>> CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API + \
>>+ sizeof(struct reent) + \
>> CONFIGURE_OBJECT_TABLE_STUFF)) \
>> )
>>
>>
>>
>>
>>
>>>Thanks a lot
>>>
>>>Cedric
>>>
>>>
>>>/* configuration information */
>>>
>>>#include <bsp.h>
>>>#include <rtems.h>
>>>#include <stdlib.h>
>>>#include <stdio.h>
>>>#include <string.h>
>>>#include <Task.h>
>>>
>>>#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER //
>
> Use
>
>>>console
>>>
>>>#define CONFIGURE_RTEMS_INIT_TASKS_TABLE //
>
> Utiliser
>
>>>la table Init Task
>>>plus bas
>>>
>>>#define CONFIGURE_MAXIMUM_TASKS
>>
>>53 // 32 SDEL
>>
>>>Task and 1 RTEMS Init
>>>Task
>>>#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 10
>>>// Nombre de MailBox
>>>#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 3
>>>// Signal
>>>#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
>
> 300
>
>>> // Nombre Max de
>>>File Descriptor
>>>#define CONFIGURE_MAXIMUM_SEMAPHORES
>>
>>500 //
>>
>>>Nombre Max de Semaphore
>>>#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 12
>>
>> //
>>
>>>Nombre Max de Port
>>>Serie
>>>
>>>#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM // A
>
> la
>
>>>place de MiniIMFS pour
>>>avoir le support des link
>>>
>>>// #define CONFIGURE_MEMORY_OVERHEAD
>
> 500
>
>>>// Ko suplementaire
>>>
>>>#define STACK_CHECKER_ON
>>
>> 1 // Activation du
>>
>>>Stach Check
>>>
>>>#define CONFIGURE_INIT
>>>
>>>
>>>rtems_task Init(rtems_task_argument)
>>>{
>>> /* Starting Application */
>>>}
>>>
>>>/*
>>>* The user is defining their own table
>
> information
>
>>>and setting the
>>>* appropriate variables.
>>>*/
>>>
>>
>>/****************************************************************
>>***********
>>
>>>******************/
>>>
>>>#define CONFIGURE_HAS_OWN_INIT_TASK_TABLE
>>>
>>>#ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
>>>
>>>#undef CONFIGURE_INIT_TASK_NAME
>>>#define CONFIGURE_INIT_TASK_NAME
>>>rtems_build_name( 'm', 'a', 'i',
>>>'n' )
>>>
>>>#undef CONFIGURE_INIT_TASK_STACK_SIZE
>>>#define CONFIGURE_INIT_TASK_STACK_SIZE
>>>RTEMS_MINIMUM_STACK_SIZE // 0x6000
>>>de place laissé par FBUG
>>>
>>>#undef CONFIGURE_INIT_TASK_PRIORITY
>>>#define CONFIGURE_INIT_TASK_PRIORITY 1
>>>
>>>#undef CONFIGURE_INIT_TASK_ATTRIBUTES
>>>#define CONFIGURE_INIT_TASK_ATTRIBUTES
>>>RTEMS_DEFAULT_ATTRIBUTES
>>>
>>>#undef CONFIGURE_INIT_TASK_ENTRY_POINT
>>>#define CONFIGURE_INIT_TASK_ENTRY_POINT Init
>>>
>>>#undef CONFIGURE_INIT_TASK_INITIAL_MODES
>>>#define CONFIGURE_INIT_TASK_INITIAL_MODES
>>>RTEMS_PREEMPT
>>>
>>>#undef CONFIGURE_INIT_TASK_ARGUMENTS
>>>#define CONFIGURE_INIT_TASK_ARGUMENTS 0
>>>
>>>#ifdef CONFIGURE_INIT
>>>
>>>rtems_initialization_tasks_table
>>>Initialization_tasks[] = {
>>> { CONFIGURE_INIT_TASK_NAME,
>>> CONFIGURE_INIT_TASK_STACK_SIZE,
>>> CONFIGURE_INIT_TASK_PRIORITY,
>>> CONFIGURE_INIT_TASK_ATTRIBUTES,
>>> CONFIGURE_INIT_TASK_ENTRY_POINT,
>>> CONFIGURE_INIT_TASK_INITIAL_MODES,
>>> CONFIGURE_INIT_TASK_ARGUMENTS
>>> }
>>>};
>>>
>>>#endif
>>>
>>>#define CONFIGURE_INIT_TASK_TABLE
>
> Initialization_tasks
>
>>>#define CONFIGURE_INIT_TASK_TABLE_SIZE \
>>> sizeof(CONFIGURE_INIT_TASK_TABLE) /
>>>sizeof(rtems_initialization_tasks_table)
>>>
>>>#endif /* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */
>>>
>>
>>/****************************************************************
>>***********
>>
>>>******************/
>>>
>>>#include <confdefs.h>
>>>
>>>--
>>>Cedric AUBERT
>>>Ingenieur Recherche et Developpement
>>>SDEL Controle Commande
>>>D2A - Rue Nungesser et Coli
>>>44860 Saint Aignan de Grand Lieu
>>>FRANCE
>>>
>>>Tel : +33 (0)2 40 84 50 00
>>>Poste : 5109
>>>Fax : +33 (0)2 40 84 51 10
>>>
>>>E-mail : cedric_aubert at yahoo.fr
>>>Web : http://www.sdelcc.com
>>>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list