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.

TMS320F2837xD copy ISR function to RAM & execution

Hi,

I'm planning to copy IPC ISR function to RAM for fast execution.

Using codesection, can i do it for ISR function?

I felt that IPC ISR funtion will take more time to execute it from flash. So can any one suggest me whether i can do it for TMS320F2837xD  target.

regards

Aditya

  • Hi,

    I think that you can. But you will need to modify the linker script, unless you already have a ramfuncs section in it.

    This is how it is done:
    linker script:

    SECTIONS {
    ...
    ramfuncs :
    LOAD = YOUR_FLASH_SECTOR_NAME,
    RUN = YOUR_RAM_SECTOR_NAME,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    PAGE = 0
    ...
    }

    application code:

    extern Uint16 RamfuncsLoadStart;
    extern Uint16 RamfuncsLoadEnd;
    extern Uint16 RamfuncsRunStart;

    void MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr)
    {
    while(SourceAddr < SourceEndAddr)
    {
    *DestAddr++ = *SourceAddr++;
    }
    return;
    }

    void main(void)
    {
    MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
    }
  • In linker cmd file, i have already ramfuncs section in it. But it is used for Delay & Flashinit function. In cmd file , ramfuncs is as below.
    ramfuncs : LOAD = FLASHD,
    RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_SIZE(_RamfuncsLoadSize),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    RUN_SIZE(_RamfuncsRunSize),
    RUN_END(_RamfuncsRunEnd),
    PAGE = 0, ALIGN(4)

    Can i use the same for my ISR function? will it overlap with the exiting function?

    How can i get YOUR_FLASH_SECTOR_NAME for my function?

    regards
    Aditya
  • Hi

    How can i get YOUR_FLASH_SECTOR_NAME for my function?

    I mean, can i use FLASHD for my ISR function as "YOUR_FLASH_SECTOR_NAME"? or i need to use different Flash sector?


    Regards

    Aditya

  • Hi,

    You can use the same section for your ISR. Place this in front of your ISR:
    #pragma CODE_SECTION(ISR_FUNCTION_NAME,"ramfuncs");

    You do not have to modify your linker file at all. (Unless, of course, you run out of space in one of the sections, but the linker will complain about that with red text...)

    BR,
    J
  • Thank you Szeman.. I will check it out.

    regards
    Aditya