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: FO21,Fapi_Erase Sector of bank0 failed

Part Number: TMS570LS3137

Hello, 

We are developing the bootloader using TMS570LS3137 and found that in the bootloader:

Fapi_issueAsyncCommandWithAddress (Fapi_EraseSector, flash_sector [sectornum]. Start);

this function can erase bank1 sector, However, it is not possible to erase a sector in bank0, for example, when erasing sector10 in bank0, the system will make an error in erasing the sector.

1. The erasing function is as follows:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const SECTORS flash_sector[NUMBEROFSECTORS]=
{
(void *)0x00000000, 0x08000, 0, 0, 0xfff87000,
(void *)0x00008000, 0x08000, 0, 1, 0xfff87000,
(void *)0x00010000, 0x08000, 0, 2, 0xfff87000,
(void *)0x00018000, 0x08000, 0, 3, 0xfff87000,
(void *)0x00020000, 0x20000, 0, 4, 0xfff87000,
(void *)0x00040000, 0x20000, 0, 5, 0xfff87000,
(void *)0x00060000, 0x20000, 0, 6, 0xfff87000,
(void *)0x00080000, 0x20000, 0, 7, 0xfff87000,
(void *)0x000A0000, 0x20000, 0, 8, 0xfff87000,
(void *)0x000C0000, 0x20000, 0, 9, 0xfff87000,
(void *)0x000E0000, 0x20000, 0, 10, 0xfff87000,
(void *)0x00100000, 0x20000, 0, 11, 0xfff87000,
(void *)0x00120000, 0x20000, 0, 12, 0xfff87000,
(void *)0x00140000, 0x20000, 0, 13, 0xfff87000,
(void *)0x00160000, 0x20000, 0, 14, 0xfff87000,
(void *)0x00180000, 0x20000, 1, 0, 0xfff87000,
(void *)0x001A0000, 0x20000, 1, 1, 0xfff87000,
(void *)0x001C0000, 0x20000, 1, 2, 0xfff87000,
(void *)0x001E0000, 0x20000, 1, 3, 0xfff87000,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

2. Link configuration is as follows:

MEMORY
{
    VECTORS         (X)          : origin=0x00000000 length=0x00000100
    FLASH_API   (RX)          : origin=0x00010000 length=0x00010000
    FLASH0                 (RX)         : origin=0x00020000 length=0x00040000

    STACKS          (RW)         : origin=0x08000000 length=0x00009000
    RAM_F201API (RW)         : origin=0x08009000 length=0x00003000
    RAM             (RW)         : origin=0x0800C000 length=0x00033F00
    USERDEFINE        (RW)         : origin=0x0803FF00 length=0x00000100        //GET_COREREG_ADDR用户自定义使用的内存段
}

 SECTIONS
{
    .intvecs : {} > VECTORS

   flashAPI :
   {
     Fapi_UserDefinedFunctions.obj (.text)
     bl_flash.obj (.text)
     --library= ..\lib\F021_API_CortexR4_BE.lib (.text)
   } load = FLASH_API, run = RAM_F201API, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)

    .text    : {} > FLASH0
    .const   : {} > FLASH0
    .cinit   : {} > FLASH0
    .pinit   : {} > FLASH0
    .bss     : {} > RAM
    .data    : {} > RAM
    .sysmem  : {} > RAM
}

3. The function _copyAPI2RAM_() is also called in void _c_int00(void)。

4. When erasing bank0 sector, the following error message is displayed

  • Hi Shunyun,

    Can you check if the flash APIs have been copied to SRAM starting at api_run?

    Please add .data section to the following statements in your cmd file:

      flashAPI :
       {
         Fapi_UserDefinedFunctions.obj (.text)
         bl_flash.obj (.text, .data)
         --library= ..\lib\F021_API_CortexR4_BE.lib (.text, .data)
       } load = FLASH_API, run = RAM_F201API, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)

  • Hi Shunyun,

    Just noticed that the flash section from 0x100 to 0x10000 is not used in your cmd file.

    VECTORS         (X)          : origin=0x00000000 length=0x00000100
    FLASH_API   (RX)          : origin=0x00010000 length=0x00010000
    FLASH0                 (RX)         : origin=0x00020000 length=0x00040000

    This will generate a big hole without any data and valid ECC. 

    Can you try those modifications:

    MEMORY
    {
        VECTORS         (X)          : origin=0x00000000 length=0x00000020
        FLASH0             (RX)       : origin=0x00000020 length=0x00080000 - 0x20
        STACKS          (RW)         : origin=0x08000000 length=0x00009000
        RAM_F201API (RW)         : origin=0x08009000 length=0x00003000
        RAM             (RW)         : origin=0x0800C000 length=0x00033F00
        USERDEFINE        (RW)         : origin=0x0803FF00 length=0x00000100        //GET_COREREG_ADDR用户自定义使用的内存段
    }

     SECTIONS
    {
        .intvecs : {} > VECTORS

       flashAPI :
       {
         Fapi_UserDefinedFunctions.obj (.text)
         bl_flash.obj (.text, .data)
         --library= ..\lib\F021_API_CortexR4_BE.lib (.text, .data)
       } load = FLASH0, run = RAM_F201API, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)

        .text    : {} > FLASH0
        .const   : {} > FLASH0
        .cinit   : {} > FLASH0
        .pinit   : {} > FLASH0
        .bss     : {} > RAM
        .data    : {} > RAM
        .sysmem  : {} > RAM
    }