Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:23

0001 /**
0002  * @file
0003  *
0004  * @brief Address the Problems Caused by Incompatible Flavor of
0005  * Assemblers and Toolsets
0006  *
0007  * This include file attempts to address the problems
0008  * caused by incompatible flavors of assemblers and
0009  * toolsets.  It primarily addresses variations in the
0010  * use of leading underscores on symbols and the requirement
0011  * that register names be preceded by a %.
0012  *
0013  * @note The spacing in the use of these macros
0014  *       is critical to them working as advertised.
0015  */
0016 
0017 /*
0018  *  COPYRIGHT:
0019  *
0020  *  This file is based on similar code found in newlib available
0021  *  from ftp.cygnus.com.  The file which was used had no copyright
0022  *  notice.  This file is freely distributable as long as the source
0023  *  of the file is noted.  This file is:
0024  *
0025  *  COPYRIGHT (c) 1994-2006.
0026  *  On-Line Applications Research Corporation (OAR).
0027  */
0028 
0029 #ifndef _RTEMS_ASM_H
0030 #define _RTEMS_ASM_H
0031 
0032 /*
0033  *  Indicate we are in an assembly file and get the basic CPU definitions.
0034  */
0035 
0036 #ifndef ASM
0037 #define ASM
0038 #endif
0039 #include <rtems/score/cpuopts.h>
0040 #include <rtems/score/bfin.h>
0041 
0042 #ifndef __USER_LABEL_PREFIX__
0043 /**
0044  * Recent versions of GNU cpp define variables which indicate the
0045  * need for underscores and percents.  If not using GNU cpp or
0046  * the version does not support this, then you will obviously
0047  * have to define these as appropriate.
0048  *
0049  * This symbol is prefixed to all C program symbols.
0050  */
0051 #define __USER_LABEL_PREFIX__ _
0052 #endif
0053 
0054 #ifndef __REGISTER_PREFIX__
0055 /**
0056  * Recent versions of GNU cpp define variables which indicate the
0057  * need for underscores and percents.  If not using GNU cpp or
0058  * the version does not support this, then you will obviously
0059  * have to define these as appropriate.
0060  *
0061  * This symbol is prefixed to all register names.
0062  */
0063 #define __REGISTER_PREFIX__
0064 #endif
0065 
0066 #include <rtems/concat.h>
0067 
0068 /** Use the right prefix for global labels.  */
0069 #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
0070 
0071 /** Use the right prefix for registers.  */
0072 #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
0073 
0074 /*
0075  *  define macros for all of the registers on this CPU
0076  *
0077  *  EXAMPLE:     #define d0 REG (d0)
0078  */
0079 
0080 /*
0081  *  Define macros to handle section beginning and ends.
0082  */
0083 
0084 
0085 /** This macro is used to denote the beginning of a code declaration. */
0086 #define BEGIN_CODE_DCL .text
0087 /** This macro is used to denote the end of a code declaration. */
0088 #define END_CODE_DCL
0089 /** This macro is used to denote the beginning of a data declaration section. */
0090 #define BEGIN_DATA_DCL .data
0091 /** This macro is used to denote the end of a data declaration section. */
0092 #define END_DATA_DCL
0093 /** This macro is used to denote the beginning of a code section. */
0094 #define BEGIN_CODE .text
0095 /** This macro is used to denote the end of a code section. */
0096 #define END_CODE
0097 /** This macro is used to denote the beginning of a data section. */
0098 #define BEGIN_DATA
0099 /** This macro is used to denote the end of a data section. */
0100 #define END_DATA
0101 /**
0102  * This macro is used to denote the beginning of the
0103  * unitialized data section.
0104  */
0105 #define BEGIN_BSS
0106 /** This macro is used to denote the end of the unitialized data section.  */
0107 #define END_BSS
0108 /** This macro is used to denote the end of the assembly file.  */
0109 #define END
0110 
0111 /**
0112  * This macro is used to declare a public global symbol.
0113  *
0114  * @note This must be tailored for a particular flavor of the C compiler.
0115  * They may need to put underscores in front of the symbols.
0116  */
0117 #define PUBLIC(sym) .globl SYM (sym)
0118 
0119 /**
0120  * This macro is used to prototype a public global symbol.
0121  *
0122  * @note This must be tailored for a particular flavor of the C compiler.
0123  * They may need to put underscores in front of the symbols.
0124  */
0125 #define EXTERN(sym) .globl SYM (sym)
0126 
0127 #endif