Is there a more elegant solution than adding a dummy function?
Can I search the next RET instruction or something like this?
----------------------------
I think something like (be sure to check the syntax, I'm typing this
from
memory!):
unsigned char *rampointer;
void prog_function()
{
...function...
}
void next_to_prog_function()
{
//dummy function
}
memcpy(rampointer, progfunction, next_to_prog_function-prog_function);
(void*())(rampointer)(); //execute function from ram
Rampointer is the pointer to the memory area (make sure you initialize
this). prog_function is the function you want to copy to ram.
next_to_prog_function is a dummy function which identifies the end of
prog_function. Don't forget function names are pointers to their
function
in C.
You should also consider what to do when programming is finished.
Probably
a call to the reset vector. It is a good idea to make a function which
blinks an LED and runs this from RAM first.
Nico Coesel
-------------------------------------------------------
This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon
2005
Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows
Embedded(r) & Windows Mobile(tm) platforms, applications & content.
Register
by 3/29 & save $300 http://ads.osdn.com/?ad_idh83&alloc_id149&op=ick
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005