Ravi Gautam

Vector Table

Discussion created by Ravi Gautam on Jun 24, 2008
Latest reply on Jun 26, 2008 by Ravi Gautam
Hi there!
I have various functions called Boot, SMBus_Init, SMBus_Process, etc. Unless I know the size of each function I can not stack them one top of another and keep track of the exact location where each function starts.
I know a better way of doing this is to use a jump table and know how to do it in SiLabs IDE. I was wondering if you guys know a way of doing this in CodeWarrior. Right now it is in SiLabs IDE format.

CSEG    AT      0x007B
EXTRN   CODE (Boot)  // tells the linker that Boot is an external function - go look for it.
EXTRN   CODE (SMBus_Init)
EXTRN   CODE (SMBus_Process)
AJMP        Boot // jump to Boot. Instruction stored at x7b
AJMP        SMBus_Init  //jump to SMBus_Init. Instruction stored at 0x7d. Jump instructions take 2 code                                                 //spaces.
AJMP        SMBus_Process // jump to SBus_Process. Instruction stored at 0x7f

If you give me a hint on how to do this in CodeWarrior, I can make constant function pointer calls to envoke my functions from outside the bootloader project.
typedef void (* ConstFunctPtr)(void);
ConstFunctPtr FunctPtr;
FunctPtr = (ConstFunctPtr)(HARD_CODED_ADDRESS_LOCATION);
FunctPtr();

I can think of a way to get around this but am not entierly happy with myself. One way of doing this would be creating one lined functions for making calls and stacking them on top of another. Then in the linker I could put these one lined functions at fixed addresses probably separating them by 4-5 address locations.
void CallBoot(void){
Boot();
}

Thanks guys/gals! And thanks for all your help in the past as well!

Outcomes