Back to home page

LXR

 
 

    


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

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/lm32.h>
0041 
0042 /**
0043  * @defgroup RTEMSScoreCPUlm32ASM lm32 Assembler Support
0044  *
0045  * @ingroup RTEMSScoreCPUlm32
0046  *
0047  * @brief LatticeMicro32 (lm32) Assembler Support
0048  */
0049 /**@{**/
0050 
0051 #ifndef __USER_LABEL_PREFIX__
0052 /**
0053  * Recent versions of GNU cpp define variables which indicate the
0054  * need for underscores and percents.  If not using GNU cpp or
0055  * the version does not support this, then you will obviously
0056  * have to define these as appropriate.
0057  *
0058  * This symbol is prefixed to all C program symbols.
0059  */
0060 #define __USER_LABEL_PREFIX__ _
0061 #endif
0062 
0063 #ifndef __REGISTER_PREFIX__
0064 /**
0065  * Recent versions of GNU cpp define variables which indicate the
0066  * need for underscores and percents.  If not using GNU cpp or
0067  * the version does not support this, then you will obviously
0068  * have to define these as appropriate.
0069  *
0070  * This symbol is prefixed to all register names.
0071  */
0072 #define __REGISTER_PREFIX__
0073 #endif
0074 
0075 #include <rtems/concat.h>
0076 
0077 /** Use the right prefix for global labels.  */
0078 #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
0079 
0080 /** Use the right prefix for registers.  */
0081 #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
0082 
0083 /*
0084  *  define macros for all of the registers on this CPU
0085  *
0086  *  EXAMPLE:     #define d0 REG (d0)
0087  */
0088 
0089 /*
0090  *  Define macros to handle section beginning and ends.
0091  */
0092 
0093 
0094 /** This macro is used to denote the beginning of a code declaration. */
0095 #define BEGIN_CODE_DCL .text
0096 /** This macro is used to denote the end of a code declaration. */
0097 #define END_CODE_DCL
0098 /** This macro is used to denote the beginning of a data declaration section. */
0099 #define BEGIN_DATA_DCL .data
0100 /** This macro is used to denote the end of a data declaration section. */
0101 #define END_DATA_DCL
0102 /** This macro is used to denote the beginning of a code section. */
0103 #define BEGIN_CODE .text
0104 /** This macro is used to denote the end of a code section. */
0105 #define END_CODE
0106 /** This macro is used to denote the beginning of a data section. */
0107 #define BEGIN_DATA
0108 /** This macro is used to denote the end of a data section. */
0109 #define END_DATA
0110 /**
0111  * This macro is used to denote the beginning of the
0112  * unitialized data section.
0113  */
0114 #define BEGIN_BSS
0115 /** This macro is used to denote the end of the unitialized data section.  */
0116 #define END_BSS
0117 /** This macro is used to denote the end of the assembly file.  */
0118 #define END
0119 
0120 /**
0121  * This macro is used to declare a public global symbol.
0122  *
0123  * NOTE: This must be tailored for a particular flavor of the C compiler.
0124  * They may need to put underscores in front of the symbols.
0125  */
0126 #define PUBLIC(sym) .globl SYM (sym)
0127 
0128 /**
0129  * This macro is used to prototype a public global symbol.
0130  *
0131  * NOTE: This must be tailored for a particular flavor of the C compiler.
0132  * They may need to put underscores in front of the symbols.
0133  */
0134 #define EXTERN(sym) .globl SYM (sym)
0135 
0136 /**@}**/
0137 
0138 #endif