Question:
Is there a pragma for forcing data placement in VDSP 3.5?
Answer:
The #pragma section wasn't added to VisualDSP++ until 4.0. However, you can still control the placement of your data in VisualDSP++ 3.5 but by using the 'section' keyword.
Use this before each function or variable that we want to place in the section. Also, add the appropriate INPUT_SECTIONS commands to your LDF, in a suitable place.
For example:
In source file:
section("mysec")
int foo;
In ldf file:
mysec_dxe
{
INPUT_SECTIONS( $OBJECTS(mysec) )
} > mem_data1_test
We can find detailed information on the placement support keyword in the VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-218x DSPs. This can be found in VisualDSP++ help using the following path:
<Help>\Contents\manuals\Software Tools\Compiler\ ADSP-218x\ VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-218x DSPs\Compiler\C/C++ Language Extensions\Dual Memory Support Keywords\Placement Support keyword.
Also, we can map source file (.doj) which has multiple variable to specific memory range.
For example.,
We have multiple variables like test1, test 2,...declared in X1.c source file and we are able to map to specific memory location by adding the following line to an appropriate section in the LDF.
mem_data1_test { TYPE(DM RAM) START(0x000000) END(0x002000) WIDTH(16) }
SECTIONS
{
Settings
{
INPUT_SECTIONS( x1.doj(data1) )
} > mem_data1_test
}
The easiest way to place a variable at a specific address in memory, and ensure it is always placed there, is to use the LDF command 'RESOLVE(symbol_name, resolver)'.
For Example:
RESOLVE (_test1, 0x002ff0)
RESOLVE (_test2, 0x002ff1)
RESOLVE (_test3, 0x002ff2)