Hi,
I'm working with DM8148 EZSDK.
My question:
How can I specify that specific code or data will reside in the dsp's internal memory?
Thanks,
Gilad
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'm working with DM8148 EZSDK.
My question:
How can I specify that specific code or data will reside in the dsp's internal memory?
Thanks,
Gilad
Gilad,
I'm not on the EZSDK team, someone from that team should help you with any specifics related to your build environment. However, I can give you some general guidelines. There are three steps required for placing code/data in internal memory: 1) modify the memory to give you access to internal memory, 2) place your code/data in specific sections, 3) place your sections in internal memory.
1. Memory Map. Sometimes the default memory map is okay to use and sometimes you need to modify it. It depends on which memory you wish to use and how much you need. The DSP will often use internal memory as the physical backing store for the code/data caches. If you wish to use the same memory, you need to reconfigure the cache to use less memory; the same internal memory cannot be used for both at the same time.
Here is the default memory map for DM8148 (I'm not sure if the EZSDK changes this default memory map). This is the DSP view of internal memory. I get this from the XDCtools documentation at the following link:
http://rtsc.eclipse.org/cdoc-tip/ti/catalog/c6000/TMS320DM8148.html
/* Memory Map for ti.platforms.evmTI814X
*
* DSP Internal Memory
* ------------------------------------------------------------------------
* 1080_0000 - 1083_FFFF 4_0000 ( 256 KB) IRAM (L2 RAM/Cache)
* 10E0_0000 - 1080_7FFF 8000 ( 32 KB) L1PSRAM (L1P RAM/Cache)
* 10F0_0000 - 10F0_7FFF 8000 ( 32 KB) L1DSRAM (L1D RAM/Cache)
*/
Here is the default cache configuration (again, the EZSDK might change this).
L1P Cache: 32 KB
L1D Cache: 32 KB
L2 Cache: 0 KB
From this, you can see that all of L1P and L1D internal memory is used for cache, none is available for code/data. If you want to use L1P/L1D, you will need to reduce the cache sizes to make room for your code/data. However, the L2 cache is off, so all of L2 is available. If you just want to place code/data in L2 RAM, then you don't need to make any changes to the memory map.
If you need to change the memory map, you can either create a new platform project with the memory map you wish to use, or create a platform instance with the memory map you want. Here is an example of creating a platform instance.
Build.platformTable["ti.platforms.evmTI814X:dsp"] = {
externalMemoryMap: [
DSP_PROG: {
name: "DSP_PROG", space: "code/data", access: "RWX",
base: 0x8B000000, len: 0x2000000,
comment: "DSP Program Memory (32 MB)"
}
],
codeMemory: "DSP_PROG",
dataMemory: "DSP_PROG",
stackMemory: "DSP_PROG",
l1DMode: "16k",
l1PMode: "16k",
l2Mode: "0k"
};
This platform instance reduces the L1D and L1P caches to 16 KB. This opens up 16 KB of L1P and L1D internal memory. The cache takes from the top of internal memory, so the first 16 KB of each memory segment is available for you.
Tip. Rebuild your executable with this platform instance and look at the generated map file. You should see new internal memory sections called L1DSRAM and L1PSRAM.
2. Place code/data in sections. You will need to use compiler directives to place code/data into their own sections (TI tool chain). Here is an example which places an array called Data_buf into it's own section called .Data_buf.
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(Data_buf, ".Data_buf")
#endif
static Int Data_buf[Data_COUNT] = { 1, 2, 3, 4, 5 };
Here is an example which places a function called Server_run into it's own section called .Server_run.
#if defined(__TI_COMPILER_VERSION__)
#pragma CODE_SECTION(Server_run, ".Server_run")
#endif
Int Server_run(Void)
{
/* ... */
}
3. Place sections into memory. You will need to modify your application configuration script to place the .Data_buf and .Server_run sections into the appropriate memory segment. Here is an example which places these two sections in L2 RAM.
Program.sectMap[".Data_buf"] = new Program.SectionSpec();
Program.sectMap[".Data_buf"].loadSegment = "IRAM";
Program.sectMap[".Server_run"] = new Program.SectionSpec();
Program.sectMap[".Server_run"].loadSegment = "IRAM";
I hope this helps you work out your configuration.
~Ramsey