| 1 | /* Copyright (c) 2012-2015 Red Hat, Inc. All rights reserved. |
|---|
| 2 | |
|---|
| 3 | This copyrighted material is made available to anyone wishing to use, modify, |
|---|
| 4 | copy, or redistribute it subject to the terms and conditions of the BSD |
|---|
| 5 | License. This program is distributed in the hope that it will be useful, |
|---|
| 6 | but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties |
|---|
| 7 | of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license |
|---|
| 8 | is available at http://www.opensource.org/licenses. Any Red Hat trademarks that |
|---|
| 9 | are incorporated in the source code or documentation are not subject to the BSD |
|---|
| 10 | License and may only be used or replicated with the express permission of |
|---|
| 11 | Red Hat, Inc. |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | /* This file provides macros for various MSP430 instructions |
|---|
| 15 | which have similar, but not identical, versions when assembling |
|---|
| 16 | for the LARGE memory model. */ |
|---|
| 17 | |
|---|
| 18 | #ifdef __MSP430X_LARGE__ |
|---|
| 19 | |
|---|
| 20 | #define call_ CALLA |
|---|
| 21 | #define ret_ RETA |
|---|
| 22 | #define mov_ MOVA |
|---|
| 23 | #define movx_ MOVX |
|---|
| 24 | #define br_ BRA |
|---|
| 25 | #define cmp_ CMPA |
|---|
| 26 | #define add_ ADDA |
|---|
| 27 | #define PTRsz 4 |
|---|
| 28 | |
|---|
| 29 | #else |
|---|
| 30 | |
|---|
| 31 | #define call_ CALL |
|---|
| 32 | #define ret_ RET |
|---|
| 33 | #define mov_ MOV |
|---|
| 34 | #define movx_ MOV |
|---|
| 35 | #define br_ BR |
|---|
| 36 | #define cmp_ CMP |
|---|
| 37 | #define add_ ADD |
|---|
| 38 | #define PTRsz 2 |
|---|
| 39 | |
|---|
| 40 | #endif |
|---|
| 41 | |
|---|
| 42 | /* Start a function in its own named and numbered section, so that it |
|---|
| 43 | can be subject to linker garbage collection. The numbers are used |
|---|
| 44 | to enforce link-time ordering of the sections. Note - the construction |
|---|
| 45 | of the symbol names is critical - they need to match the unresolved |
|---|
| 46 | symbol references created by the compiler and assembler. */ |
|---|
| 47 | .macro START_CRT_FUNC number name |
|---|
| 48 | .section .crt_\number\name,"ax",@progbits |
|---|
| 49 | .global __crt0_\name |
|---|
| 50 | .type __crt0_\name , @function |
|---|
| 51 | __crt0_\name: |
|---|
| 52 | .endm |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | /* End a named function. Sets the size so that GDB does not get confused. */ |
|---|
| 56 | .macro END_CRT_FUNC name |
|---|
| 57 | .size __crt0_\name, . - __crt0_\name |
|---|
| 58 | .endm |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | /* Provide a weak definition of NAME, initialized to zero. */ |
|---|
| 62 | .macro WEAK_DEF name |
|---|
| 63 | .global \name |
|---|
| 64 | .weak \name |
|---|
| 65 | \name = 0 |
|---|
| 66 | .endm |
|---|