Hi Cory, Your -Os flag definitely worked to significantly decrease ROM size. I haven't tried it on the mote, but this is looking much better.
My code was passing around the StdControl interface only through the configurations, without going through any modules to reach their destinations as was shown in your first example. In particular, this applied to the Blackbook FS, where I had one main configuration file (BlackbookC.nc) pass StdControl to all its sub-components - for example, BFileWrite was accessed through the main BlackbookC configuration. Then BFileWriteC configuration, in turn, passed StdControl to the components it needed to access - NodeMapC, WriteAllocC, FileioC, etc. Then those components, like FileioC for example, would pass StdControl down to the FlashBridgeC. With each component wiring up StdControl to the sub-components they access, this architecture, for me, ensured every component that was used was initialized. When I aggregated all the StdControl wirings for the whole system into the main BlackbookC configuration file, the full blown Blackbook application compiled down to 16.1 kB. By adding in the -Os flag, the size went down to 15.7 kB ROM... a significant improvement over the 18 - 24 kB Blackbook size I was seeing before. And finally, a Dictionary-only Blackbook file system went down to 11.3 kB ROM. Thanks again for your help Cory, when I finish re-debugging this new FS version, I'll put it up on CVS. -David -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cory Sharp Sent: Monday, May 08, 2006 1:55 PM To: David Moss Cc: [email protected] Subject: Re: [Tinyos-help] Increase in ROM Size by wiring to existing components David, What is the structure/implementation of Y such that not wiring A.StdControl is not an error? I figure you have some code in module Y like command result_t StdControl.start() { call LowerControl.start(); } and some code in configuration Y like // Y.LowerControl -> A.StdControl; Y.LowerControl -> B.StdControl; where you are testing uncommenting the commented line. (As an alternative, you may just have default implementations of LowerControl in Y module.) If it's something like that, then wiring in A.StdControl to Y actually *does* add functionality -- invoking Y.StdControl now also invoked A.StdControl. Without that, and leaving component X out of your application, A.StdControl may never be called -- a bug. This is exactly the "system library initialization problem" we occasionally try to sort through in TinyOS. The bloat probably comes in from the aggressive inlining, that the body of A.StdControl probably appears twice instead of encapsulated as a function. That's most likely "misconfiguration" of command line parameters in gcc (or outright bug). Try compiling with CFLAGS=-Os, though I seem to recall mspgcc creating questionable code for certain optimization flags, and I don't recall if -Os is such a culprit. Cory On 5/8/06, David Moss <[EMAIL PROTECTED]> wrote: > > I have an app that has three components. Component A provides a set of > commands and no events, and is used by the other two. The second component, > X, connects to A and wires up StdControl to it, etc. A third component, > component Y does not wire up to A. Compiling these three components > together into an app, the ROM size is 10598 bytes. > > Then I do the same as before, but also wire up Y to A in Y's configuration, > so Y also connects StdControl to A. No extra code is written, no > functionality was added. Just the wiring. Keep in mind that StdControl was > already wired up to A from X, and the only change now is StdControl is also > be wired up to A from Y. Compiling these three components again, the ROM > size becomes 11022 bytes. A 424 byte ROM difference, which is significant > because no functionality was changed or added. > > Is it possible to make the compiler recognize that A is the same component > referred to by X and Y, and StdControl is the same interface? > > Say I had 10 components like this that could all be compiled separately or > together to form a system or application - then the ROM size would increase > by a minimum of 4kB just from repetitive wiring, which I believe should have > been optimized out. > > > -David > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
