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.

CCS/PGA970: Defining the memory location for variables

Part Number: PGA970


Tool/software: Code Composer Studio

Hi, I am trying to define a specific memory location for a variable in the PGA970EVM. However, I am not seeing the variable when I run the debugger. I will really appreciate your help with this issue. Below is the piece of code that should assign the memory location to the variable x. Inside the main, there is code that it is just updating the value as the code is running.

#pragma location = 0x2000000
char x = 0;

void main(void){
 // Code Updating the variable
}

  • I presume you use the TI ARM compiler to build code that runs on the Cortex-M0 CPU in your system.

    This ...

    Hector Ochoa said:
    #pragma location = 0x2000000

    ... is not the documented syntax for this pragma.  Please search the TI ARM compiler manual for the sub-chapter titled The LOCATION Pragma.  However, I tried this syntax, and it works.  The code generated by the compiler is correct.  

    Hector Ochoa said:
    I am not seeing the variable when I run the debugger

    Perhaps it is a hardware problem.  Are you sure this range of memory is configured correctly?

    Thanks and regards,

    -George

  • Thanks for the response George, I checked the TI ARM Compiler Manual, and in section 5.10.16 it says that "compiler supports the ability to specify the run-time address of a variable at the source level." The example in the manual shows:

    #pragma LOCATION( x , address )
    int x

    As you pointed out it might be that I am not understanding the way memory is organized in the PGA970. According to the memory map DATA RAM is defined from 0x2000 0000 to 0x2000 07FF (The code in my original message had a zero missing, this was not the case for the code in CCS). You can see the memory map below. One thing that is bothering me is how DATA RAM is defined in the datasheet. According to the data sheet: "The data RAM memory space is used for M0 scratchpad memory, such as intermediate calculation results. It is 2K bytes of RAM memory space, and located at memory page 1." Does this means that this memory is for the MCU to use, but not for the user to use for variables? If that is the case, then my other option might be FRAM. This is defined as " PGA970 device contains 8KBytes of FRAM and Development RAM. Certain section can be configured to run out of Development RAM. Only 6KB of FRAM and Development RAM can be used for code rest of the area is reserved for User defined DATA and named as FRAM_DATA area." Could you please help me to clarify this issue?

  • I am not familiar with the specifics of PGA970.  Speaking generally, I can say it is usually the case that, when power is turned on, not all of the memory is immediately available for use.  Certain initialization steps must be taken first.  If you need help with these details, I recommend you start a new thread in the Data Converters Forum.  Or, if you prefer, I can move this thread into that forum.

    Thanks and regards,

    -George

  • Please let us know if you resolved your problem, and if so, how you resolved it.  Does it still make sense to move this thread to the Data Converters Forum?

    Thanks and regards,

    -George

  • Since it has been a while, I presume you have resolved your problem.  I'd appreciate hearing how you resolved it.

    Thanks and regards,

    -George

  • Hi George, sorry I didn't responded earlier, but we have been trying to solve the problem in different ways without success. Let me explain you what we are trying to do.

    The system should be taking measurements from an LVDT and a temperature sensor, because SPI is slow we want the MCU to store those values on a memory location to be read by the master. The master will place the MCU in reset mode to gain access to the memory location. Once the data has been read, the master will place the MCU out of reset. The MCU will will store the next measurements, and the process is repeated. First, we tried to store the information in very specific memory locations, but this was a failure. Now we are trying to transmit the memory location through SPI so the master will know were the data is placed. However, we are still facing problems. We are trying something different this week to see if we can crack the problem. If you have any suggestions we will really appreciate it.

    Hector
  • Unfortunately, your question is well outside my expertise.  I recommend you start a new thread in the Data Converters Forum.  Or, if you prefer, I can move this thread into that forum.  

    Unless you ask me to move this thread, I will close it.

    Thanks and regards,

    -George