[Icc-avr] Bootloader
Johan Wallström
johan at edab.nu
Fri Sep 14 00:00:00 PDT 2007
Hi
I can think of two solutions:
1. Define addresses where the functions are located. Call these functions using pointers to functions.
2. To allow the functions to be at any address, have a table located at a specified address (in the bootloader area) containg the addresses of the functions you want to call.
Here's an example of a function pointer (from a project in another compiler though):
int (*ReadIgnition)(ubyte &ignitionStatus);
So it's just called something like this:
ubyte resultStatus;
int resultRead = ReadIgnition(resultStatus);
I guess if you would pick the value from a predefined table it would look something like this:
typedef struct
{
int (*ReadIgnition)(ubyte &ignitionStatus);
int (*ReadSomething)(ubyte &ignitionStatus);
} TBootPointers;
and then do
const TBootPointers *bootPointers = 0xFC00;
bootPointers->ReadIgnition(resultStatus);
Or maybe this can be a clue:
int (*ReadIgnition)(ubyte &ignitionStatus);
ReadIgnition = (int (*)(ubyte &)) (*(*int)0xFC02);
best regards
Johan Wallström
Elektronik Design AB
060-169550
----- Original Message -----
From: Bengt Ragnemalm
To: ICC-AVR discussion list
Sent: Friday, September 14, 2007 7:59 AM
Subject: [Icc-avr] Bootloader
Is it possible for the normal program to access functions in the bootloader (to save space)? If that is so, how do I do it in C?
Best regards
Bengt
________________________________________________________________
Bengt Ragnemalm Tel +46 13 22 24 97
Research engineer FAX: +46 13 10 19 02
Linköpings Universitet mailto:bengt.ragnemalm at imt.liu.se
Inst. för Medicinsk Teknik Internet: http://www.imt.liu.se
S-581 85 Linköping SWEDEN
------------------------------------------------------------------------------
_______________________________________________
Icc-avr mailing list
Icc-avr at imagecraft.com
http://dragonsgate.net/mailman/listinfo/icc-avr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070914/603f84a6/attachment-0001.html
More information about the Icc-avr
mailing list