Hi to everyone,
i am trying to use pointer functions to do indirect branch in C code, i am working with an NXP ARM LPC2478
This is my code:
// in internal flash unsigned char* MD5BuffSE(unsigned char *pBuffer, unsigned long lOffset, unsigned long lSize) { ... } g_CriptAddress.pMd5 = (void*)&MD5BuffSE; // g_CriptAddress is an array of void* ..... // in internal ram @ 0x4000fd00 typedef unsigned char* (*MD5)(unsigned char* , unsigned long , unsigned long ); MD5 Md5 = (MD5)g_CriptAddress.pMd5; if(memcmp(Md5((byte*)TOS_START, 0, TOS_DIM),pDataProt->ChkSumMd5,16)!=0) return false;
with this code all seems to works fine (code jumps to the right address and returns well), but next branch causes execution to fail with an abort exception.
if i use MD5BuffSE directly all works, but i noticed that compiler insert a long ARM to ARM veneer
so i ask myself if exist a way to tell compiler that it has to consider typedef MD5 a far call or to force it to create a long ARM to AMR veneer
what happens when i call a thumb function from arm code with indirect branch?
Lorenzo