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.

Flash Programming - TMS470 Compiler

Hi,

I am using CCS IDE with TMS470 compiler for the TMS570 processor. As per my requirement, i need to store the 3K bytes of configuration data to known location in Flash and the start address is 0x00008000. I have declared a structure to define my config data. How do i direct the compiler to store this struture to Flash on the required start address ? And the data elements in the structre should be stored continuosly. There should not be any holes in between. Let me know how can i proceed on this.

Suggestions are welcome.

  • Bindu,

    The #pragma DATA_SECTION can be used to place variables in a particular named section, and then you can control the allocation of that section to a specific memory address using the linker command file. You would also want to use the "const" keyword when declaring your structure to indicate that it is not modifiable since you want it to be placed in Flash. The TMS470 Compiler Users Guide has details on the #pragmas and the Assembly Language Tools Users Guide has information on linker control files and specifying allocation of user section.

     

  • Thanks Aarthi.

    I tried as below in the source file.

    #pragma DATA_SECTION (Config1 , ".config" )
    struct Config_Data Config1;

    And updated the linker command file to create config section

    SECTIONS
    {
        .intvecs : {} > VECTORS
        .text    : {} > FLASH0 | FLASH2 | FLASH3
        .const   : {} > FLASH0 | FLASH2 | FLASH3
        .cinit   : {} > FLASH0 | FLASH2 | FLASH3
        .pinit   : {} > FLASH0 | FLASH2 | FLASH3
        .config  : {} > FLASH1
        .bss     : {} > RAM
        .data    : {} > RAM

    /* USER CODE BEGIN (4) */
    /* USER CODE END */
    }

    I am able to see that Config1 structure is stored in the flash section that i need. Is that correct ? or any other suggestion ? If i want to store the struture in the specific memory location in the Config section, how can i do that ?

    I am seeing the padding is happening struture allocation. Is there any option in the compiler to diable the padding during memory allocation for structure ?

    Let me know.

  • Bindu Tanguturi said:
    If i want to store the struture in the specific memory location in the Config section, how can i do that ?

    You can allocate a section to an absolute address instead of a memory region. 
      .config  : {} > 0x8000

    Also, if this is the only section allocated to that region, it will already begin at the origin address of the region.

    Bindu Tanguturi said:

    I am seeing the padding is happening struture allocation. Is there any option in the compiler to diable the padding during memory allocation for structure ?

    You can use the "packed" variable attribute. Note that it is currently supported only on Cortex devices (A8, R4, M3, M4). Please see the TMS470 Compiler Users Guide, section 5.16.3.