On Fri, Mar 3, 2017 at 12:30 PM, DJ Delorie <d...@redhat.com> wrote:

> Also, if you're REALLY constrained to size, you might consider getting
> the crt0.S source file from newlib and modifying it yourself to really
> strip out the parts you don't need.  Most embedded code really only
> needs to set up the stack and watchdog, then jump to main().
>

Be careful with this.  TI's Code Composer compiler originally had a
stripped down crt0 that didn't bother clearing the bss section.  This meant
any static variable definition (including globals) would not necessarily be
cleared on power up.  So if you rely on a variable being null to indicate
that some initialization is necessary your program may or may not work.

The advice is also dubious if you're using C++ as there may be static
constructors that need to be invoked (and yes, modern C++ if used carefully
is appropriate for embedded programming even on constrained chips like
MSP430).

In short, if you muck with the crt0 code be very sure you know the effect
of stripping things out.

Peter
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to