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.
Hello everyone,
I wanted to place some data (variables) at an absolute memory location in the RAM. For example i want to define an array of 100 integers and place it at a specific location in the RAM. How do i achieve this and where can i find the related documentation and examples?
Thanks!
Hi there,
It all depends on which compiler you are using too. Here is a documentation that can get you started.
http://www-s.ti.com/sc/techlit/slau157
goto Appendix C.3.
You can try the following:
// locations in information memory segments
#define DATA1 (*(unsigned int*)0x1040)
#define DATA1 (*(unsigned int*)0x1042)
#define DATA3 (*(unsigned int*)0x1044)
etc.
Use the RAM addresses for your chip
Or use the linker:
// Code
-Z(CODE)CSTART=8080-FFDF //code starts after data
-Z(CODE)CODE=8080-FFDF
// Constant data
-Z(CONST)GAGE_DATA=8000-807F //where my data is going. See code snip below
-Z(CONST)DATA16_C,DATA16_ID,DIFUNCT,CHECKSUM=8000-FFDF
#pragma location="GAGE_DATA" // 8000-8079
const struct gage_data Gage_Data =
{
"1.00", // Firmware version
__DATE__, // Day & Time of compile
__TIME__,
"M241", // Model no.
"OU812", // Serial no.
"calibrator" // who calibrated
};
Again, use the RAM addresses for your chip.
I've only done it with flash but the linker tells you where RAM is.
Hi William,
Thanks for the reply!
I am using CCE v3. I have read the documentation already and i tried accordingly. Actually i wanted to place an array at an absolute memory location in RAM. I was able to place the array at the required memory location but i cannot see the array in the watch window while debug?
I also didnt understand where exactly does the memory allocation takes place, because in the linker cmd file i just defined the name of the array, the actual size of the array is defined in the source file where the array is declared as an extern variable? I have shown below what i have done in the code:
/* Linker cmd file entry */
array_int = 0x01C00;
/* end */
/*Source C file Entry */
extern unsigned int array_int[10];
/* end */
why I am not able to see array_int in the watch window?
Thanks!
**Attention** This is a public forum