MSP430 >> MSP430

Pages: 1
Marco73
stranger


Reged: Feb 07 2008
Posts: 3
MSP430 C and Assembler programming
      #34392 - Thu Feb 07 2008 11:58 AM

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.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 3387
Loc: Boulder, Colorado U.S.A.
Re: MSP430 C and Assembler programming [Re: Marco73]
      #34802 - Sat Feb 09 2008 01:54 AM

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?


Post Extras: Print Post   Remind Me!   Notify Moderator  
Marco73
stranger


Reged: Feb 07 2008
Posts: 3
Re: MSP430 C and Assembler programming [Re: Dan Henry]
      #34932 - Mon Feb 11 2008 03:38 AM

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.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 3387
Loc: Boulder, Colorado U.S.A.
Re: MSP430 C and Assembler programming [Re: Marco73]
      #35002 - Mon Feb 11 2008 07:53 AM

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


Post Extras: Print Post   Remind Me!   Notify Moderator  
Marco73
stranger


Reged: Feb 07 2008
Posts: 3
Re: MSP430 C and Assembler programming [Re: Dan Henry]
      #35412 - Wed Feb 13 2008 05:08 AM

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 ?


Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 3387
Loc: Boulder, Colorado U.S.A.
Re: MSP430 C and Assembler programming [Re: Marco73]
      #35582 - Wed Feb 13 2008 08:24 AM

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.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 0 anonymous users are browsing this forum.

Moderator:  ndouglas, jtemples, Dan Henry, Andrew L, mikerj, dave g, meisty, josh stevo 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 3680

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5