I am trying to run the project PCIE_idkAM572x_wSocLib_C66BiosExampleProject on our TMDXEVM5728.
First step was to change the board type in the file "C:\ti6\pdk_am57xx_1_0_0\packages\ti\drv\pcie\example\sample\am572x\c66\bios\pcie_sample_wSoCLib.cfg". I changed Board.Settings.boardName = "evmAM572x"; and compiled the project. I loaded and ran the project via the XDS560 JTAG. It always gets stuck in the following function at the yellow highlighted for loop. The value of shift is a huge number. Now, if I set a break point at the red highlighted line, the value of shift is 8. That seems reasonable. If I then single step the code it jumps to the line in blue and the value of shift is 0x3F51E000. The stack shows that __c6xabi_divull() is called from BoardCtrlPadMux(). I've tried stepping the assembly code and it looks like at some point the memory location of shift is being overwritten. The assembly lines that seem to do the overwrite are here:
8000f704: 06B3EDA1 SHR.S1 A12,0x1f,A13
8000f708: 023C23C6 || STDW.D2T2 B5:B4,*+B15[1]
/***********************************************************************/
/* */
/* _divull() - Unsigned 64-bit division. */
/* */
/***********************************************************************/
#ifdef __TI_EABI__
_CODE_ACCESS unsigned long long __c6xabi_divull(unsigned long long x1, unsigned long long x2)
#else
_CODE_ACCESS unsigned long long _divull(unsigned long long x1, unsigned long long x2)
#endif
{
register int i;
register unsigned long long num;
register unsigned long long den;
register int shift;
unsigned long long first_div = 0;
unsigned long long num64;
shift = _lmbdull(1, x2) - _lmbdull(1, x1);
if (x1 < x2) return 0;
if (x1 == 0) return 0;
/* ! if (x2 == 0) return -1; */
if (x2 == 0) return (unsigned long long) -1;
num = x1;
den = x2 << shift;
num64 = (_lmbdull(1, x1) == 0);
first_div = num64 << shift;
if (den > num) first_div >>= 1;
if (num64)
{
if(den > num) { den >>= 1; num -= den; }
else { num -= den; den >>= 1; }
}
else
shift++;
for (i = 0; i < shift; i++)
{
num = _subcull(num, den);
}
if (shift)
return num << (64-shift) >> (64-shift) | first_div;
else
return first_div;
}