D M wrote:
Hello everybody,

I would like to do some RAM testing before main() is called and before the variables are initialised (startup code). In some ports of the GNU compiler a __premain() is available. MSPGCC does not support it (is not mentioned in the documentation and does not work).
Another way is to place your startup code in .initX section. Take a look at avr-libc description as a reference: http://www.nongnu.org/avr-libc/user-manual/mem_sections.html

One disadvantage: current startup code in msp430 libgcc implementation (in gcc 3.2.3) does not support .initX sections execution (and C++ constructors as well). The workaround is to add to your project custom startup.s file with startup code from more recent gcc version (from gcc 4.0.1, for example). You can find example of such file here: http://scmrtos.svn.sourceforge.net/viewvc/scmrtos/trunk/Samples/MSP430/GCC_v3.2/1-EventFlag/src/crt0.S?view=markup

diwil said, that it is also possible to replace the whole gcc 3.2.3 libgcc.a with the one from gcc 3.3 or newer, but I think it's a little bit more complicated, than simple add one file to project.

Also take a look at this post: http://electronix.ru/forum/index.php?s=&showtopic=42970&view=findpost&p=361393 as a very convinient macro for placing such init functions in C & C++ code (forum in russian, put approved source code is clean enought even without comments).

Regards,
  Sergey

Reply via email to