Christopher E Piggott schrieb:
In mspgcc, where does the rest of the code that makes up the startup
function come from (where is the source)?  The mspgcc FAQ says:

        The standard library includes a start-up module that
        prepares the environment for applications written in C.

But the only source file I can find in the libc source is:

        /mspgcc/src/msp430-libc/src/gcrt0.S

th interrupt vectors are allocated there.

the startup code is in libgcc:

look at: /mspgcc/src/gcc/gcc-3.3/gcc/config/msp430/libgcc.s

and search for "L_reset_vector__"

This gets linked to the various processor-specific startup manuals.

I realize that the FAQ addresses how to replace the default startup with
your own, but it has a comment in it like:

        /* Your startup code goes here */

just before it calls main.  What I would like, though, is to borrow the
code that does the rest of the pre-main stuff (clear bss, initialize
statics, etc.)  I can't seem to locate the C file that is referenced by
the FAQ.

the startup code is in asm, you have to port it to C for yourself.

the variables like "_etext" are defined by the linker. you can access them from your code by defining them as external like

extern short _etext;

you have to cast it to a pointer when using tough:
((uint8_t *)_etext)

I was thinking, alternatively, that perhaps if I write a function and
force the linker to place it at .init1 that might give me a convenient
way to still use the default startup code, but link in my own hardware
initialization.  Is this possible?

you could write you own main, that calls your hardware init function and then an "application_main()". place you main in your own library and advice our user to link their projects with that library.

we have some example libraries in our cvs, see libraires/mspgcc for example.

chris


Reply via email to