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.

TMS320F280049: Problems using ROM Flash API Lib

Part Number: TMS320F280049
Other Parts Discussed in Thread: C2000WARE

Hi Engineers,

I am currently working on an Application on TMS320F28004x using Flash API. I would like to use the version embedded in Boot ROM.
The F021_ROM_API_F28004x_FPU32.lib I already included in my project. The Mapfile knows the symbols with locations that reside in BOOT ROM:

I wrote a very simple Program for testing Flash API on F280049 Control Card. Unfortunately, my program crashes to ILLEGAL ISR just when executing the LCR Instruction to jump to Boot ROM.
My question is: Did I forget a setting in my Code to be able to branch to BOOT ROM?

// Included Files
//
#include "F28x_Project.h"
#include "F021_F28004x_C28x.h"

//
// Defines
//
#define DEVICE_GPIO_PIN_LED1    31

void Example_CallFlashAPI(void);

//
// Main
//
void main(void)
{
    //
    // Initialize device clock and peripherals
    //
    InitSysCtrl();

    //
    // Initialize GPIO and configure the GPIO pin as a push-pull output
    //
    InitGpio();
    GPIO_SetupPinMux(DEVICE_GPIO_PIN_LED1, GPIO_MUX_CPU1, 0);
    GPIO_SetupPinOptions(DEVICE_GPIO_PIN_LED1, GPIO_OUTPUT, GPIO_PUSHPULL);

    //
    // Initialize PIE and clear PIE registers. Disables CPU interrupts.
    //
    DINT;
    InitPieCtrl();
    IER = 0x0000;
    IFR = 0x0000;

    //
    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    //
    InitPieVectTable();

    //
    // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
    //
    EINT;
    ERTM;

    //
    // Loop Forever
    //

    Example_CallFlashAPI();
    for(;;)
    {
        //
        // Turn on LED
        //
        GPIO_WritePin(DEVICE_GPIO_PIN_LED1, 0);

        //
        // Delay for a bit.
        //
        DELAY_US(500000);

        //
        // Turn off LED
        //
        GPIO_WritePin(DEVICE_GPIO_PIN_LED1, 1);

        //
        // Delay for a bit.
        //
        DELAY_US(500000);
        //Example_CallFlashAPI();
    }
}

// Function for using Flash API

#pragma CODE_SECTION(Example_CallFlashAPI, "ramgs2");
void Example_CallFlashAPI(void)
{
    Fapi_StatusType oReturnCheck;
    Fapi_FlashStatusType oFlashStatus;
    Fapi_FlashStatusWordType oFlashStatusWord;

    EALLOW;

    // Flash API must be initialized once on startup
    oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 100);

    if(oReturnCheck != Fapi_Status_Success)
    {
        // Emit Error
        //Example_Error(oReturnCheck);
    }
}


Best regards, Chris

  • Chris,

    Please check your linker cmd file.  Maybe you assigned/grouped the ROM API lib with .TI.ramfunc with a RAM execution address - That should not be done.  If you do so, the control will go to RAM (RUN address allocated for .TI.ramfunc) and end up in ITRAP.

    Thanks and regards,
    Vamsi

  • Hi Vamsi,
    thank you for your reply. My linker cmd file seems to be okay since ROM API must not be relocated in any section in linker cmd file according to TIs Examples provided in C2000Ware.
    We only need this reserved section in RAM for ROM Flash API:

    BOOT_RSVD       : origin = 0x000002, length = 0x0000F3     /* Part of M0, BOOT rom will use this for stack */
       RAMM1           : origin = 0x000400, length = 0x000360     /* on-chip RAM block M1 */
       FLASH_API_ROM_RSVD : origin = 0x760, length = 0x000020     /* Required by Flash API from ROM */

    I think the solution is, that my control card simply seems to have the first revision of F28004x on it which does NOT have the Flash API functions in Boot ROM. Unfortunately, TI does not provide this (important) information in any official document such as data sheet or Flash API manual, but somewhere deep in C2000Ware in a header comment of a Flash Example Sourcefile :( Found this out yesterday.

    But another question regarding your explanations concerning .TI.ramfunc: You said that ROM API lib must not be grouped into .TI.ramfunc. My question is: Is it okay to do so with the functions that are calling the rom api lib functions?
    I am actually facing some strange behavior where I grouped a function which calls ROM flash API, into .TI.ramfunc. Then the device does somehow produce runtime errors where SPI bus does not seem to work properly anymore (this errors also occur, if flash api is not even called!). If I put the function into lets say ramgs0, I do not have any problem. Is it a general problem to use rom flash api in .TI.ramfunc? But if so, I wonder why this seems to work in C2000Ware example flashapi_ex1_program_autoecc.

    Best regards, Chris

  • Chris,

    We have an errata advisory "ROM: Flash API Library and FPU32 Twiddle Factor RFFT Table Not Present" to indicate that the flash API is not present in ROM for certain revisions of the silicon.

    Regarding your ROM API lib mapping question: I will review it and get back to you early next week.

    Thanks and regards,
    Vamsi

  • Chris,

    When the flash API is used to program both the flash banks:  Functions calling ROM flash API should be mapped to .TI.ramfunc and copied to RAM using memcpy() before those functions are called in the application.  

    When the flash API is used to program only one of the flash banks:  Functions calling ROM flash API can be mapped to the flash bank on which the flash erase/program operations are not targeted.

    Regarding the problem you mentioned:  Maybe you did not call memcpy()?  Please check.

    Thanks and regards,
    Vamsi        

  • Vamsi,
    thank you for your replies!
    I definitely called memcpy directly at the beginning of main{}.
    It works now, I defined a new Load&Run-Section .TI.ramfunc3 using a completely separate RAM sector and a dedicated Flash sector. I cannout figure out, why this works now - but it does.

    Best regards, Chris

  • Chris,

    Glad it is working now.  Let me know if I can close this post.  

    Thanks and regards,

    Vamsi