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.

TMS320F28388D: [CM] Boot image error

Part Number: TMS320F28388D


HI, sir.

My environment is as follow

-----------------------------------------------------

board : custom board

IDE : CCS 10.1

Compiler version : TI v20.2.2 LTS

Optimization : -O2 --opt_for_speed=3

debugger : XDS100v3

bootloader loc : SECTOR0,1        cmd setting -> FLASH_BOOTLOADER  : origin = 0x00200008, length = 0x00007FF8 [ALIGN(8)]

app loc            : SECTOR4~9       cmd setting -> FLASH_APP                    : origin = 0x00210008, length = 0x0005FFF8, [ALIGN(8)]

-----------------------------------------------------

Currently I have cm bootloader on flash 0, and I have succeeded in updating the FW. However, something strange was discovered.

When the txt size of the app becomes larger than one sector, the specific block address of the converted image is not an 8-byte address array.

I checked boot hex file and I found that address 0x21FFFF value was blank and next block adress was 0x220007. As far as I know, In the SCI_Boot kernel program block address must be input in units of 8 bytes so I expected 0x220008 but result is 0x220007. In details as follows

I don't know what I did wrong.

Thanks and regards.

Jude.

 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[added]

here is a system level.

  • Hi Jude, 

    The description of the problem is not clear. Can you please explain this in more detail starting at the system level.  How is programming being done?

    Thanks,
    Krishna

  • Hi Krishna,

    Thank you for your fast reply. 

    I couldn't find to post an image in the comments, so I add an image this thread.

    The first question I asked was the process of the red square dotted line.

    I analyzed the 28377d's sci kernel program and confirmed that the images are written to flash in 16-byte units from CPU1. So, in the CM, Bootloader was implemented to write to Flash in units of 8 bytes using CM Flash_API. However, if the image itself does not have a continuous address of 8 bytes, there is a problem of redundant writing to the same address. In particular, this problem is found when the size of the image exceeds one sector.

                //64byte
               for(k = 0; k < (BUFFER_SIZE / 8); k++)
               {
                   miniBuffer[0] = Buffer[k * 8 + 0];
                   miniBuffer[1] = Buffer[k * 8 + 1];
                   miniBuffer[2] = Buffer[k * 8 + 2];
                   miniBuffer[3] = Buffer[k * 8 + 3];
                   miniBuffer[4] = Buffer[k * 8 + 4];
                   miniBuffer[5] = Buffer[k * 8 + 5];
                   miniBuffer[6] = Buffer[k * 8 + 6];
                   miniBuffer[7] = Buffer[k * 8 + 7];
    
                   //
                   //check that miniBuffer is not already all erased data
                   //
                   if(!((miniBuffer[0] == 0xFF) && (miniBuffer[1] == 0xFF) &&
                        (miniBuffer[2] == 0xFF) && (miniBuffer[3] == 0xFF) &&
                        (miniBuffer[4] == 0xFF) && (miniBuffer[5] == 0xFF) &&
                        (miniBuffer[6] == 0xFF) && (miniBuffer[7] == 0xFF) ))
                   {
                        //
                        //clean out flash banks if needed
                        //
                        sectorAddress = FindSector(BlockHeader.DestAddr);
    
                        if(sectorAddress != 0xdeadbeef)
                        {
                            sectorSize = FindSize(sectorAddress);
                            oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,
                                    (uint32 *)sectorAddress);
                            while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
                            oReturnCheck = Fapi_doBlankCheck((uint32 *)sectorAddress,
                                                             sectorSize,
                                                             &oFlashStatusWord);
                            if(oReturnCheck != Fapi_Status_Success)
                            {
                                if(fail == 0) //first fail
                                {
                                    statusCode.status = BLANK_ERROR;
                                    statusCode.address = oFlashStatusWord.au32StatusWord[0];
                                }
                                fail++;
                            }
                        }
                        //
                        //program 8byte at once, 64-bits
                        //
                        oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)BlockHeader.DestAddr,
                                                           miniBuffer,
                                                           sizeof(miniBuffer),
                                                           0,
                                                           0,
                                                           Fapi_AutoEccGeneration);
                        while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
                        if(oReturnCheck != Fapi_Status_Success)
                        {
                            if(fail == 0) //first fail
                            {
                                statusCode.status = PROGRAM_ERROR;
                                statusCode.address = oFlashStatusWord.au32StatusWord[0];
                            }
                           fail++;
                        }
                        //oFlashStatus = Fapi_getFsmStatus();
                        for(j = 0; j < 8; j += 4)
                        {
                           uint32_t toVerify = (miniBuffer[j+3]<<24)|
                                               (miniBuffer[j+2]<<16)|
                                               (miniBuffer[j+1]<<8)|
                                               (miniBuffer[j]);
    
                           oReturnCheck = Fapi_doVerify((uint32 *)(BlockHeader.DestAddr+j),
                                                        1,
                                                        (uint32 *)(&toVerify),
                                                        &oFlashStatusWord);
                           if(oReturnCheck != Fapi_Status_Success)
                           {
                               if(fail == 0) //first fail
                               {
                                    statusCode.status = VERIFY_ERROR;
                                    statusCode.address = oFlashStatusWord.au32StatusWord[0];
                               }
                               fail++;
                           }
                        } //for j; for Fapi_doVerify
                   } //check if miniBuffer does not contain all already erased data
                   BlockHeader.DestAddr = BlockHeader.DestAddr + 0x8;
               } //for(int k); loads miniBuffer with Buffer elements
           }
           //
           //get the size of the next block
           //
           BlockHeader.BlockSize = (*get_word)();
        }

    thanks.

    Jude.

  • Thanks Jude for your feedback.  We are looking into what you have reported and need to consult with the domain expert.  We will get back to you as soon as we have a resolution/explanation.

    Regards,

    Krishna 

  • Jude,

    Can you share your linker cmd file?

    Thanks and regards,

    Vamsi

  • Thank you Krishna!

  • Hi, Vamsi.

    Thank you for your reply.

     

    Finally I solved this problem by splitting the sectors without merging them, and by using the'>>' syntax in the .text section.

    The above phenomenon is found when the size of a specific obj file is more than one sector.

    The previous command file is as follows.

    MEMORY
    {
    /* Flash sectors */
    // CMBANK0_RESETISR : origin = 0x00210000, length = 0x00000008 /* Boot to Flash Entry Point */
    // FLASH_BOOTLOADER : origin = 0x00200008, length = 0x00007FF8
    // FLASH_APP : origin = 0x00210008, length = 0x0005FFF8

    CMBANK0_RESETISR : origin = 0x00200000, length = 0x00000008 /* Boot to Flash Entry Point */
    FLASH_APP : origin = 0x00200008, length = 0x0005FFF8

    /*
    CMBANK0_SECTOR1 : origin = 0x00204000, length = 0x00004000
    CMBANK0_SECTOR2 : origin = 0x00208000, length = 0x00004000
    CMBANK0_SECTOR3 : origin = 0x0020C000, length = 0x00004000
    CMBANK0_SECTOR4 : origin = 0x00210000, length = 0x00010000
    CMBANK0_SECTOR5 : origin = 0x00220000, length = 0x00010000
    CMBANK0_SECTOR6 : origin = 0x00230000, length = 0x00010000
    CMBANK0_SECTOR7 : origin = 0x00240000, length = 0x00010000
    CMBANK0_SECTOR8 : origin = 0x00250000, length = 0x00010000
    CMBANK0_SECTOR9 : origin = 0x00260000, length = 0x00010000
    CMBANK0_SECTOR10 : origin = 0x00270000, length = 0x00004000
    CMBANK0_SECTOR11 : origin = 0x00274000, length = 0x00004000
    CMBANK0_SECTOR12 : origin = 0x00278000, length = 0x00004000
    CMBANK0_SECTOR13 : origin = 0x0027C000, length = 0x00004000
    */

    CRAM : origin = 0x1FFFC000, length = 0x00003FFF
    /*
    C1RAM : origin = 0x1FFFC000, length = 0x00001FFF
    C0RAM : origin = 0x1FFFE000, length = 0x00001FFF
    */
    BOOT_RSVD : origin = 0x20000000, length = 0x00000800 /* Part of S0, BOOT rom will use this for stack */

    SRAM : origin = 0x20000800, length = 0x0000F7FF
    /*
    S0RAM : origin = 0x20000800, length = 0x000037FF
    S1RAM : origin = 0x20004000, length = 0x00003FFF
    S2RAM : origin = 0x20008000, length = 0x00003FFF
    S3RAM : origin = 0x2000C000, length = 0x00003FFF
    */
    E0RAM : origin = 0x20010000, length = 0x00003FFF

    CPU1TOCMMSGRAM0 : origin = 0x20080000, length = 0x00000400
    CPU1TOCMMSGRAM0_ECAT : origin = 0x20080400, length = 0x00000400
    CPU1TOCMMSGRAM1 : origin = 0x20080800, length = 0x00000800

    CMTOCPU1MSGRAM0 : origin = 0x20082000, length = 0x00000400
    CMTOCPU1MSGRAM0_ECAT : origin = 0x20082400, length = 0x00000400
    CMTOCPU1MSGRAM1 : origin = 0x20082800, length = 0x00000800

    CPU2TOCMMSGRAM0 : origin = 0x20084000, length = 0x00000800
    CPU2TOCMMSGRAM1 : origin = 0x20084800, length = 0x00000800
    CMTOCPU2MSGRAM0 : origin = 0x20086000, length = 0x00000800
    CMTOCPU2MSGRAM1 : origin = 0x20086800, length = 0x00000800
    }

    SECTIONS
    {
    .resetisr : > CMBANK0_RESETISR
    .vftable : > FLASH_APP,ALIGN(8) /* Application placed vector table in Flash*/
    .vtable : > SRAM /* Application placed vector table in RAM*/
    .text : > FLASH_APP,ALIGN(8)
    .cinit : > FLASH_APP,ALIGN(8)
    .pinit : > FLASH_APP,ALIGN(8)
    .switch : > FLASH_APP,ALIGN(8)
    .sysmem : > SRAM

    .stack : > SRAM
    .ebss : > CRAM
    .econst : > FLASH_APP,ALIGN(8)
    .esysmem : > CRAM
    .data : > SRAM
    .bss : > SRAM
    .const : > FLASH_APP,ALIGN(8)

    MSGRAM_CM_TO_CPU1 : > CMTOCPU1MSGRAM0, type=NOINIT
    MSGRAM_CM_TO_CPU1_ECAT : > CMTOCPU1MSGRAM0_ECAT, type=NOINIT
    MSGRAM_CM_TO_CPU2 : > CMTOCPU2MSGRAM0, type=NOINIT
    MSGRAM_CPU1_TO_CM : > CPU1TOCMMSGRAM0, type=NOINIT
    MSGRAM_CPU1_TO_CM_ECAT : > CPU1TOCMMSGRAM0_ECAT, type=NOINIT
    MSGRAM_CPU2_TO_CM : > CPU2TOCMMSGRAM0, type=NOINIT

    .TI.ramfunc : {} LOAD = FLASH_APP,
    RUN = SRAM,
    LOAD_START(RamfuncsLoadStart),
    LOAD_SIZE(RamfuncsLoadSize),
    LOAD_END(RamfuncsLoadEnd),
    RUN_START(RamfuncsRunStart),
    RUN_SIZE(RamfuncsRunSize),
    RUN_END(RamfuncsRunEnd),
    ALIGN(8)
    }

    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */

     

     

      

    I modified this as follows and completed downloading image.

    MEMORY
    {
    /* Flash sectors */
    CMBANK0_RESETISR : origin = 0x00210000, length = 0x00000008 /* Boot to Flash Entry Point */
    // FLASH_BOOTLOADER : origin = 0x00200008, length = 0x00007FF8
    FLASH_APP0 : origin = 0x00210008, length = 0x0000FFF8
    FLASH_APP1 : origin = 0x00220000, length = 0x00010000
    /*
    CMBANK0_SECTOR0 : origin = 0x00200008, length = 0x00003FF8
    CMBANK0_SECTOR1 : origin = 0x00204000, length = 0x00004000
    CMBANK0_SECTOR2 : origin = 0x00208000, length = 0x00004000
    CMBANK0_SECTOR3 : origin = 0x0020C000, length = 0x00004000
    CMBANK0_SECTOR4 : origin = 0x00210000, length = 0x00010000
    CMBANK0_SECTOR5 : origin = 0x00220000, length = 0x00010000
    CMBANK0_SECTOR6 : origin = 0x00230000, length = 0x00010000
    CMBANK0_SECTOR7 : origin = 0x00240000, length = 0x00010000
    CMBANK0_SECTOR8 : origin = 0x00250000, length = 0x00010000
    CMBANK0_SECTOR9 : origin = 0x00260000, length = 0x00010000
    CMBANK0_SECTOR10 : origin = 0x00270000, length = 0x00004000
    CMBANK0_SECTOR11 : origin = 0x00274000, length = 0x00004000
    CMBANK0_SECTOR12 : origin = 0x00278000, length = 0x00004000
    CMBANK0_SECTOR13 : origin = 0x0027C000, length = 0x00004000
    */

    CRAM : origin = 0x1FFFC000, length = 0x00003FFF
    /*
    C1RAM : origin = 0x1FFFC000, length = 0x00001FFF
    C0RAM : origin = 0x1FFFE000, length = 0x00001FFF
    */
    BOOT_RSVD : origin = 0x20000000, length = 0x00000800 /* Part of S0, BOOT rom will use this for stack */

    SRAM : origin = 0x20000800, length = 0x0000F7FF
    /*
    S0RAM : origin = 0x20000800, length = 0x000037FF
    S1RAM : origin = 0x20004000, length = 0x00003FFF
    S2RAM : origin = 0x20008000, length = 0x00003FFF
    S3RAM : origin = 0x2000C000, length = 0x00003FFF
    */
    E0RAM : origin = 0x20010000, length = 0x00003FFF

    CPU1TOCMMSGRAM0 : origin = 0x20080000, length = 0x00000400
    CPU1TOCMMSGRAM0_ECAT : origin = 0x20080400, length = 0x00000400
    CPU1TOCMMSGRAM1 : origin = 0x20080800, length = 0x00000800

    CMTOCPU1MSGRAM0 : origin = 0x20082000, length = 0x00000400
    CMTOCPU1MSGRAM0_ECAT : origin = 0x20082400, length = 0x00000400
    CMTOCPU1MSGRAM1 : origin = 0x20082800, length = 0x00000800

    CPU2TOCMMSGRAM0 : origin = 0x20084000, length = 0x00000800
    CPU2TOCMMSGRAM1 : origin = 0x20084800, length = 0x00000800
    CMTOCPU2MSGRAM0 : origin = 0x20086000, length = 0x00000800
    CMTOCPU2MSGRAM1 : origin = 0x20086800, length = 0x00000800
    }

    SECTIONS
    {
    .resetisr : > CMBANK0_RESETISR
    .vftable : > FLASH_APP0|FLASH_APP1,ALIGN(8) /* Application placed vector table in Flash*/
    .vtable : > SRAM /* Application placed vector table in RAM*/
    .text : >> FLASH_APP0|FLASH_APP1,ALIGN(8)
    .cinit : > FLASH_APP0|FLASH_APP1,ALIGN(8)
    .pinit : > FLASH_APP0|FLASH_APP1,ALIGN(8)
    .switch : > FLASH_APP0|FLASH_APP1,ALIGN(8)
    .sysmem : > SRAM

    .stack : > CRAM
    .ebss : > CRAM
    .econst : > FLASH_APP0|FLASH_APP1,ALIGN(8)
    .esysmem : > CRAM
    .data : > SRAM
    .bss : > SRAM
    .const : > FLASH_APP0|FLASH_APP1,ALIGN(8)

    MSGRAM_CM_TO_CPU1 : > CMTOCPU1MSGRAM0, type=NOINIT
    MSGRAM_CM_TO_CPU1_ECAT : > CMTOCPU1MSGRAM0_ECAT, type=NOINIT
    MSGRAM_CM_TO_CPU2 : > CMTOCPU2MSGRAM0, type=NOINIT
    MSGRAM_CPU1_TO_CM : > CPU1TOCMMSGRAM0, type=NOINIT
    MSGRAM_CPU1_TO_CM_ECAT : > CPU1TOCMMSGRAM0_ECAT, type=NOINIT
    MSGRAM_CPU2_TO_CM : > CPU2TOCMMSGRAM0, type=NOINIT

    .TI.ramfunc : {} LOAD = FLASH_APP0|FLASH_APP1,
    RUN = SRAM,
    LOAD_START(RamfuncsLoadStart),
    LOAD_SIZE(RamfuncsLoadSize),
    LOAD_END(RamfuncsLoadEnd),
    RUN_START(RamfuncsRunStart),
    RUN_SIZE(RamfuncsRunSize),
    RUN_END(RamfuncsRunEnd),
    ALIGN(8)
    }

    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */

    if I only combined Flash, Based on what I understand, it would compile and create the image normally regardless of the size of the obj file.

    But I am wondering if it is the right way to use it this way.

     

    Thank you.

    Jude.

  • Jude,

    Glad it is fixed now. 

    Splitting the sections and mapping a section to them is fine - no issues.

    I am closing this post since the issue is closed.  If you have further questions, you can open another post.

    Thanks and regards,

    Vamsi