Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
I want to place the calculation code in the TCMA, and I made the following modifications based on the example routine:
Added code:
.TI.local : {} >> R5F_TCMA | R5F_TCMB | OCRAM
.TI.onchip : {} >> OCRAM | FLASH
.TI.offchip : {} > FLASH
Placed before the following code:
/* Sections needed for C++ projects /
GROUP {
.ARM.exidx: {} palign(8) / Needed for C++ exception handling /
.init_array: {} palign(8) / Contains function pointers called before main /
.fini_array: {} palign(8) / Contains function pointers called after main */ } > OCRAM
When writing the function, declare it as:
(Because my program is currently using fixed-point calculations, converting to floating-point would be a massive undertaking, so I am temporarily using the DSP's IQmath library on AM2632)
_iq24 attribute((local(1))) _IQ24mpy1(_iq24 A, _iq24 B)
{
_iq24 result;
asm volatile(
"smull r2, r3, %1, %2
"
"lsr r2, r2, #24
"
"lsr r3, r3, #8
"
"add %0, r2, r3
"
: "=r" (result)
: "r" (A), "r" (B)
: "r2", "r3", "cc"
);
return result;
}
When I run it, the code still executes in RAM rather than in TCMA, which can be verified by checking the addresses through disassembly.
_IQ24mpy1():
7004dd74: FB802307 smull r2, r3, r0, r7
7004dd78: EA4F6212 lsr.w r2, r2, #0x18
7004dd7c: EA4F2313 lsr.w r3, r3, #8
7004dd80: EB020003 add.w r0, r2, r3
I compared the linker.cmd of the example and my project, and they are almost identical. The MAP file generated by my debug build does not contain the function _IQ24mpy1, whereas the map file generated by the example routine contains the following code segment.
.irqstack
* 0 70057a08 00000100 UNINITIALIZED
70057a08 00000100 --HOLE--
.fiqstack
* 0 70057b08 00000100 UNINITIALIZED
70057b08 00000100 --HOLE--
.svcstack
* 0 70057c08 00001000 UNINITIALIZED
70057c08 00001000 --HOLE--
.abortstack
* 0 70058c08 00000100 UNINITIALIZED
70058c08 00000100 --HOLE--
.undefinedstack
* 0 70058d08 00000100 UNINITIALIZED
70058d08 00000100 --HOLE--
.init_array
* 0 70040000 00000000 UNINITIALIZED
.TI.local
* 0 00000040 00001c06
00000040 00000802 basic_smart_placement.o (.text.annotated_function_f2)
00000842 00001002 basic_smart_placement.o (.text.annotated_function_f3)
00001844 00000402 basic_smart_placement.o (.text.annotated_function_f4)
my map file contains bellow:
.irqstack
* 0 70059ca0 00000100 UNINITIALIZED
70059ca0 00000100 --HOLE--
.fiqstack
* 0 70059da0 00000100 UNINITIALIZED
70059da0 00000100 --HOLE--
.svcstack
* 0 70059ea0 00001000 UNINITIALIZED
70059ea0 00001000 --HOLE--
.abortstack
* 0 7005aea0 00000100 UNINITIALIZED
7005aea0 00000100 --HOLE--
.undefinedstack
* 0 7005afa0 00000100 UNINITIALIZED
7005afa0 00000100 --HOLE--
.init_array
* 0 70040000 00000000 UNINITIALIZED
.trigText
* 0 00000040 00000594
00000040 00000594 mathlib.am263x.r5f.ti-arm-clang.release.lib : ti_arm_trig.obj (.trigText)
.trigData
* 0 000005d8 000000b0
000005d8 000000b0 mathlib.am263x.r5f.ti-arm-clang.release.lib : ti_arm_trig.obj (.trigData)
why? how can I put my code in TCMA?