MSP430 Embedded Application Binary Interface

MSP430 Embedded Application Binary Interface

MSP430 Embedded Application Binary Interface Application Report Literature Number: SLAA534A June 2013–Revised June 2020 Contents 1 Introduction......................................................................................................................... 7 1.1 ABIs for the MSP430 .................................................................................................... 7 1.2 Scope ...................................................................................................................... 8 1.3 ABI Variants............................................................................................................... 9 1.4 Toolchains and Interoperability......................................................................................... 9 1.5 Libraries ................................................................................................................... 9 1.6 Types of Object Files................................................................................................... 10 1.7 Segments ................................................................................................................ 10 1.8 MSP430 Architecture Overview....................................................................................... 10 1.9 MSP430 Memory Models.............................................................................................. 10 1.10 Reference Documents ................................................................................................. 11 1.11 Code Fragment Notation............................................................................................... 11 2 Data Representation ........................................................................................................... 12 2.1 Basic Types ............................................................................................................. 12 2.2 Data in Registers ....................................................................................................... 13 2.3 Data in Memory ......................................................................................................... 13 2.4 Pointer Types ........................................................................................................... 13 2.5 Complex Types ......................................................................................................... 14 2.6 Structures and Unions ................................................................................................. 14 2.7 Arrays .................................................................................................................... 14 2.8 Bit Fields ................................................................................................................. 15 2.8.1 Volatile Bit Fields............................................................................................ 15 2.9 Enumeration Types..................................................................................................... 16 3 Calling Conventions ........................................................................................................... 17 3.1 Call and Return ......................................................................................................... 17 3.1.1 Call Instructions ............................................................................................. 17 3.1.2 Return Instruction ........................................................................................... 17 3.1.3 Pipeline Conventions ....................................................................................... 17 3.1.4 Weak Functions ............................................................................................. 17 3.2 Register Conventions .................................................................................................. 18 3.2.1 Argument Registers......................................................................................... 19 3.2.2 Callee-Saved Registers .................................................................................... 19 3.3 Argument Passing ...................................................................................................... 19 3.3.1 Register Singles............................................................................................. 19 3.3.2 Register Pairs ............................................................................................... 20 3.3.3 Split Pairs .................................................................................................... 21 3.3.4 Quads (Four-Register Arguments)........................................................................ 21 3.3.5 Special Convention for Compiler Helper Functions .................................................... 23 3.3.6 C++ Argument Passing .................................................................................... 23 3.3.7 Passing Structs and Unions ............................................................................... 24 3.3.8 Stack Layout of Arguments Not Passed in Registers .................................................. 24 3.3.9 Frame Pointer ............................................................................................... 24 3.4 Return Values ........................................................................................................... 25 2 Table of Contents SLAA534A–June 2013–Revised June 2020 Submit Documentation Feedback Copyright © 2013–2020, Texas Instruments Incorporated www.ti.com 3.5 Structures and Unions Passed and Returned by Reference ..................................................... 25 3.6 Conventions for Compiler Helper Functions ........................................................................ 26 3.7 Scratch Registers for Functions Already Seen ..................................................................... 26 3.8 _ _mspabi_func_epilog Helper Functions ........................................................................... 26 3.9 Interrupt Functions...................................................................................................... 26 4 Data Allocation and Addressing ........................................................................................... 27 4.1 Data Sections and Segments ......................................................................................... 27 4.2 Addressing Modes...................................................................................................... 28 4.3 Allocation and Addressing of Static Data ........................................................................... 28 4.3.1 Addressing Methods for Static Data...................................................................... 28 4.3.2 Placement Conventions for Static Data.................................................................. 29 4.3.3 Initialization of Static Data ................................................................................. 30 4.4 Automatic Variables .................................................................................................... 30 4.5 Frame Layout ........................................................................................................... 31 4.5.1 Stack Alignment ............................................................................................. 32 4.5.2 Register Save Order........................................................................................ 32 4.6 Heap-Allocated Objects................................................................................................ 32 5 Code Allocation and Addressing .......................................................................................... 33 5.1 Computing the Address of a Code Label............................................................................ 33 5.1.1 Absolute Addressing for Code ............................................................................ 33 5.1.2 Symbolic Addressing ....................................................................................... 33 5.1.3 Immediate Addressing...................................................................................... 34 5.2 Branching ................................................................................................................ 34 5.3 Calls ...................................................................................................................... 34 5.3.1 Direct Call .................................................................................................... 34 5.3.2 Far Call Trampoline......................................................................................... 34 5.3.3 Indirect Calls................................................................................................. 34 6 Helper Function API............................................................................................................ 35 6.1 Floating-Point Behavior ................................................................................................ 35 6.2 C Helper Function API ................................................................................................. 35 6.3 Special Register Conventions for Helper Functions ............................................................... 39 6.4 Floating-Point Helper Functions for C99............................................................................. 40 7 Standard C Library API ......................................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    85 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us