This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Delfino boot loader segment size limit / bug ?

Other Parts Discussed in Thread: TMS320C28346, CONTROLSUITE

A large program to load and boot in the TMS320C28346 (Delfino) DSP has a .text code section bigger than 0xFFFF words.

I use the hex2000 provided with the code composer utility to create the boot data. As the segment size of the DSP's boot loader is a 16 bit value, the segment size is limited 0xFFFF words, however the hex2000 utility correctly splits up the section into two consecutive segments with the first segment having the maximum segment size of 0xFFFF words and the next segment with the remaining size.

The DSP's boot loader however seems to hang with that data. I reviewed the boot loader's source code provided with the control suite. My question is whether the CopyData routine of the boot loader might have a bug ?

As can be seen in the source code below, the loop variable i is declared 16 bit wide and therefore can have a maimum value of 0xFFFF. In the for statement
for(i = 1; i <= BlockHeader.BlockSize; i++)
the termination condition of the loop can never be reached with a blocksize of 0xFFFF, because i overflows before reaching 0x10000, resulting in an infinite loop.

Can anyone confirm this and if so, is a workaround available ?

void CopyData()
{
   struct HEADER {
     Uint16 BlockSize;
     Uint32 DestAddr;
   } BlockHeader;

   Uint16 wordData;
   Uint16 i;
   // Get the size in words of the first block
   BlockHeader.BlockSize = (*GetWordData)();
   // While the block size is > 0 copy the data
   // to the DestAddr.  There is no error checking
   // as it is assumed the DestAddr is a valid
   // memory location
   while(BlockHeader.BlockSize != (Uint16)0x0000)
   {
      BlockHeader.DestAddr = GetLongData();
      for(i = 1; i <= BlockHeader.BlockSize; i++)
      {
          wordData = (*GetWordData)();
          *(Uint16 *)BlockHeader.DestAddr++ = wordData;
      }
      // Get the size of the next block
      BlockHeader.BlockSize = (*GetWordData)();
   }
   return;
}
 

What is the correct method debugging the boot loader with code composer ?
It should not load nor recompile the source to ensure a 100% match of the code in the code composer's memory and the DSP's ROM..

Eckart Märkel

  • Eckart,

    are you using the latest version of hex tool available? it will be helpful if you can submit the hextool version information in the post.

     

    Best Regards

    Santosh

  • Hello Santosh,

    > are you using the latest version of hex tool available? it will be helpful if you can submit the hextool version information in the post.

    I thougt that I always used the most up to date version as I do regularly updates to the code composer, But now I saw that additional settings in the build options were needed in order to get the newer tool version used.

    Previously, I used 6.0.2, now 6.1.0, but the problem still exists - resp. no, it does not exist any more for me, because new my custom host loader routine applies a patch, which splits the 65535-word segment into two segments.

    Meanwhile I had also inserted a part of the boot loader source code into an own test program to verify the boot loader's behaviour described in the above article. I wonder why nodody else experienced such a problem.

    Eckart Märkel

     

  • Eckart,

    we have identified the problem a while back and raised a flag to fix this.

    > Boot documentation across the devices is going to be updated to mention that the max block size should be less than 0xFFFF

    > The corresponding hex tools will also be updated not to spit out a block of size >= 0xFFFF.

     

    Best Regards
    Santosh

  • I am new with this chip (C28346) which boots from SPI according hardware design. Where can I find the boot code for this chip? It is important since I have to write a secondary bootloader for this chip.

  • Hi Jinlong,

    The boot code for this device is in ControlSuite in this directory:

    .\controlSUITE\libs\utilities\boot_rom\2834x\