One method you can use, which is done in one form or another in most major 
operating systems is a vector table anchored at a known location.  You would 
have a known location that would point to this vector of pointers to functions. 
 The first element would probably be the size of the vector table so you would 
not go stepping past the end.  Then to call a "system service" you would simply:

   ReturnCode = *( VectorBase + ApiIndex )( args..... )

You could easily create macros to perform this indirection for you:

#define SS_DoSomething      ( *( VectorBase + KSsIndexDoSomething ) )

and your code would become:

SS_DoSomething( args... )

It adds an extra level of indirection to each OS service call, but that should 
be insignificant compared to what the service is doing.

Hope that helps

Greg

--- [email protected] wrote:

From: Theblond <[email protected]>
To: [email protected]
Subject: Re: [Sdcc-user] Modular program for pic16
Date: Thu, 15 Apr 2010 11:50:48 +0200

Hi!

I understand this. But, how can I inform my expansion module what
"kernel" functions are available to the module. I mean the addresses of
the functions to calling them. It would be nice, if the function and its
address linkage is not hardwired.

Also, can I tell sdcc where to place the code? In what segment of the
memory? (What will be exactly defined in the linker script, e.g. block0
or block1)

I am sure, that I have to compile the module and the expansion module
separetly, since the main module wont be upgraded, but the expansion
module will get updated time-to-time.

Theblond


Vaclav Peroutka írta:
> Hi, you need to have special linker scripts for bootloader, main module, 
> expansion module etc. There are some examples for bootloader and 
> bootloaderless apps in gputils distribution.
> 
> Vaclav
> 
>> ----------------------------------------
>> Hi!
>>
>> I have to write a program, what consists of a bootloader, a main module,
>> and an expansion module. Modules can be upgraded via UART. Preferably,
>> the expansion module should be upgraded only, but the other would be
>> reasonable as well.
>>
>> I don't know how to handle this situation, since the code is
>> placed/arranged by the linker, not the compiler.
>>
>> How can I force what to goes where?
>>
>> The expansion module would consists several functions and more
>> variables, that tha main uses. There would be a some callback functions
>> to process the additional parameters (these are defined at the start of
>> the expansion module).
>>
>> Can somebody offer me a solution of handling the expansion capability?
>>
>>
>> Theblond


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to