Hello,
please allow following question regarding the placement of function into C6747 fast memory, aimed for cache.
In order to make use of L1D-memory speed (0-waitstates), I'd need to place one routine (function) that should run very efficiently. My idea is to move it from IRAM directly into area aimed for caching.
Moving an algo from (L2) IRAM into fast L1D memory.
Here’s how I proceeded:
- TConf: reduced “CACHE_L1D” memory section size aimed for data-cache (0x8000 > 0x6800)
- TConf: created new data section in the freed part (naming it: “CACHE_L1D_SRAM”) aimed for code/data
- Using an own linker command file (link_custom.cmd) following mapping defined:
SECTIONS
{
SectForCacheSRAM > CACHE_L1D_SRAM
SectForCacheSRAM: LOAD = IRAM, RUN = CACHE_L1D_SRAM
} - In the .C source file, I created a new data in the following manner:
#pragma CODE_SECTION(target_function, "SectForCacheSRAM")
void target_function(void)
{
LOG_printf(&trace, "TARGET-FUNCTION call performed");
}
So here my questions:
- Am I supposed to manually copy function from its load-placement to final area from which it would run (when called)?
- If yes, and in order to do the above job of copyiing, where do I get the symbols for function source (load) placement, its destination (run) placement and its length?
- If not, did I get something wrong, or missed to understand something?
Using .map file (function load and run addresses) information, I tried to perform copying, but without success: application crashes.
I use CGT 6.1.23, and DSP/BIOS 5.42.01.09. CCS 5.5. The DSP is a C6747.
I've prepared a small DSP/BIOS based example to demonstrate the described problem. It's very basic (based upon TI-example); contains one .file, one custom .cmd file and one .tcf file only.
I'd be grateful for any help!
Regards,
Mladen
APPENDIX:
Memory layout (out of .cmd, compiled .tcf file):
MEMORY {
CACHE_L1P : origin = 0x11e00000, len = 0x8000
CACHE_L1D : origin = 0x11f00000, len = 0x6800
DDR2 : origin = 0x80000000, len = 0x10000000
ARM_RAM : origin = 0x10010000, len = 0x8000
IRAM : origin = 0x11818000, len = 0x20000
CACHE_L1D_SRAM : origin = 0x11f06800, len = 0x1800 <<----------- function placed into proper memory-section
}
MEMORY CONFIGURATION (out of .map file)
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
ARM_RAM 10010000 00008000 00000000 00008000 RWIX
IRAM 11818000 00020000 0000cbcd 00013433 RWIX
CACHE_L1P 11e00000 00008000 00000000 00008000 RWIX
CACHE_L1D 11f00000 00006800 00000000 00006800 RWIX
CACHE_L1D_SRAM 11f06800 00001800 00000060 000017a0 RWIX <<----------- function placed into proper memory-section
DDR2 80000000 10000000 00000000 10000000 RWIX
MAP file:
SectForCacheSRAM
* 0 11f06800 00000060
11f06800 00000040 tsk.obj (SectForCacheSRAM)
11f06840 00000020 bios.a64P : log_printf.o64P ($Tramp$L$PI$$_LOG_printf)
FAR CALL TRAMPOLINES
callee name trampoline name
callee addr tramp addr call addr call info
-------------- ----------- --------- ----------------
$SectForCacheSRAM:tsk.obj$0x0 $Tramp$L$PI$$_target_function
11f06800 118226e0 118223d8 tsk.obj (.text)
$.bios:bios.a64P<log_printf.o64P>$0x0 $Tramp$L$PI$$_LOG_printf
1181bc40 11f06840 11f06810 tsk.obj (SectForCacheSRAM)