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.

TMS570LS3137: I cannot use Flash Bank 0 and Bank 1

Part Number: TMS570LS3137

Hello,

I have problems using Flash API to store data into a BANK 0 or 1 of flash memory.

My setup is as follows:

[TMS570LS3137PGE custom board] ⇐ ⇐ ⇐ [CAN interface] ⇐ ⇐ ⇐ [SPI to CAN module] ⇐ ⇐ ⇐ [Arduino UNO]

However, the memory spaces from 0x00180000 are empty (Itried with an initial memory position of 0x00020020 with no success). I think it has to be something related to the bl_link.cmd configuration. Mi bl_link.cmd is as follows:

/* USER CODE BEGIN (0) */
/* USER CODE END */


/*----------------------------------------------------------------------------*/
/* Linker Settings                                                            */
--retain="*(.intvecs)"

/* USER CODE BEGIN (1) */

/* USER CODE END */

/*----------------------------------------------------------------------------*/
/* Memory Map                                                                 */

MEMORY
{

    VECTORS (X)  : origin=0x00000000 length=0x00000020	vfill = 0xFFFFFFFF
    FLASH0  (RX) : origin=0x00000020 length=0x0017FFDF	vfill = 0xFFFFFFFF
    FLASH1  (RX) : origin=0x00180000 length=0x002FFFFF	vfill = 0xFFFFFFFF
    SRAM  (RW) : origin=0x08002000 length=0x00002000
    STACK   (RW) : origin=0x08004000 length=0x00002000



//    VECTORS    (X)   : origin=0x00000000 length=0x00000020    vfill = 0xffffffff
//    FLASH0     (RX)  : origin=0x00000020 length=0x00010000    vfill = 0xffffffff
//    FLASH1     (RX)  : origin=0x00010020 length=0x07FF1FE0    vfill = 0xffffffff
//    SRAM       (RWX)  : origin=0x08002000 length=0x00002000
//    STACK      (RW)  : origin=0x08004000 length=0x00002000

/* USER CODE BEGIN (2) */
#if 1
    ECC_VEC  (R) : origin=(0xf0400000 + (start(VECTORS) >> 3))
                   length=(size(VECTORS) >> 3)
                   ECC={algorithm=algoL2R5F021, input_range=VECTORS}

    ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASH0)  >> 3))
                   length=(size(FLASH0)  >> 3)
                   ECC={algorithm=algoL2R5F021, input_range=FLASH0 }

    ECC_FLA1 (R) : origin=(0xf0400000 + (start(FLASH1)  >> 3))
                   length=(size(FLASH1)  >> 3)
                   ECC={algorithm=algoL2R5F021, input_range=FLASH1 }
#endif
/* USER CODE END */

}

/* USER CODE BEGIN (3) */
ECC
{
    algoL2R5F021 : address_mask = 0xfffffff8 /* Address Bits 31:3 */
                   hamming_mask = R4         /* Use R4/R5 build in Mask */
                   parity_mask  = 0x0c       /* Set which ECC bits are Even and Odd parity */
                   mirroring    = F021       /* RM57Lx and TMS570LCx are build in F021 */
}
/* USER CODE END */


/*----------------------------------------------------------------------------*/
/* Section Configuration                                                      */

SECTIONS
{
   .intvecs : {} > VECTORS



   flashAPI:
   {
     .\source\Fapi_UserDefinedFunctions.obj (.text)
     .\source\bl_flash.obj (.text)
     //--library= "c:\ti\Hercules\F021 Flash API\02.01.01\F021_API_CortexR4_BE_V3D16.lib"  (.text)
     --library="F021_API_CortexR4_BE_V3D16.lib"  (.text)
   } palign=8 load = FLASH0, run = SRAM, LOAD_START(apiLoadStart), RUN_START(apiRunStart), SIZE(apiLoadSize)

   .text  : {} > FLASH0 | FLASH1 /*Initialized executable code and constants*/
   //.const : {} load=FLASH0 , run = SRAM, LOAD_START(constLoadStart), RUN_START(constRunStart), SIZE(constLoadSize)
   
	.const : {} > FLASH0 | FLASH1
    .cinit   : {} > FLASH0
    .pinit   : {} > FLASH0
    .bss     : {} > SRAM
    .data    : {} > SRAM
	.sysmem  : {} > SRAM
/* USER CODE BEGIN (4) */
/* USER CODE END */
}

