Hi all!
I am searching for a solution to modify the startup procedure, but to
keep the automatical genereted "preamble" (_reset_vector__).
I know the way to modify the function "_reset_vector__" to create my own
specific statup procedure (
http://mspgcc.sourceforge.net/manual/x1184.html ), but this is not what
I am searching for, because this way I would have to manually do the job
of the compiler.
The C-Compiler form IAR Embedded Workbench offers such a feature: It is
the function "__low_level_init". I am searching for the similar solution
on MSP430-GCC.
I will decribe the mechanism of "__low_level_init" in detail:
Every program written in C starts with the initialisation of the stack
pointer SP. Short after this the function "__low_level_init" is CALLed.
In default case this function just gives back a return value, but the
user can redefine this function for own purpose. After the RETurn, the
normal C-preamble is computed (initialisation of global variables, heap...).
Why it is nessecary? Let's think about a MSP430 in a real system with
some components connected to the ports. After reset all port pins are
switched to input direction, leaving an external component in an
undefined state. O.k., sometimes it is possible to take care of this
e.g. with a pulldown resistor, but it would be very useful to do some
initialisations before the (long) C-preamble is computed.
It is clear to achieve a "dirty" solution, though manually defining the
function "_reset_vector__", but this leaves all the work for me to do
what the C-compiler normally does automatically (initialisation of
global variables, heap...), as I said above.
Thank you in advance
Ralf Hildebrandt