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.

Global variables in Registers (MSP430)

I have a mixed C/ASM project and I'm wondering if it is possible to reserve one or two registers for global variables. With IAR you can tell the compiler not to use R4 and/or R5 so I'm wondering if there is a way to accomplish the same thing in CCS 4.2.

Thanks

-Ryan

  • I'm not sure which MSP430 compiler version comes with CCS 4.2.  I think it is v3.3.0.  If so, you can use the new option --global_register.  It is not documented in the compiler manual yet.  But you can run cl430 from the command line and get summary information like this.

    % cl430 -h --global_register
      --global_register=r5,r4
                              Reserve the specified register for use by the user.
                               It will not be used by the compiler.  If only
                               reserving one global register it is preferable for
                               performance reasons to reserve r4.
    
    

    Hope this helps,

    -George

  • Thanks, George. That is exactly what I was hoping for. BTW, CCS 4.2 includes version 3.3.1 of the compiler.

    -Ryan