Hi
I have discovered 2 problems with the TI compiler used in our project.
General info.
CCSv6
MCU: TMS320F28377D
Compiler: TI v6.4.4
SYS/BIOS 6.40.3.39
1. We have a for loop that does not loop correctly, it never stops, but should have when i is 0.
Uint16 i;
...
if(pIovTx)
{
pIov = pIovTx;
// for (i = iovTxCount; i; i--) /* THIS FAILS WITH TI COMPILER v6.4.4 and optimization level 2! */
for (i = 0; i < iovTxCount; i++) /* This works */
{
if(pIov->addr)
{
if (pIov->swap)
memcpySwap(pBuff, pIov->addr, pIov->len);
else
memcpyNoSwap(pBuff, pIov->addr, pIov->len);
}
else
{
memset(pBuff, 0, pIov->len);
}
pBuff += pIov->len;
pIov++;
}
}
2. We get an INTERNAL ERROR in another file
'Building file: ../hw/hw_mram_spi.c'
'Invoking: C2000 Compiler'
"C:/ti/ccsv6/tools/compiler/ti-cgt-c2000_6.4.4/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -O2 --opt_for_speed=2 --fp_mode=relaxed --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-c2000_6.4.4/include" --include_path="C:/Data/svn/iRotor/DMM/trunk/dmm_src/app" --include_path="C:/Data/svn/iRotor/DMM/trunk/dmm_src/util" --include_path="C:/Data/svn/iRotor/DMM/trunk/dmm_src/util_MRM" --include_path="C:/Data/svn/iRotor/DMM/trunk/dmm_src/esc" --include_path="C:/Data/svn/iRotor/DMM/trunk/dmm_src/hw" --include_path="C:/Data/svn/iRotor/DMM/trunk/dmm_src/lib_headers" --include_path="C:/Data/svn/iRotor/DMM/trunk/dmm_src/F2837xD_headers/include" --include_path="C:/Data/svn/iRotor/DMM/trunk/dmm_src/hw_ext" --define=_FLASH --define=DMM_APP --define=PARMNV_DISABLE_no --define=DSP28377D_DEVICE --define=CPU1 --define=F28_BIOS --define=DEBUG --diag_warning=225 --display_error_number --diag_wrap=off --printf_support=minimal --preproc_with_compile --preproc_dependency="hw/hw_mram_spi.pp" --obj_directory="hw" --cmd_file="./configPkg/compiler.opt" "../hw/hw_mram_spi.c"
>> ../hw/hw_mram_spi.c, line 164: INTERNAL ERROR: >>>Register allocation failed:
>> Compilation failure
mram_init
Snippet:
int mram_init(void)
{
Uint32 i, x;
Uint16 err;
Uint16 statusRegister=0;
err = 0;
// Read status register
err |= spi_txrx(MRAM_CC_RDSR, 0, &statusRegister, 1);
printf("MRAM: SR = %x\r\n", ((int)statusRegister) );
err |= spi_txrx(MRAM_CC_RDSR, 0, &statusRegister, 1);
printf("MRAM: SR = %x\r\n", ((int)statusRegister) );
// Write enable
err |= spi_txrx(MRAM_CC_WREN, 0, 0, 0);
// Read status register
err |= spi_txrx(MRAM_CC_RDSR, 0, &statusRegister, 1);
printf("MRAM: SR = %x\r\n", ((int)statusRegister) );
// Configure status register (write enable all blocks)
statusRegister = 0x02;
err |= spi_txrx(MRAM_CC_WRSR, 0, &statusRegister, 1); // THIS IS LINE 164
// Read status register
err |= spi_txrx(MRAM_CC_RDSR, 0, &statusRegister, 1);
printf("MRAM: SR = %x\r\n", ((int)statusRegister) );
If I remove any code line above this the error is gone.
How do I provide the best info for You to solve this? I'd prefer not to give you our whole project, since this is for a client.
Many thanks,
Mads