Hi Tamas, Good suggestion - I need to learn how to do this sort of thing (and = anything for that matter) with scripts - another on my long list of todo = projects. Thanks, Tony Tamas Rudnai wrote: >> You could put a 'jump table' at a fixed location in your bootstrap's >> program space, with each entry jumping to one routine that you may call >> from your application. >> = > > Or you can use the MAP file to figure out the function entries and some > Perl/Python scripts to generate a similar function declaration as mention= ed > by Isaac. You could then put that script into the tool path so that it wi= ll > run automatically every time you compile your application, so it will nev= er > out of sync. > > Tamas > > > On Mon, Jan 19, 2009 at 10:57 AM, Isaac Marino Bavaresco < > isaacbavaresco@yahoo.com.br> wrote: > > = >> Tony Vandiver escreveu: >> = >>> I'm trying to write a custom bootstrap to load in my application code >>> from an SD card. I want to call file I/O routines located in my >>> bootstrap from my application rather than duplicating the file I/O >>> library functions in the application because it represents about 10% of >>> my code space. Typically when I compile, I compile and link everything >>> that pertains to a project at the same time, but in this instance, do I >>> need to reference an object file from the bootstrap compilation without >>> compiling it into the application project, and if so, how do I keep it >>> from being relocated by the linker without expressly setting the address >>> of each function? I'll start reading the compiler reference material >>> now and see how long it will take me to start drooling. >>> >>> Thanks for the help, >>> >>> Tony >>> >>> = >> You could put a 'jump table' at a fixed location in your bootstrap's >> program space, with each entry jumping to one routine that you may call >> from your application. >> >> The reason for the 'jump table' is to make the entry points fixed, even >> if you change your bootstrap code. >> >> Assuming you are using MPLAB C18 (other Cs may have a slightly different >> syntax, but not much even for other MCUs). >> >> In the bootstrap: >> >> #pragma code JUMPTABLE =3D 0x1f000 >> >> void JumpTable( void ) >> { >> _asm >> goto mount; >> goto remove; >> goto ... >> _endasm; >> } >> >> #pragma code >> >> In your application you call the functions this way: >> >> typedef void (*func_type1)( void ); // Pointer to a function that take >> void and return void; >> typedef int (*func_type2)( const char rom * ); // Pointer to a >> function that take a string and return int; >> .... >> >> #define mount() ((func_type1)0x1f000)() /* mount entry point is at >> 0x1f000 */ >> #define remove(name) ((func_type2)0x1f004)(name) /* remove entry point >> is at 0x1f004 */ >> .... >> >> void main( void ) >> { >> mount(); >> remove( "backup.bin" ); >> } >> >> Best regards, >> >> Isaac >> __________________________________________________ >> Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger >> http://br.beta.messenger.yahoo.com/ >> >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> >> = > > > > = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist