Hi Friends,
Please suggest how can i locate my variables and arrays at specific absolute address in C?
I am using CCS to program TMS320DM6446 device.
Regards,
Asim
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 Friends,
Please suggest how can i locate my variables and arrays at specific absolute address in C?
I am using CCS to program TMS320DM6446 device.
Regards,
Asim
I haven't created any variables at specific address in C on DSP/BIOS and CCS setup, but can give you some pointers on that:
You can create your own data sections in the TCF file and can allocate the variables in the c file using the #pragma directive in that section.
please see page 136 of http://focus.ti.com/general/docs/techdocsabstract.tsp?abstractName=spru187o
The use of pragmas as Nag and Mariana suggest is the best way to get C environment data into a particular place in memory. One alternative method if you just need to access a specific address, but do not care if the C environment is aware of it is to create a pointer to the address in question, this is a way of accessing registers and such in the hardware.
Some Simple Code said:int *specific_absolute_address; //declare the pointer
specific_absolute_address = (int *) 0x12345678; //set the pointer to the address you want
*specific_absolute_address = 42; //set a value to the address
a_read_value = *specific_absolute_address; //read a value from the address
//etc...
Of course you have to be careful of what address you use here, since you are defining it there is the potential that you could access an invalid location or overwrite your own code, also note that this only applies if there is no MMU active, such as on the C64x+ side of the DM6446.