Hopefully someone knows...
I'm writing a jump table for a number of functions. The jump table located '__at' a location in memory contains __asm instructions to branch to all required functions defined previously, using "__asm{B func1}", for example.
Some code I am using contains a function pointer array (*funcptr[16])(arg..), and I'm not sure how to branch to it. if I try __asm{B funcptr}, the compiler (uvision3) complains that the "Target is out of range", which is understandable. Unfortunately my asm abilities are nearly non-existent and I'm unsure how to rectify it.
extern void func1(char stuff); extern void(* funcptr[16]) (unsigned int arg); void usb_table(void) __at 0x00002000 } __asm{B func1} // located at 0x2000 __asm{B funcptr} // target out of range {
If they're function pointers, won't you need to call them, rather than just branch to them?
yeah...I can see your point and admit I wasn't thinking properly. As they are function pointers, they already contain an indirect link to the actual functions, so no need for a jump table reference. I'll give it a go as it is. Sorry to waste your time, and thanks for pointing that out.