source: rtems/cpukit/score/cpu/microblaze/include/rtems/asm.h @ d03776e

Last change on this file since d03776e was d03776e, checked in by Alex White <alex.white@…>, on 10/01/21 at 04:57:01

microblaze: Rework for RTEMS 6

This reworks the existing MicroBlaze? architecture port and BSP to
achieve basic functionality using the latest RTEMS APIs.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @brief MicroBlaze assembler support
7 *
8 * This include file attempts to address the problems
9 * caused by incompatible flavors of assemblers and
10 * toolsets.  It primarily addresses variations in the
11 * use of leading underscores on symbols and the requirement
12 * that register names be preceded by a %.
13 */
14
15/*
16 * Copyright (c) 2015, Hesham Almatary
17 * Copyright (C) 2021 On-Line Applications Research Corporation (OAR)
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 * 1. Redistributions of source code must retain the above copyright
23 *    notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 *    notice, this list of conditions and the following disclaimer in the
26 *    documentation and/or other materials provided with the distribution.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
32 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
39 */
40
41#ifndef _RTEMS_ASM_H
42#define _RTEMS_ASM_H
43
44/*
45 *  Indicate we are in an assembly file and get the basic CPU definitions.
46 */
47
48#ifndef ASM
49#define ASM
50#endif
51
52#include <rtems/score/cpuopts.h>
53
54#ifndef __USER_LABEL_PREFIX__
55/**
56 *  Recent versions of GNU cpp define variables which indicate the
57 *  need for underscores and percents.  If not using GNU cpp or
58 *  the version does not support this, then you will obviously
59 *  have to define these as appropriate.
60 *
61 *  This symbol is prefixed to all C program symbols.
62 */
63#define __USER_LABEL_PREFIX__ _
64#endif
65
66#ifndef __REGISTER_PREFIX__
67/**
68 *  Recent versions of GNU cpp define variables which indicate the
69 *  need for underscores and percents.  If not using GNU cpp or
70 *  the version does not support this, then you will obviously
71 *  have to define these as appropriate.
72 *
73 *  This symbol is prefixed to all register names.
74 */
75#define __REGISTER_PREFIX__
76#endif
77
78#include <rtems/concat.h>
79
80/** Use the right prefix for global labels.  */
81#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
82
83/** Use the right prefix for registers.  */
84#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
85
86/*
87 *  define macros for all of the registers on this CPU
88 *
89 *  EXAMPLE:     #define d0 REG (d0)
90 */
91
92/*
93 *  Define macros to handle section beginning and ends.
94 */
95
96
97/** This macro is used to denote the beginning of a code declaration. */
98#define BEGIN_CODE_DCL .text
99/** This macro is used to denote the end of a code declaration. */
100#define END_CODE_DCL
101/** This macro is used to denote the beginning of a data declaration section. */
102#define BEGIN_DATA_DCL .data
103/** This macro is used to denote the end of a data declaration section. */
104#define END_DATA_DCL
105/** This macro is used to denote the beginning of a code section. */
106#define BEGIN_CODE .text
107/** This macro is used to denote the end of a code section. */
108#define END_CODE
109/** This macro is used to denote the beginning of a data section. */
110#define BEGIN_DATA
111/** This macro is used to denote the end of a data section. */
112#define END_DATA
113/** This macro is used to denote the beginning of the
114 *  unitialized data section.
115 */
116#define BEGIN_BSS
117/** This macro is used to denote the end of the unitialized data section.  */
118#define END_BSS
119/** This macro is used to denote the end of the assembly file.  */
120#define END
121
122/**
123 *  This macro is used to declare a public global symbol.
124 *
125 *  @note This must be tailored for a particular flavor of the C compiler.
126 *  They may need to put underscores in front of the symbols.
127 */
128#define PUBLIC(sym) .globl SYM (sym)
129
130/**
131 *  This macro is used to prototype a public global symbol.
132 *
133 *  @note This must be tailored for a particular flavor of the C compiler.
134 *  They may need to put underscores in front of the symbols.
135 */
136#define EXTERN(sym) .globl SYM (sym)
137
138#endif
Note: See TracBrowser for help on using the repository browser.