Hello,
The hardware I am working with is a 5502 DSP with Micron M25P80 serial flash.
The software is Code Composer Studio Version 5.1.1.00031
Problem: I am reading the boot table from a .bin file stored in flash. I read the first four bytes of the file (32 bit entry point) and I want to assemble the bytes into a uint32_t. I use the following code to achieve this and receive the "Warning #64-D Shift count is too large" message.
Code Snippet
// Get the entry point for the binary file being loaded
// The entry point is in the first four bytes of the Boot Table
entryPoint = spiflash_read_byte(flash_offset++) << 24;
entryPoint = entryPoint + spiflash_read_byte(flash_offset++) << 16;
entryPoint = entryPoint + spiflash_read_byte(flash_offset++) << 8;
entryPoint = entryPoint + spiflash_read_byte(flash_offset++);
End Code Snippet
Below is the code snippet that reads the flash:
Code Snippet
unsigned short spiflash_read_byte(unsigned long int flash_offset)
{
unsigned short ret_val;
assert_chip_select();
// Send READ command
while ( (MCBSP0_SPCR2 & BIT1) == 0 ) {} // wait for XRDY
MCBSP0_DXR1 = READ_CMD;
while ( (MCBSP0_SPCR1 & BIT1) == 0 ) {} // wait for RRDY to indicate write completed
MCBSP0_DRR1; // throw away dummy data
// Send address[23:16]
while ( (MCBSP0_SPCR2 & BIT1) == 0 ) {} // wait for XRDY
MCBSP0_DXR1 = flash_offset >> 16;
while ( (MCBSP0_SPCR1 & BIT1) == 0 ) {} // wait for RRDY to indicate write completed
MCBSP0_DRR1; // throw away dummy data
// Send address[15:8]
while ( (MCBSP0_SPCR2 & BIT1) == 0 ) {} // wait for XRDY
MCBSP0_DXR1 = flash_offset >> 8;
while ( (MCBSP0_SPCR1 & BIT1) == 0 ) {} // wait for RRDY to indicate write completed
MCBSP0_DRR1; // throw away dummy data
// Send address[7:0]
while ( (MCBSP0_SPCR2 & BIT1) == 0 ) {} // wait for XRDY
MCBSP0_DXR1 = flash_offset;
while ( (MCBSP0_SPCR1 & BIT1) == 0 ) {} // wait for RRDY to indicate write completed
MCBSP0_DRR1; // throw away dummy data
// Read Byte
while ( (MCBSP0_SPCR2 & BIT1) == 0 ) {} // wait for XRDY
MCBSP0_DXR1 = 0; // dummy write
while ( (MCBSP0_SPCR1 & BIT1) == 0 ) {} // wait for RRDY to get data
ret_val = MCBSP0_DRR1;
deassert_chip_select();
return ret_val;
}
End Code Snippet
The original "spiflash_read_byte" returned an int. I changed it to a short, but still get the warning.
While debugging this, it looks like "entryPoint = spiflash_read_byte(flash_offset++) << 24;" is trying to shift a 16bit value into "entryPoint".
If I try the equivalent of this code in Microsoft C, it works as expected.
Any suggestions would be appreciated.
Thanks,
Stephen