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.

TMS570LC0714 with flash F021 API

Hi,
 
I am working with the TMS570LC0714 Controller. I want to program a boot loader software which can erase and program the
flash bank 0. But I have problems to erase the flash area.
So what I know is that the fapi functions must run in RAM area if I want to erase flash section of bank 0.

The following points are showing what I have done:

1.) I use the controller without floating point unit, so I used the Lib "F021_API_CortexR4_BE.lib". Hope it is the right one.
2.) I adapted the Linker command file as followed:

    VECTORS    (X)  : origin=0x00000000 length=0x00000020
    FLASH_API  (RX) : origin=0x00000020 length=0x000014E0
    FLASH0     (RX) : origin=0x00001500 length=0x0001EB00
    STACKS     (RW) : origin=0x08000000 length=0x00001500
    RAM_API    (RWX): origin=0x08001500 length=0x0000EB00
    RAM        (RW) : origin=0x08010000 length=0x00010000
    AJSM       (RX) : origin=0xF0000000 length=0x00000010

    flashapi :
    {
     --library= F021_API_CortexR4_BE.lib (.text)
    } LOAD = FLASH_API, RUN = RAM_API, LOAD_START(FlashApi_LoadStart), RUN_START(FlashApi_RunStart), SIZE(FlashApi_LoadSize)

3.) I copied all Flash data into RAM before I want to erase the flash as followed:

void CopyApiFromFlashToRam(void) {

    uint32 size;
    uint32 i;
    size = (uint32)&FlashApi_LoadSize;

    for(i=0;i<size;i++)
    {
        ((char *)&FlashApi_RunStart)[i] =((char *)&FlashApi_LoadStart)[i];
    }
}

4.) My function to erase the flash is called Fapi_BlockErase (Flash area).
The following map file listing shows the Fapi functions with the corresponding Flash / RAM address.

000086d0  Fapi_BlockErase

All fapi functions are in RAM area, also the Fapi_serviceWatchdogTimer function.                   
08001c49  Fapi_calculateEcc                   
08001bc5  Fapi_calculateFletcherChecksum      
08001a55  Fapi_enableEepromBankSectors        
08001ad5  Fapi_enableMainBankSectors          
08001c5d  Fapi_getNumberOfBankSectors         
08001501  Fapi_initializeFlashBanks           
08001bfd  Fapi_issueAsyncCommandWithAddress   
080018dd  Fapi_issueProgrammingCommand        
08001c8c  Fapi_serviceWatchdogTimer           
08001761  Fapi_setActiveFlashBank             
00000794  FlashApi_LoadSize                   
00000020  FlashApi_LoadStart                  
08001500  FlashApi_RunStart

But it is still not erasing the flash. Any ideas ?

Best regards
bruno

  • Hi Bruno,

    You use the right F021 API library. Only copying the F021 APIs to RAM is not enough. The following functions should be copied to RAM too:

    1. Fapi_UserDefinedFunctions.obj
    2. functions who call the F021 APIs
  • Hi,

    I use the fash lib 02.01.01.

    I had a error in my program code. In my code I tried to erase Bank 0, sector 7 and I used the following code with the enum parmeter:

    enumStatus = Fapi_enableMainBankSectors(Fapi_FlashSector7);

    but it must be

    enumStatus = Fapi_enableMainBankSectors(0x0080u);

    Now I can erase the flash if I am using the debugger. But if I do that without a got an "prefetchEntry" and the NERROR Pins of the controller is activated.

    Any ideas ?

    Best regards

  • Hi,

    I solved my problem. In file "FapiFunctions.h" the user defined function is only:
    extern Fapi_StatusType Fapi_serviceWatchdogTimer(void);

    So I do not program the two other functions:
    Fapi_StatusType Fapi_setupEepromSectorEnable(void) and
    Fapi_StatusType Fapi_setupBankSectorEnable(void)

    because I want to have a program as short as possible. But of cause this functions are needed.

    Thanks and Regards