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.

How to Direct addressing mode in C file

Other Parts Discussed in Thread: TMS320F28335

Dear All,

I am using TMS320F28335 controller in my project i am doing RAM copy (i.e. FLASH to RAM ). 

After coming to the Main i want to go 0x00317E00 address location.

Wd_Disable --> RAM copy --> _cint00 --> main()

                                                                           {

                                                                                 -----

                                                                                 -----

                                                                               jump to 0x00317E00 

                                                                             }

Please give instructions how to jump this address location(it was in .c file).

  • Rakesh,

    I'm not certain on why you want to do this, but I speculate you have two different CCS projects in flash?  Otherwise, why wouldnt' you use a label and do a C call or goto?

    If you're trying to link together two different code projects, you can jump using inline assembly:

    asm(" LB 0x00317E00");

    Note that there is a space before the LB.  You must have a space.

    Regards,

    David

  • M. Alter

    Your thinking is correct i have two software's one is in Flash Sector F,another one is in Flash Sector E.

    Depends on version number i have to excute corresponding software but before going to latest software i have to do RAM copy(i.e Flash to Ram )  for this Ram copying i have given specific address location for initialized sections( .cinit,.const ....)

    Your given instruction is working good but in user guides mention don't use Jump and Call instructions in assembly inline function.

    I am thinking in future it may be problem so Any other possibility ? or shall i continue?

    Regards,

    Rakesh D

  • Rakesh,

    I guess I'm still not clear on why a copy from RAM to flash would require you to jump to a specific address.  You may have some hard addresses for .cinit, .const, etc., but what does that have to do with your program execution?

    Rakesh Dara said:

    Your given instruction is working good but in user guides mention don't use Jump and Call instructions in assembly inline function.

    I am thinking in future it may be problem so Any other possibility ? or shall i continue?

    Inline assembly is in general always a risky thing to do.  You risk upsetting the C environment.  You need to be careful when using inline assembly and make sure you know what you are doing.  That is what the user's guide is really saying.  We don't want people putting inline jumps and calls in their C code, and then they recompile and find that things are not in memory where they used to be.  In your case, you apparently have a known, hard address that you want to jump to (or call), so use of inline assembly is OK.

    You may want to look at Chapter 4 of appnote SPRA958.  It talks about copying sections from flash to RAM using linker relocatable symbols.  I'm not sure if it applies in your case, as I'm not clear on exactly why you're doing what you're doing.  But, you should take a look and see.

    http://www.ti.com/mcu/docs/litabsmultiplefilelist.tsp?sectionId=96&tabId=1502&literatureNumber=spra958l&docCategoryId=1&familyId=1414

    Regards,

    David

  • Usual C way of calling an function with a specified address:

    typedef void (*FNCPTR)(void);
    
    int main(int argc, char *argv[])
    {
      ...
      FNCPTR fnc = (FNCPTR)0x00317E00;
      ...
      fnc();
      ...
    }

    Assumes fnc is function takes no arguments and returns nothing. Never used the C2000. Can say if it will work with compiler.