N. Coesel wrote:
At 14:34 14-11-2009 -0700, you wrote:
Does msp430-gcc provide any systematic way, such as a generated symbol, from
which a C source file can determine the size of a function? I have a
function
for field reprogramming, which is moved to RAM before use, and need to know
how many words to move.
You could have the linker deal with that by forcing the function to exist
in RAM like an initialized global variable:
void flash_startup() __attribute__((section(".data"), weak()));
void flash_startup()
{
//do something
}
Altough must admit this trick only seems to work when both the caller and
callee are in the same C (object) file.
Nico Coesel
Although it is somewhat "cheating" to put a function into the data
section, this is (IMHO) the best way to get functions into ram. The
compiler and linker handle the placing, the C startup code copies it
into ram at boot, and you can call the function directly from your main
code without any special consideration.
Just make sure that you are very clear over which other functions your
ram function calls - these must also be in ram!
Incidentally, why do you have the "weak" attribute?
mvh.,
David