Hi Raj, Maybe the "nocommon" attribute might do something interesting towards your goal: http://www.ohse.de/uwe/articles/gcc-attributes.html
Alternatively it might be possible to declare your variables in in-line assembly (and then use them as externally declared variables). Or you could declare your variables inside a struct rather than directly. Or again, you could rearrange the variables in the generated binary by swapping symbols. I couldn't find any tools that would allow you to do this, you'd probably have to write your own tool :-) My guess is that the compiler arranges the variables according to the order in which they get used (how are the functions arranged in the binary?) or according to size/type. Most solutions above are compiler- and platform-dependent. To have a somewhat cross-platform solution I would use the struct approach, making sure that the variables are by design already aligned on 16-bit word boundaries. Why do you need a special arrangement of the variables? Cheers, Urs raj raj wrote: > Dear all, > > Is there a way to force some order in the way variables (global/static) are > placed in .data and .bss sections ? For example, let my program has 2 > initialized global variables g1 and g2 and 5 uninitialized global variables > u1,u2,u3,u4 and u5. g1 and g2 are first placed in program memory after .text > section and __do_copy_data copies them to the starting address in SRAM. u1 > through u5 are not explictitly stored in program memory but __do_copy_bss > places them just after g1 and g2 in SRAM and zeroes them out. I want to know > if I can somehow specify the order of these variables, say g1 followed by > g2; then u3,u4,u5,u1,u2. > > I noticed that the order in which the variables are declared/defined in C > file or assembly file does not correspond to the way they are placed in SRAM. > > Thanks in advance, > Raj _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
