Hi,

if you only use void functions, like ISRs, you can simly  call them by

(*(void (*)()) (ADDRESS)) ()

so you  only need to know the address.

Regards,

Rolf


[email protected] schrieb am 13.01.05 21:27:57:
> 
> Sometimes it's necessary to move code into RAM for execution, for instance 
> when reprogramming the main flash. It isn't too hard to do this in C, by 
> compiling all the code to be moved into a special section within .text, then 
> copying the whole section to RAM. Of course the code moved has to be 
> position-independent. 
> 
> The global compiler option -fpic simply accesses all constant addresses via a 
> table in RAM. This table can be quite large, and may be overwritten when the 
> code is moved. Using it is pretty clumsy.
> 
> If one avoids static variables, most of the code is position-independent 
> anyway. The difficulty lies in function calls. MSP430-gcc compiles these 
> with an absolute address, allowing calls to any place in memory. That's 
> normally exactly what one wants, but when the code is moved the calls still 
> address flash.
> 
> It would be good to write a macro to use the PC-relative 'symbolic" 
> addressing mode, something along the lines of:
> 
> #define PI_CALL(f) asm("call %0"::"?"(f))
> 
> but there seems to be no constraint which generates the right addressing 
> mode. Am I missing something really obvious here?
> -- 
> Rick Jenkins <[email protected]>
> Hartman Technica           http://www.hartmantech.com 
> Phone +1 (403) 230-1987 voice & fax
> 221 35 Avenue. N.E., Calgary, Alberta, Canada T2E 2K5
> 
> 
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users




Reply via email to