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.

TMS570LS0714: Flash ECC

Part Number: TMS570LS0714
Other Parts Discussed in Thread: HALCOGEN,

I am using TMS570LS0714 microcontroller and have enabled Flash ECC in Halcogen. ECC generation has been added to the linker file. My application is to load a custom bootloader and the application firmware with ECC on the flash. 

The issue I am having is that when Flash ECC is enabled (calling assembly function _coreEnableFlashEcc_();) generates a 'flashErrorReal' error. My question is, can only a section of BANK0 can be set to have flash ECC enabled? What is causing the flashErrorReal abort to trigger?

This is my linker file:

MEMORY

{

VECTORS (X)  : origin=0x00000000

length=0x00000020

fill=0xffffffff

    BL_MAGIK (X)  : origin=(end(VECTORS))

    length=0x00000040

    vfill=0xffffffff

    FLASH_API_LIB (RX) : origin=(0x00040000)

    length=0x00000E10

    vfill=0xffffffff

    FLASH0 (RX) : origin=(end(FLASH_API_LIB))

    length=(0x00040000 - size(FLASH_API_LIB))

    vfill=0xffffffff

  FLASH7 (RX) : origin=0xF0200000

  length=0x00010000

  vfill=0xffffffff

RAM      (RW) : origin=0x08002000

length=0x0001E000

STACKS   (RW) : origin=0x08000000

length=0x00002000

/* Flash ECC Section */

// Bank 0 ECC

    ECC_VEC  (R)  : origin=(0xf0400000 + (start(VECTORS) >> 3))

    length=(size(VECTORS) >> 3)

    ECC={ algorithm=algoR4F021, input_range=VECTORS }

ECC_BL_MAGIK (R) : origin=(0xf0400000 + (start(BL_MAGIK)  >> 3))

length=(size(BL_MAGIK)  >> 3)

ECC={ algorithm=algoR4F021, input_range=BL_MAGIK }

ECC_FLASH_API (R)  : origin=(0xf0400000 + (start(FLASH_API_LIB)  >> 3))

length=(size(FLASH_API_LIB)  >> 3)

ECC={ algorithm=algoR4F021, input_range=FLASH_API_LIB }

    ECC_FLASH0 (R)  : origin=(0xf0400000 + (start(FLASH0)  >> 3))

    length=(size(FLASH0)  >> 3)

    ECC={ algorithm=algoR4F021, input_range=FLASH0 }

// Bank 7 ECC

    ECC_FLA7 (R)  : origin=0xF0100000

    length=(size(FLASH7)  >> 3)

    ECC={algorithm=algoR4F021, input_range=FLASH7 }

/* Flash ECC Section */

}

/*----------------------------------------------------------------------------*/

/* Section Configuration                                                      */

SECTIONS

{

   .intvecs : {} > VECTORS

   flashAPI :

   {

..\Debug\periphCode\source\Fapi_UserDefinedFunctions.obj (.text)

..\Debug\Code\FlashAPI.obj (.text)

--library= F021_API_CortexR4_BE.lib < FlashStateMachine.IssueFsmCommand.obj

  FlashStateMachine.SetActiveBank.obj

  FlashStateMachine.InitializeFlashBanks.obj

  FlashStateMachine.EnableMainSectors.obj

  FlashStateMachine.IssueFsmCommand.obj

  FlashStateMachine.ScaleFclk.obj

                                      Init.obj

                                      Utilities.CalculateEcc.obj

                                      Utilities.WaitDelay.obj

                                      Utilities.CalculateFletcher.obj

                                      Read.MarginByByte.obj

                                      Read.Common.obj

                                      Read.FlushPipeline.obj

  Read.WdService.obj

                                      Async.WithAddress.obj

                                      Program.obj > (.text)

   } load = FLASH_API_LIB, run = RAM, LOAD_START(af_api_load), RUN_START(af_api_run), SIZE(af_api_size)

.axio_bl_magik : {} > BL_MAGIK

.appl_start    : {} > BL_MAGIK

    .text    : {} > FLASH0

    .const   : {} > FLASH0

    .cinit   : {} > FLASH0

    .pinit   : {} > FLASH0

    .stack : {} > STACKS

    .bss     : {} > RAM

    .data    : {} > RAM

.sysmem  : {} > RAM

FEE_TEXT_SECTION : {} > FLASH0

    FEE_CONST_SECTION : {} > FLASH0

    FEE_DATA_SECTION : {} > RAM

}

/* ECC Configuration                                                      */

ECC

