Back to home page

LXR

 
 

    


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

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