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.

TMS320F28377D: Question about FlashAPI

Part Number: TMS320F28377D
Other Parts Discussed in Thread: C2000WARE

Hi team:

The customer's project is divided into bootloader and app, Bootloader in FLASH A-D and APP in Flash E-K.

Program can work normally when use JTAG to debug, but after loading program into flash and run, it can't run normally.

It seems that customer has copied the code from flash to RAM:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
memcpy(&RamfuncsFapiRunStart, &RamfuncsFapiLoadStart, (size_t)&RamfuncsFapiLoadSize);
CMD
.TI.ramfuncFapi : {
--library=../F2837xD_flashapi/lib/F021_API_F2837xD_FPU32.lib
}
LOAD = FLASHG,
RUN = RAMD1,
RUN_START(_RamfuncsFapiRunStart),
LOAD_START(_RamfuncsFapiLoadStart),
LOAD_SIZE(_RamfuncsFapiLoadSize),
PAGE = 0, ALIGN(4)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

But the project still has this problem.

Best regards,

Green

  • Something additional:

    CCS Version: 11.0.0.00012, SDK Version: C2000Ware_4_00_00_00

    Memcpy code

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    #ifdef _FLASH
    //
    // Copy time critical code and flash setup code to RAM. This includes the
    // following functions: InitFlash();
    //
    // The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart symbols
    // are created by the linker. Refer to the device .cmd file.
    //
    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
    memcpy(&RamfuncsFapiRunStart, &RamfuncsFapiLoadStart, (size_t)&RamfuncsFapiLoadSize);
    memcpy(&RamfuncsFpuRunStart, &RamfuncsFpuLoadStart, (size_t)&RamfuncsFpuLoadSize);
    memcpy(&RamfuncsUserRunStart, &RamfuncsUserLoadStart, (size_t)&RamfuncsUserLoadSize);
    //
    // Call Flash Initialization to setup flash waitstates. This function must
    // reside in RAM.
    //
    Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, DEVICE_FLASH_WAITSTATES);
    #endif
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Flash initialize and call Erase\Write function:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /*
    * BswEep.c
    *
    * Created on: 2022��4��5��
    * Author: Thinkpad-T14
    */
    #include "Includes.h"
    #pragma CODE_SECTION(BswEep_init, ".User.ramfunc");
    uint16_t BswEep_init(void)
    {
    uint16_t ReturnValue=0;
    Fapi_StatusType oFapi_Status1,oFapi_Status2;
    Flash_claimPumpSemaphore(FLASHPUMPSEMAPHORE_BASE, FLASH_CPU1_WRAPPER);
    EALLOW;
    oFapi_Status1 = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, DEVICE_SYSCLK_FREQ/1000000);
    Flash_disableECC(FLASH0ECC_BASE);
    oFapi_Status2 = Fapi_setActiveFlashBank(Fapi_FlashBank0);
    Flash_enableECC(FLASH0ECC_BASE);
    EDIS;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Green,

    I will review and get back to you in couple of days.

    Thanks and regards,

    Vamsi

  • Hi Green,

    Please provide more details about your statement "but after loading program into flash and run, it can't run normally".

    Is there any specific error/status that you can provide to analyze?

    Thanks and regards,
    Vamsi

  • The rest of the programs are running normally, and the Fapi related functions will return error values.

    Such as executing:

    oFapi_Status = Fapi_issueProgrammingCommand(x,x,4,0,0,Fapi_AutoEccGeneration)

    The return value status is:

    Fapi_Error_Fail=500

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    typedef enum
    {
    Fapi_Status_Success=0, /* Function completed successfully */
    Fapi_Status_FsmBusy, /* FSM is Busy */
    Fapi_Status_FsmReady, /* FSM is Ready */
    Fapi_Status_AsyncBusy, /* Async function operation is Busy */
    Fapi_Status_AsyncComplete, /* Async function operation is Complete */
    Fapi_Error_Fail=500, /* Generic Function Fail code */
    Fapi_Error_StateMachineTimeout, /* State machine polling never returned ready and timed out */
    Fapi_Error_OtpChecksumMismatch, /* Returned if OTP checksum does not match expected value */
    Fapi_Error_InvalidDelayValue, /* Returned if the Calculated RWAIT value exceeds 15 - Legacy Error */
    Fapi_Error_InvalidHclkValue, /* Returned if FClk is above max FClk value - FClk is a calculated from HClk and RWAIT/EWAIT */
    Fapi_Error_InvalidCpu, /* Returned if the specified Cpu does not exist */
    Fapi_Error_InvalidBank, /* Returned if the specified bank does not exist */
    Fapi_Error_InvalidAddress, /* Returned if the specified Address does not exist in Flash or OTP */
    Fapi_Error_InvalidReadMode, /* Returned if the specified read mode does not exist */
    Fapi_Error_AsyncIncorrectDataBufferLength,
    Fapi_Error_AsyncIncorrectEccBufferLength,
    Fapi_Error_AsyncDataEccBufferLengthMismatch,
    Fapi_Error_FeatureNotAvailable /* FMC feature is not available on this device */
    } ATTRIBUTE_PACKED Fapi_StatusType;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Green,

    Were they able to execute the flash programming example in C2000Ware successfully?

    Thanks and regards,
    Vamsi