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.
Hi,
I am using the TMS570LS31x HDK with a TMS570LS3137 MCU. I will be performing a radiation test for SEUs in the SRAM. Obviously I can track
the detected errors from the internal ECC mechanism. But I want to write a pattern into the SRAM and then read it out. For this purpose, I need to know
how the loader/linker place the code in SRAM, so that I don't overwrite on used address space. It is important to know exactly where the code is placed on the SRAMs as
I want to use physical addresses in the program. Also I need to know the amount of SRAM used during execution of a program.
Any advice on these issues will be very helpful
Regards,
Pritesh
Pritesh,
The way the linker is using your internal RAM is defined by your linker command file. Here is an example.
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=0x00026B00
/* USER CODE BEGIN (2) */
/* USER CODE END */
}
/* USER CODE BEGIN (3) */
/* USER CODE END */
/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS
{
.intvecs : palign(32), fill =0xffffffff {} > VECTORS
.text : palign(32), fill =0xffffffff {} > FLASH0 | FLASH1
.const : palign(32), fill =0xffffffff {} > FLASH0 | FLASH1
.cinit : palign(32), fill =0xffffffff {} > FLASH0 | FLASH1
.pinit : palign(32), fill =0xffffffff {} > FLASH0 | FLASH1
.bss : {} > RAM
.data : {} > RAM
/* USER CODE BEGIN (4) */
/* USER CODE END */
}
The memory section of the linker command file specifies regions and types. In this example the name RAM, STACKS, FLASH1 are just label and you can create your own. For example, instead of defining 1 single RAM region you can split it in 3 as following:
RAM (RW) : origin=0x08001500 length=0x00026B00
RAM1 (RW) : origin=0x08001500 length=0x00010000
RAM2 (RW) : origin=0x08011500 length=0x00010000
RAM2 (RW) : origin=0x08021500 length=0x00006B00
The second main part of the linker command file is the SECTIONS.
In this example all the bss and data section of your application will be mapped in the RAM region. Using my example it can be changed to:
.bss : {} > RAM1
.data : {} > RAM2
It is also possible to specify the mapping of a specific section from a specific file to a specific region.
.text : palign(32), fill =0xffffffff {} > FLASH0 | FLASH1
.text1 : palign(32), fill =0xffffffff {can.obj (.text)} > FLASH2
Here, all the text section (code) will be mapped to region FLASH0 or FLASH1.
The text section from the file can.obj will be mapped to region FLASH2.
To see and verify that your application is mapped the way you want, you can open and check the .map file (in the debug directory)
Please let me know if I've covered your question.
Hi Jean,
Thank you for your answer. My first question was completely answered. I repeat my second question.
Is there a way to find out how much maximum space is used by a running program or a program which will run on the "stack" on the SRAM?
This is necessary, as I don't want to assign less than the space required to this section and then the program crashes unexpectedly during some run.
Regards,
Pritesh