/* USER CODE BEGIN (5) */
/* USER CODE END */


/*----------------------------------------------------------------------------*/
/* Misc                                                                       */

/* USER CODE BEGIN (6) */
/* USER CODE END */
/*----------------------------------------------------------------------------*/

Thanks a lot and regards,

Leandro

  • Hi Leandro,

    The flash sector starting from 0x180000 is in bank1. You can execute your code and flash APIs out of flash Bank 0 to erase this sector (0x180000) and program data to this flash erase without any restriction. 

    You don't have to copy the Flash APIs to SRAM, and execute those code out of SRAM. 

  • Hello QJ,

    I think that I understand. So, I could execute the Flash API from FLASH0? 

    Could it be If I erase the following lines?

       flashAPI:
       {
         .\source\Fapi_UserDefinedFunctions.obj (.text)
         .\source\bl_flash.obj (.text)
         //--library= "c:\ti\Hercules\F021 Flash API\02.01.01\F021_API_CortexR4_BE_V3D16.lib"  (.text)
         --library="F021_API_CortexR4_BE_V3D16.lib"  (.text)
       } palign=8 load = FLASH0, run = SRAM, LOAD_START(apiLoadStart), RUN_START(apiRunStart), SIZE(apiLoadSize)

    Or may be replacing 'run = SRAM' by 'run = FLASH0'?

    Thanks for your response and patience,

    Regards,

    Leandro

  • HI Leandro,

    You can comment those lines out if you program data to flash BANK1.

  • Hello QJ,

    Thanks for your response. I will try with that configuration.

    Regards!

    Leandro

  • Hello QJ,

    I tried with that and It cannot compile.

    I get the following error:

    #10010 errors encountered during linking; "LabOSat-02_Engine.out" not built
    <a href="file:/D:/ti/ccs1100/ccs/tools/compiler/dmed/HTML/10234.html">#10234-D</a>  unresolved symbols remain
    gmake: *** [all] Error 2
    gmake[1]: *** [LabOSat-02_Engine.out] Error 1
    unresolved symbol Fapi_serviceWatchdogTimer, first referenced in ../source/F021_API_CortexR4_BE_V3D16.lib<Read.WdService.obj>

    Then, I excuded from Build the file 'F021_API_CortexR4_BE_V3D16.lib'. However I get the following error:

    #10010 errors encountered during linking; "LabOSat-02_Engine.out" not built
    <a href="file:/D:/ti/ccs1100/ccs/tools/compiler/dmed/HTML/10234.html">#10234-D</a>  unresolved symbols remain
    gmake: *** [all] Error 2
    gmake[1]: *** [LabOSat-02_Engine.out] Error 1
    unresolved symbol Fapi_doMarginReadByByte, first referenced in ./source/bl_flash.obj
    unresolved symbol Fapi_enableMainBankSectors, first referenced in ./source/bl_flash.obj
    unresolved symbol Fapi_initializeFlashBanks, first referenced in ./source/bl_flash.obj
    unresolved symbol Fapi_issueAsyncCommandWithAddress, first referenced in ./source/bl_flash.obj
    unresolved symbol Fapi_issueProgrammingCommand, first referenced in ./source/bl_flash.obj
    unresolved symbol Fapi_setActiveFlashBank, first referenced in ./source/bl_flash.obj

    Thanks and regards,

    Leandro

  • Hi Leandro,

    The Fapi_UserDefinedFunctions.c should be included in your project.

    You can copy this file to your ../source folder