RTEMS image size question
Joel Sherrill
joel.sherrill at OARcorp.com
Wed Jul 13 15:45:44 UTC 2011
On 07/13/2011 10:28 AM, Matthews, Lee wrote:
>
> Hi,
>
> I’m developing some software that uses RTEMS on an Aeroflex Gaisler
> LEON3 processor that is running on a Pender GR-CPCI-AX2000 development
> board.
>
> I use the following statement to compile my source code :
> sparc-rtems-gcc -O2 -g sourcecode.c -o outputexecutable.exe
>
> My image files always seem to be rather large (about 150Kbytes), even
> for rather simple code – is this normal ?
>
> So for example, I modified the provided sample source file
> rtems-hello.c to look like the following :
>
> #include <rtems.h>
>
> /* configuration information */
>
> #define CONFIGURE_INIT
>
> #include <bsp.h> /* for device driver prototypes */
>
> rtems_task Init( rtems_task_argument argument); /* forward declaration
> needed */
>
> /* configuration information */
>
> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
>
> #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
>
> #define CONFIGURE_MAXIMUM_TASKS 4
>
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
>
> #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
>
> #include <rtems/confdefs.h>
>
> #include <stdlib.h>
>
> rtems_task Init(rtems_task_argument ignored)
>
> {
>
> exit( 0 );
>
> }
>
> Yet, when I compile the code and look at its size using
> sparc-rtems-size it comes out as :
>
> sparc-rtems-size rtems-hello.exe
>
> text data bss dec hex filename
>
> 136736 4068 4736 145540 23884 rtems-hello.exe
>
> I do not understand why the image size is so big, given the lack of
> the visible code’s complexity. Is everything compiled in by default?
> Do I need to explicitly remove the bits from RTEMs that I don’t need?
> How can I reduce the image size?
>
That's about the same size as the standard ticker.
$ sparc-rtems4.11-size ticker-executables/sparc-leon3-ticker.ralf
text data bss dec hex filename
131984 1860 4224 138068 21b54
ticker-executables/sparc-leon3-ticker.ralf
RTEMS minimum executable size varies a lot based upon the BSP
and architecture. If the BSP is complicated (e.g. multiple buses),
lots of options, supports hardware variants, etc) or references code
that is technically not needed in a minimum configuration, then
it can be larger.
In this case, I don't know the precise answer but this test case
does include a LOT of RTEMS functionality:
+ clock tick
+ console device driver with termios
+ reentrant malloc
+ reentrant C library support
+ at least POSIX open, close, and exit calls
+ some file system support (amount depends on RTEMS version)
+ Do you have POSIX enabled? That adds some.
+ plus this BSP has device probes on AMBA bus.
You can do a map from the loader and see why particular .o's
are in the .exe. As a general rule, if you don't really need it,
you can either disable that functionality. If it is a case of
two methods in a file and only using one but the other pulls
in stuff, break apart source files will break the dependency.
the dependency graph.
> Any help or guidance would be much appreciated.
>
> Thanks in advance,
>
> Lee
>
--
Joel Sherrill, Ph.D. Director of Research& Development
joel.sherrill 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