我在μC,固件和应用程序中有两个软件。 从应用程序我想调用在固件中编译的Calculate_Crc。 当我直接执行调用时,执行不会被执行,代码会跳转到其他位置。 在该功能中,我有全局数据和一个子功能。
调用此函数最安全的方式是什么?
我正在使用Diab Compiler& C langage。
const unsigned long g_poly_Cst;
unsigned long Calculate_Crc32( const void *Src, unsigned char Size, unsigned long Crc, const void *Poly)
{
unsigned long crc = ( unsigned long)(crcval);
unsigned char areaSize = Size;
g_poly_Cst = *((const unsigned char *)Poly);
const unsigned char *data = (*((unsigned char **)&Src_Ptr));
unsigned char bitSize;
while (areaSize != 0)
{
crc ^= ((unsigned long)(*(data++)) << (((sizeof(unsigned long) -1)*8) *((1 << 1)/2)) );
bitSize = 8+1;
while (--bitSize != 0)
{
if ( (crc & ((unsigned long)((unsigned long)(3 << ((sizeof(unsigned long)*4)-1) ) shift (sizeof(unsigned long)*4))) ) !=0)
crc = (unsigned long)((crc << 1) ^ g_poly_Cst);
else
crc = (unsigned long)(crc << 1);
}
areaSize--;
}
}
Notify_UpperLayer(DONE);
return Crc;
}