Marco73
stranger
Reged: Feb 07 2008
Posts: 3
|
|
I work on a project using the MSP430F1612 microcontroller. The code for the microcontroller has been written using the Assembler language, however I have the need to call C procedures from the main Assembler program. I have already read the TI application note "Mixing C and Assembler with the MSP430" that explain the rules to pass variables between procedures but there are still something I don't understand. In particular, in the main Assembler program data are stored in memory locations whose address is specified by me while in the C procedure the memory addressing is completely managed by the compiler: when I define local variables in the C procedure how can I be sure these variables don't overwrite the data stored in the main Assembler program. Is there any way to force the C compiler to use a particular section of the RAM for the local variables of the C procedure ?
Thanks for the support.
|
Dan Henry
Guru
  
Reged: Oct 16 2003
Posts: 3387
Loc: Boulder, Colorado U.S.A.
|
|
Quote:
I have already read the TI application note "Mixing C and Assembler with the MSP430" that explain the rules to pass variables between procedures but there are still something I don't understand.
To make it easier for us, could you link to the application note and elaborate on your analysis of that note's interface rules (a.k.a. EABI) to verify that it works with HI-TECH's EABI?
Quote:
In particular, in the main Assembler program data are stored in memory locations whose address is specified by me while in the C procedure the memory addressing is completely managed by the compiler: when I define local variables in the C procedure how can I be sure these variables don't overwrite the data stored in the main Assembler program.
I'll assume that's a question. Are the locals (autos) allocated by the compiler on the stack or at fixed memory locations?
Quote:
Is there any way to force the C compiler to use a particular section of the RAM for the local variables of the C procedure ?
Do you really need to do that?
|
Marco73
stranger
Reged: Feb 07 2008
Posts: 3
|
|
Quote:
To make it easier for us, could you link to the application note and elaborate on your analysis of that note's interface rules (a.k.a. EABI) to verify that it works with HI-TECH's EABI?
I don't know what EABI is. The application note as well as some examples can be found at http://focus.ti.com/docs/mcu/catalog/res...actName=slaa140
Quote:
I'll assume that's a question. Are the locals (autos) allocated by the compiler on the stack or at fixed memory locations?
The problem is just I don't know how the compiler allocates the local variables. All I want to know is how to be sure that the local variables of the C procedure don't overwrite the data stored at particular memory locations in the assembler main program.
Quote:
Do you really need to do that?
Not really. Only to make sure local variables don't overwrite data stored in the main.
|
Dan Henry
Guru
  
Reged: Oct 16 2003
Posts: 3387
Loc: Boulder, Colorado U.S.A.
|
|
Quote:
The problem is just I don't know how the compiler allocates the local variables. All I want to know is how to be sure that the local variables of the C procedure don't overwrite the data stored at particular memory locations in the assembler main program.
It's all described in the compiler manual.
- 11.5 Storage Class and Object Placement
- 11.7 Register Usage
- 11.11 Mixing C and Assembler Code
|
Marco73
stranger
Reged: Feb 07 2008
Posts: 3
|
|
Quote:
It's all described in the compiler manual.
11.5 Storage Class and Object Placement 11.7 Register Usage 11.11 Mixing C and Assembler Code
I have downloaded the compiler manual but the reported sections are not present. Can you put a link to the file ?
|
Dan Henry
Guru
  
Reged: Oct 16 2003
Posts: 3387
Loc: Boulder, Colorado U.S.A.
|
|
Quote:
Quote:
It's all described in the compiler manual.
11.5 Storage Class and Object Placement 11.7 Register Usage 11.11 Mixing C and Assembler Code
I have downloaded the compiler manual but the reported sections are not present. Can you put a link to the file ?
The reported sections are present in the manual I just downloaded (430man.pdf). I don't know how we could both download a manual, yet have different versions.
|