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.

TMS570LS3137: How to store data to a specified memory?

Part Number: TMS570LS3137

Hi team,

Here's some issues from the customer may need your help:

The customer would like to know how to store data to a specified memory, as the following codes show, no memory allocated to variable mydata0.

The code is as follows:

/*----------------------------------------------------------------------------*/
/* Linker Settings */

--retain="*(.intvecs)"

/* USER CODE BEGIN (1) */
/* USER CODE END */

/*----------------------------------------------------------------------------*/
/* Memory Map */

MEMORY
{
VECTORS (X) : origin=0x00000000 length=0x00000020
FLASH0 (RX) : origin=0x00000020 length=0x0017FFE0
FLASH1 (RX) : origin=0x00180000 length=0x00180000
STACKS (RW) : origin=0x08000000 length=0x00001500
RAM (RW) : origin=0x08001500 length=0x0003EB00
MY_NEW_RAM (RW) : origin=0x08040000 length=0x00001000


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

/* USER CODE BEGIN (3) */
/* USER CODE END */


/*----------------------------------------------------------------------------*/
/* Section Configuration */

SECTIONS
{
.intvecs : {} > VECTORS
.text : {} > FLASH0 | FLASH1
.const : {} > FLASH0 | FLASH1
.cinit : {} > FLASH0 | FLASH1
.pinit : {} > FLASH0 | FLASH1
.bss : {} > RAM
.data : {} > RAM
.my_data : {} > MY_NEW_RAM
.sysmem : {} > RAM

FEE_TEXT_SECTION : {} > FLASH0 | FLASH1
FEE_CONST_SECTION : {} > FLASH0 | FLASH1
FEE_DATA_SECTION : {} > RAM

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

/* USER CODE BEGIN (5) */
/* USER CODE END */


/*----------------------------------------------------------------------------*/
/* Misc */

/* USER CODE BEGIN (6) */
/* USER CODE END */
/*----------------------------------------------------------------------------*/

////////////The program code is as follows /////////////////////////////////////////////////////////


#pragma SET_DATA_SECTION("my_data")


int mydata0 = 0;


#pragma SET_DATA_SECTION()

Could you help check this case? Thanks.

Best Regards,

Cherry

  • Hi Cherry,

    The section name in linker cmd file is different from the section name you defined in your c file:

    Linker:

    .my_data : {} > MY_NEW_RAM --- there is on dot before my_data

    In C file:

    ("my_data")  --- no dot before my_data

    You should use either .my_data or my_data in bother places.