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.

Forcing a variable to a specific location and have linker's knowledge of it in CCE3.1

Hi All,

I'm new here and I have a question.

I used to use Quadravox for the MSP430 development and they had syntax that would allow the programmer to reserve a specific RAM location such as, "unsigned char i @ 0x1c00;". This would assign 'i' to memory location 0x1c00 and the linker would also know about this reserved location as not to put anything there.

I know I can use the command linker file for reserving memory locations, but I would like to continue doing this with CCE3.1 if possible.

I would like to know if this is possible with CCE3.1 and what syntax I would use for this.

Thanks in advanced!

-John

 

  • You can assign data to absolute addresses or named sections using CCE. To achieve absolute data placement, you can do this using the linker command file and declaring the variable as extern in the C code. Please refer to section C.3 of MSP-FET430 Users Guide for more details, http://www-s.ti.com/sc/techlit/slau157

    For named section you can place the variable in a named section using #pragma DATA_SECTION and then place the named section to a memory region within the SECTIONS directive of the linker command file.

    For eg:

    In C code:

    #pragma DATA_SECTION(tempOffset, "mysect")
    int tempOffset;

    In the linker command file:

    MEMORY
    {
       ...
       FLASH1 : origin = 0x10F4, length = 0x20
       ...
       ...
    }

    SECTIONS
    {
       ...
       mysect : {} > FLASH1
       ...
    }

  • Thanks for responding so quickly. I've noticed that you are using FLASH1, I'm going to be putting data into RAM.

    I was also hoping to avoid using the command-linker file and do this with extended C syntax, "unsigned char myChar @ 0x1c00" which in this example is the start of RAM. Does the C compiler in CCE3.1 allow one to do this or something similar with different syntax?

    Thanks,

    John

  • The C compiler in CCE does not support that syntax. You would need to use the linker command file to control placement.

  • Thanks, I was able to get the command-linker file to work fine.

     

    Thanks for the help.

    -John