11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Assembler language interfaceint main(){int locInt = gInt;gInt = func(locInt, gDouble);return 0;}Note: In this example we use a low optimization level when compiling the code toshow local and global variable access. If a higher level of optimization is used, therequired <strong>reference</strong>s to local variables could be removed during the optimization. Theactual function declaration is not changed by the optimization level.COMPILING THE CODEIn the <strong>IAR</strong> Embedded Workbench IDE, specify list options on file level. Select the filein the workspace window. Then choose Project>Options. In the C/<strong>C++</strong> <strong>Compiler</strong>category, select Override inherited settings. On the List page, deselect Output listfile, and instead select the Output assembler file option and its suboption Includesource. Also, be sure to specify a low level of optimization.Use the following options to compile the skeleton code:icc430 skeleton -lA .The -lA option creates an assembler language output file including C or <strong>C++</strong> sourcelines as assembler comments. The . (period) specifies that the assembler file should benamed in the same way as the C or <strong>C++</strong> module (skeleton), but with the filenameextension s43. Also remember to specify the data model you are using (if applicable) aswell as a low level of optimization and -e for enabling language extensions.The result is the assembler source output file skeleton.s43.Note: The -lA option creates a list file containing call frame information (CFI)directives, which can be useful if you intend to study these directives and how they areused. If you only want to study the calling convention, you can exclude the CFIdirectives from the list file. In the <strong>IAR</strong> Embedded Workbench IDE, selectProject>Options>C/<strong>C++</strong> <strong>Compiler</strong>>List and deselect the suboption Includecompiler runtime information. On the command line, use the option -lB instead of-lA. Note that CFI information must be included in the source code to make the C-SPYCall Stack window work.The output fileThe output file contains the following important information:●●The calling conventionThe return valuesPart 1. Using the compiler87

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!