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.

Question about declaring local variables in Assembly using Code Composer Studio

I am studying how to program MSP430 micro-controllers and the book I am using shows examples using the IAR assembler that has features that are not part of Code Composer Studio.

For example, in the book they are able to declare local variables and tell the assembler what memory location those variables are at. Here is some code that explains what I mean:

ORG 0x0200                              ; Start of RAM
LoopCtr DS 2                             ; 2 bytes for loop counter
Another DS 1                              ; 1 byte for another variable

This uses an IAR assembler keyword "ORG" and "DS" to create 2 local variables named "LoopCtr" and "Another" and it makes sure that they start at memory location 0x0200 which happens to be the start of RAM for this particular chip they are programming.

The problem I have is that I am not able to find any equivalent keywords in the Code Composer Studio that would allow me to do the same thing. I know there has to be a way to do this but all of the application notes I have found don't seem to show me how to do this.

Does anyone know where I can find the instructions on how to tell the assembler for CCS to do the same thing?

  • Just invest some time to learn this document: 

    Assembly language is actually something in between of object-oriented programming and hardware machine code execution. So, most of things you need to do manually, but there are some specific scenarios that cannot be done entirely (or cannot be done efficiently) in C/C++ (like self-reprogramming or extended precision calculations).

  • Local variables would be stored on the stack, relative to the frame pointer (or the stack pointer, if you're careful). These are not local variables but global variables.

    To reserve space for such variables, use directives like .space or .word; use directives like .data to define into which section they're placed. (See chapter 5 of the MSP430 Assembly Language Tools User's Guide (SLAU131).)

**Attention** This is a public forum