thumb interwork
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
thumb interwork
- To: arm-gnu@xxxxxxxxxxxxxxxx
- Subject: thumb interwork
- From: Slide <slide.o.mix@xxxxxxxxx>
- Date: Thu, 17 Apr 2008 05:02:17 -0700
All,
I have a structure which is returned from a function that is at a
specific address in ROM code on my platform. I declare a function
pointer for this and assign it a non-word aligned address since it is
a thumb mode function. This works fine and I am able to call the
function and the compiler generates a blx instruction nicely. This
structure that is returned contains other function pointers to
functions within the ROM that I am trying to use. The values that are
returned are non-word aligned function addresses, but I can't seem to
get the compiler to generate a blx instruction after a certain point
in my code. Below is a reproduction of the code I am trying to use.
typedef P_RomFunctions* (*GetRomFunctions_F)(int type);
typedef unsigned int (*ReadMemory_F)(unsigned int address, unsigned
int buffer, unsigned int size);
GetRomFunctions_F GetRomFunctions;
ReadMemory_F ReadMemory;
int main(int argc, char** argv)
{
P_RomFunctions* (*GetRomFunctions)(int type);
GetRomFunctions = (P_RomFunctions* (*)(int type))(0x5e002099);
P_RomFunctions pRomFuncs = (P_RomFunctions)GetRomFunctions(0);
// this works
ReadMemory = pRomFuncs->ReadMemory;
ReadMemory(0x00000000, 0x10000000, 0x200); // this generates a blx
memset((void*)0x10000000, 0, 0x200);
ReadMemory(0x00000000, 0x10000000, 0x200); // this generates a
ldr pc, [rX] instruction
...
}
How can I make sure that the compiler will generate a blx instruction
so that the mode is changed to thumb to execute the function?
thanks!
slide
--
slide-o-blog
http://slide-o-blog.blogspot.com/