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: code memory available

Part Number: TMS320F280049

I need to have  the first twelve Flash memory Bank0 sectors available for code, this is the line in the link file:

.text : >>FLASH_BANK0_SEC0 | FLASH_BANK0_SEC1 | FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4 | FLASH_BANK0_SEC5 | FLASH_BANK0_SEC6
              | FLASH_BANK0_SEC7 | FLASH_BANK0_SEC8 | FLASH_BANK0_SEC9 | FLASH_BANK0_SEC10 | FLASH_BANK0_SEC11
              | FLASH_BANK0_SEC12  , PAGE = 0, ALIGN(4)

is it correct ?

My code has several routines and modules, in what way the linker place the module and routines in the available sectors ?

Thank you.

  • Hi Luigi,

    Our flash expert is currently out of office. He will return next week. Please expect a reply by Tuesday at the latest

    Regards,

    Peter

  • Hello Luigi,

    Your syntax looks correct, assuming the FLASH_BANK_SECx memory sections are properly defined in the MEMORY portion of the linker command file.

    The linker will use an internal algorithm to place code functions in such a way as to minimize memory fragmentation. However, you can always override the placement order or specify a specific location for certain symbols by adding linker command file directives. For more information on the various ways to accomplish this, please review chapter 8 of the C28x Assembly Language Tools Guide.

  • Thank you Ibukun,

    I have some problems compiling my code and I donn't know the reason; for example adding routines into a module (source code .c) it happens that the code freezes, no error message from compiler or linker.

    To solve the issue I have to place the routines in another module; I suppose that the compiled code exceeds the size of the segment...but it's strange that the linker doesn't generate any errors...

    Another problem comes with a timer interrupt routine, very simple routine:

    //Interrupt routine for Timer0
    __interrupt void Timer0isr(){

             GPIO_writePin(11,1);

             ad_flg=1;
             tmr0cnt--;                                                                                //Decrease timer count
             if(tmr0cnt<0)
                          tmr0cnt=0;

             Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);

             GPIO_writePin(11,0);
             }

    The code works good only if I don't insert the two GPIO instructions; inserting the GPIO instructions the code freezes.

    ***** This is my .cmd, I didn't add the FLASH_BANK0_SEC0 at the ".text" SECTION; this avoids the freeziing...*****

    MEMORY
    {
    PAGE 0 :
    /* BEGIN is used for the "boot to Flash" bootloader mode */

    BEGIN : origin = 0x080000, length = 0x000002
    RAMM0 : origin = 0x0000F5, length = 0x00030B

    RAMLS0 : origin = 0x008000, length = 0x000800
    RAMLS1 : origin = 0x008800, length = 0x000800
    RAMLS2 : origin = 0x009000, length = 0x000800
    RAMLS3 : origin = 0x009800, length = 0x000800
    RAMLS4 : origin = 0x00A000, length = 0x000800
    RESET : origin = 0x3FFFC0, length = 0x000002

    /* Flash sectors */
    /* BANK 0 */
    FLASH_BANK0_SEC0 : origin = 0x080002, length = 0x000FFE /* on-chip Flash */
    FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC2 : origin = 0x082000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC3 : origin = 0x083000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC4 : origin = 0x084000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC5 : origin = 0x085000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC6 : origin = 0x086000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC7 : origin = 0x087000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC8 : origin = 0x088000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC9 : origin = 0x089000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000 /* on-chip Flash */

    /* BANK 1 */
    FLASH_BANK1_SEC0 : origin = 0x090000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC1 : origin = 0x091000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC2 : origin = 0x092000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC3 : origin = 0x093000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC4 : origin = 0x094000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC5 : origin = 0x095000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC6 : origin = 0x096000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC7 : origin = 0x097000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC8 : origin = 0x098000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC9 : origin = 0x099000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC10 : origin = 0x09A000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC11 : origin = 0x09B000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC12 : origin = 0x09C000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC13 : origin = 0x09D000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC14 : origin = 0x09E000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK1_SEC15 : origin = 0x09F000, length = 0x001000 /* on-chip Flash */

    PAGE 1 :

    BOOT_RSVD : origin = 0x000002, length = 0x0000F3 /* Part of M0, BOOT rom will use this for stack */
    RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */

    RAMLS5 : origin = 0x00A800, length = 0x000800
    RAMLS6 : origin = 0x00B000, length = 0x000800
    RAMLS7 : origin = 0x00B800, length = 0x000800

    RAMGS0 : origin = 0x00C000, length = 0x002000
    RAMGS1 : origin = 0x00E000, length = 0x002000
    RAMGS2 : origin = 0x010000, length = 0x002000
    RAMGS3 : origin = 0x012000, length = 0x002000
    }


    SECTIONS
    {
    codestart : > BEGIN, PAGE = 0, ALIGN(4)
    .text : >> FLASH_BANK0_SEC1 | FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4 | FLASH_BANK0_SEC5 | FLASH_BANK0_SEC6
    | FLASH_BANK0_SEC7 | FLASH_BANK0_SEC8 | FLASH_BANK0_SEC9 | FLASH_BANK0_SEC10 | FLASH_BANK0_SEC11
    | FLASH_BANK0_SEC12 | FLASH_BANK0_SEC13 , PAGE = 0, ALIGN(4)

    .cinit : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
    .pinit : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
    .switch : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
    .reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */

    .stack : > RAMM1, PAGE = 1
    .ebss : >> RAMLS5 | RAMLS6 | RAMLS7 | RAMGS0 | RAMGS1 | RAMGS2 | RAMGS3 , PAGE = 1
    .esysmem : >> RAMLS5 | RAMLS6 | RAMLS7 | RAMGS0 | RAMGS1 | RAMGS2 | RAMGS3, PAGE = 1 //.esysmem : > RAMLS5, PAGE = 1
    .econst : >> FLASH_BANK0_SEC14 | FLASH_BANK0_SEC15, PAGE = 0, ALIGN(4)
    //.my_sect : > FLASH_BANK0_SEC15, PAGE = 0, ALIGN(4)
    ramgs0 : > RAMGS0, PAGE = 1
    ramgs1 : > RAMGS1, PAGE = 1

    .TI.ramfunc : {} LOAD = FLASH_BANK0_SEC1,
    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)

    }

    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */

    Some issues disappear if I don't use the FLASH_BANK0_SEC0 for the .text SECTION.

  • Luigi,

    It is not clear to me that the code freezing is necessarily caused by your linker map. Other factors you might want to consider:

    - Make sure your PLL/clock configuration is correct
    - Make sure your flash wait states are properly configured: at 100MHz, should be 4 wait states. Use the function Flash_initModule() to initialize the flash before configuring the PLL using SysCtl_setClock().
    - Compile your code with optimization turned off (-O0) initially. Sometimes optimization could cause issues with counter variables if they are not typed properly (e.g. use volatile for local counter variables)

    Regarding the GPIO instructions: is it possible that you have an interrupt enabled on the GPIO or something else connected to it, and writing to the pin is triggering a nested interrupt?

    Best regards,
    Ibukun