Reducing the size of an RTEMS application

Joel Sherrill joel at rtems.org
Tue Nov 1 17:55:47 UTC 2016


On Tue, Nov 1, 2016 at 11:32 AM, Gedare Bloom <gedare at rtems.org> wrote:

> There is now an aggressive optimization that I believe is enabled in
> leon3 on master, I don't recall if it is in 4.11, but you can check
> your leon3.cfg file. The optimization uses the two flags to gcc,
> -ffunction-sections and -fdata-sections, to group functions and data
> in separate sections of the object file, and then used along with
> link-time -gc-sections to garbage-collect unused sections. This
> appears to provide a quite nice reduction in size for unused
> code/data. In order to go smaller, you are best recommended to shrink
> the CONFIGURE_* options to the minimum your application needs in order
> to reduce the size of the pre-allocated workspace.
>
>
I just checked. It was enabled on 4.11. I thought so since the SPARC BSPs
were where I tested this initially.

You can change -O2 to -Os which can drop 10-15 percent if you are lucky.

The master has a different initialization scheme and you might want to
see how much you can gain by switching to the master. This change improved
size considerably in some cases.

Gedare is right. If you are really low on memory, then you need to decide
whether you are focusing on Flash or RAM. If code is in RAM, then you
get to look at options impacting code size and data usage.  The examples-v2
ticker series uses a series of changes to drop the size. But the change
against master isn't nearly as dramatic in code size as it used to be. But
the RAM usage can drop.

Ultimately, this is tuning RTEMS for a specific application and we need to
know what you don't need that is in this executable. For example, you can
decrease minimum task  stack size and lower the number of priorities in
the default uniprocessor scheduler but you HAVE to know the application
in order to get those settings right.

--joel


> On Tue, Nov 1, 2016 at 1:36 AM, Oyake, Amalaye (398F)
> <amalaye.oyake at jpl.nasa.gov> wrote:
> > Hello all,
> >
> >
> >
> > I am building a Leon-3 application for a resource constrained platform
> (very
> > little RAM). How can I reduce the size of the RTEMS application? Beyond
> > normal RTEMS kernel configuration, turning off debugging and optimizing
> with
> > –O, are there ways to strip out any unnecessary symbols after
> compilation.
> >
> >
> >
> > Regards,
> >
> > -----------
> >
> > * Amalaye Oyake                                       *
> >
> > * Instrument Product Software Development Group  */\  *
> >
> > * Jet Propulsion Laboratory, Pasadena            *||  *
> >
> > * CA 91109                                       /||\ *
> >
> > **************************************************^^***
> >
> >
> >
> >
> > _______________________________________________
> > users mailing list
> > users at rtems.org
> > http://lists.rtems.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20161101/2ec696c9/attachment-0002.html>


More information about the users mailing list