{

    algoR4F021 : address_mask = 0x003ffff8 /* Address Bits 21:3 */

                 hamming_mask = R4         /* Use R4 build in Mask */

                 parity_mask  = 0x0c       /* Set which ECC bits are Even and Odd parity */

                 mirroring    = F021       /* RM4x and TMS570LSx are build in F021 */

}

Thank you,

Gustavo Del Valle

MEMORY{ VECTORS (X)  : origin=0x00000000 length=0x00000020 fill=0xffffffff
    BL_MAGIK (X)  : origin=(end(VECTORS))     length=0x00000040     vfill=0xffffffff
    FLASH_API_LIB (RX) : origin=(0x00040000)     length=0x00000E10     vfill=0xffffffff
    FLASH0 (RX) : origin=(end(FLASH_API_LIB))     length=(0x00040000 - size(FLASH_API_LIB))     vfill=0xffffffff
  FLASH7 (RX) : origin=0xF0200000   length=0x00010000   vfill=0xffffffff
RAM      (RW) : origin=0x08002000 length=0x0001E000
STACKS   (RW) : origin=0x08000000 length=0x00002000
/* Flash ECC Section */
// Bank 0 ECC    ECC_VEC  (R)  : origin=(0xf0400000 + (start(VECTORS) >> 3))     length=(size(VECTORS) >> 3)     ECC={ algorithm=algoR4F021, input_range=VECTORS }
ECC_BL_MAGIK (R) : origin=(0xf0400000 + (start(BL_MAGIK)  >> 3)) length=(size(BL_MAGIK)  >> 3) ECC={ algorithm=algoR4F021, input_range=BL_MAGIK }
ECC_FLASH_API (R)  : origin=(0xf0400000 + (start(FLASH_API_LIB)  >> 3)) length=(size(FLASH_API_LIB)  >> 3) ECC={ algorithm=algoR4F021, input_range=FLASH_API_LIB }
    ECC_FLASH0 (R)  : origin=(0xf0400000 + (start(FLASH0)  >> 3))     length=(size(FLASH0)  >> 3)     ECC={ algorithm=algoR4F021, input_range=FLASH0 }
// Bank 7 ECC    ECC_FLA7 (R)  : origin=0xF0100000     length=(size(FLASH7)  >> 3)     ECC={algorithm=algoR4F021, input_range=FLASH7 }
/* Flash ECC Section */
}
/*----------------------------------------------------------------------------*//* Section Configuration                                                      */
SECTIONS{   .intvecs : {} > VECTORS
   flashAPI :   { ..\Debug\periphCode\source\Fapi_UserDefinedFunctions.obj (.text) ..\Debug\Code\FlashAPI.obj (.text)
--library= F021_API_CortexR4_BE.lib < FlashStateMachine.IssueFsmCommand.obj   FlashStateMachine.SetActiveBank.obj   FlashStateMachine.InitializeFlashBanks.obj   FlashStateMachine.EnableMainSectors.obj   FlashStateMachine.IssueFsmCommand.obj   FlashStateMachine.ScaleFclk.obj                                       Init.obj                                       Utilities.CalculateEcc.obj                                       Utilities.WaitDelay.obj                                       Utilities.CalculateFletcher.obj                                       Read.MarginByByte.obj                                       Read.Common.obj                                       Read.FlushPipeline.obj   Read.WdService.obj                                       Async.WithAddress.obj                                       Program.obj > (.text)
   } load = FLASH_API_LIB, run = RAM, LOAD_START(af_api_load), RUN_START(af_api_run), SIZE(af_api_size)
.axio_bl_magik : {} > BL_MAGIK .appl_start    : {} > BL_MAGIK
    .text    : {} > FLASH0    .const   : {} > FLASH0    .cinit   : {} > FLASH0    .pinit   : {} > FLASH0
    .stack : {} > STACKS    .bss     : {} > RAM    .data    : {} > RAM .sysmem  : {} > RAM
FEE_TEXT_SECTION : {} > FLASH0    FEE_CONST_SECTION : {} > FLASH0    FEE_DATA_SECTION : {} > RAM}
/* ECC Configuration                                                      */ECC{    algoR4F021 : address_mask = 0x003ffff8 /* Address Bits 21:3 */                 hamming_mask = R4         /* Use R4 build in Mask */                 parity_mask  = 0x0c       /* Set which ECC bits are Even and Odd parity */                 mirroring    = F021       /* RM4x and TMS570LSx are build in F021 */}

  • Hello,

    What is the error of "FlashECCReal"? Which bit in ESM register is set?
    Can you use the TI CCS to generate ECC and program the ECC?
  • Hi QJ,

    Thank you for your response! 

    The ESM register bit that is set high is Stat3 (ESMSR3) and is set to 0x00000080.

    When using CCS to generate ECC, I removed all ECC configurations from my linker file and enabled 'Auto ECC Generation' in CCS (and removed verification flags). After loading I cycled power to the unit, reconnected to CCS debugger and the same ESMSR3 bit was set.

    Regards,

    Gustavo Del Valle

  • Hi QJ,

    Do you have any ideas as to why I am seeing this? I have tried different scenarios but they all result with the same failure.

    Any help will be appreciated.

    Regards,

    Gustavo Del Valle
  • Hello Gustavo,

    As the device is coming out of the device reset sequence, the flash wrapper reads two configuration words from the TI OTP section of bank 0, the hardware configuration word at address 0xF0080140, and then the AJSM visible password at address 0xF0000000. During these reads ECC is enabled.

    Single bit errors are corrected and generate an ESM group 1 channel 6 error event. The first failing address will be latched in the FCOR_ERR_ADD register along with the bit position in FCOR_ERR_POS register and the FEDACSTATUS register flags will be updated to indicate the type of error.

    Uncorrectable errors will generate an ESM group 3 channel 7 error event, the ERROR pin will be activated, the first failing address will be latched in the FUNC_ERR_ADD register and the FEDACSTATUS register flags will be updated to indicate the type of error.

    If the error in your case is cased by reading OTP and AJSM, your code should be stuck at for(;;) in sys_startup.c.
  • Hi QJ, 

    Thank you for the response. Running the debugger, the code is stopping at 'for(;;)' under ESM group 3 (esmREG->SR1[2]) with FUncErrAddr = 0x00000100 and FEDacStat = 0x00000100.

    It is an uncorrectable error but I am unable to read the data of that address. I am not sure what is causing this uncorrectable error -  is it the linker file?

    Thanks,

    Gustavo Del Valle

  • Hello Gustavo,

    Let's take a look at your memory setting in linker cmd file:

    MEMORY {
    VECTORS (X) : origin=0x00000000 length=0x00000020 fill=0xffffffff
    BL_MAGIK (X) : origin=(end(VECTORS)) length=0x00000040 vfill=0xffffffff
    FLASH_API_LIB (RX) : origin=(0x00040000) length=0x00000E10 vfill=0xffffffff
    FLASH0 (RX) : origin=(end(FLASH_API_LIB)) length=(0x00040000 - size(FLASH_API_LIB)) vfill=0xffffffff
    FLASH7 (RX) : origin=0xF0200000 length=0x00010000 vfill=0xffffffff
    RAM (RW) : origin=0x08002000 length=0x0001E000
    STACKS (RW) : origin=0x08000000 length=0x00002000
    }

    There are a big hole from 0x60 to 0x40000. The ECC value for this flash region is 0xFF (after erased) which is not the correct ECC value for the flash content of 0xFFFFFFFF. The address of the ECC error is also located in this region.

    Please calculate the ECC for this region (0x60 to 0x40000) in linker cmd file too. Thanks
  • Hi QJ,

    Thank you for the response. I had updated the ECC for that region but the issue was with the F021 flash write operations. I do have another question:

    Is it possible to have a bootloader having flash ECC enabled?If so, wow would I go about setting up the linker file in the firmware and the bootloader? These are the questions I have:

    a. Since ECC needs to be calculated on the entire range of the flash, I am wondering how the linkers are set up/how would they look on the firmware side and bootloader side.

    b. Since the entire flash needs to have ECC my generated bin file is quite large.

    Thank you,

    Gustavo Del Valle

  • Hello Gustav,

    I'd like to know why you use linker file to generate ECC?
  • Hi QJ,

    I started using the linker to generate ECC as I thought there would be more control over which areas of the flash could have ECC. Would using the auto-ECC generation of CCS be the better option? Would the ECC still be calculated over the entire flash?

    Thanks,

    Gustavo Del Valle

  • Thanks Gustavo,

    You can use either linker cmd or F021 API to generate the ECC for bootloader and aplication (or firmware). It's not possible to use both Linker Generated ECC and F021 API generated ECC at the same time.

    The linker command file specifies a memory range for the ECC. You don't have to calculate for the whole flash. For example, you can use linker cmd file to generate ECC for first 4 sectors for bootloader; and remianing sectors for firmware.