[e52906b] | 1 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
[489740f] | 2 | |
---|
[4886d60] | 3 | .. Copyright (C) 1988, 2009 On-Line Applications Research Corporation (OAR) |
---|
[f233256] | 4 | |
---|
[d755cbd] | 5 | ARM Specific Information |
---|
[6916004] | 6 | ************************ |
---|
[d755cbd] | 7 | |
---|
[f233256] | 8 | This chapter discusses the *ARM architecture* |
---|
| 9 | (http://en.wikipedia.org/wiki/ARM_architecture) dependencies in this port of |
---|
| 10 | RTEMS. The ARMv4T (and compatible), ARMv7-A, ARMv7-R and ARMv7-M architecture |
---|
| 11 | versions are supported by RTEMS. Processors with a MMU use a static |
---|
| 12 | configuration which is set up during system start. SMP is supported. |
---|
[d755cbd] | 13 | |
---|
| 14 | **Architecture Documents** |
---|
| 15 | |
---|
[f233256] | 16 | For information on the ARM architecture refer to the *ARM Infocenter* |
---|
| 17 | (http://infocenter.arm.com/). |
---|
[d755cbd] | 18 | |
---|
| 19 | CPU Model Dependent Features |
---|
| 20 | ============================ |
---|
| 21 | |
---|
[f233256] | 22 | This section presents the set of features which vary across ARM implementations |
---|
| 23 | and are of importance to RTEMS. The set of CPU model feature macros are |
---|
| 24 | defined in the file :file:`cpukit/score/cpu/arm/rtems/score/arm.h` based upon |
---|
| 25 | the particular CPU model flags specified on the compilation command line. |
---|
[d755cbd] | 26 | |
---|
| 27 | CPU Model Name |
---|
| 28 | -------------- |
---|
| 29 | |
---|
[f233256] | 30 | The macro ``CPU_MODEL_NAME`` is a string which designates the architectural |
---|
| 31 | level of this CPU model. See in :file:`cpukit/score/cpu/arm/rtems/score/arm.h` |
---|
| 32 | for the values. |
---|
[d755cbd] | 33 | |
---|
| 34 | Count Leading Zeroes Instruction |
---|
| 35 | -------------------------------- |
---|
| 36 | |
---|
| 37 | The ARMv5 and later has the count leading zeroes ``clz`` instruction which |
---|
| 38 | could be used to speed up the find first bit operation. The use of this |
---|
| 39 | instruction should significantly speed up the scheduling associated with a |
---|
| 40 | thread blocking. This is currently not used. |
---|
| 41 | |
---|
| 42 | Floating Point Unit |
---|
| 43 | ------------------- |
---|
| 44 | |
---|
[c1d296a] | 45 | The following floating point units are supported: |
---|
| 46 | |
---|
| 47 | - VFPv2 (for example available on ARM926EJ-S processors) |
---|
[d755cbd] | 48 | |
---|
| 49 | - VFPv3-D32/NEON (for example available on Cortex-A processors) |
---|
| 50 | |
---|
| 51 | - VFPv3-D16 (for example available on Cortex-R processors) |
---|
| 52 | |
---|
| 53 | - FPv4-SP-D16 (for example available on Cortex-M processors) |
---|
| 54 | |
---|
[c1d296a] | 55 | - FPv5-D16 (for example available on Cortex-M7 processors) |
---|
| 56 | |
---|
[d755cbd] | 57 | Multilibs |
---|
| 58 | ========= |
---|
| 59 | |
---|
| 60 | The following multilibs are available: |
---|
| 61 | |
---|
[f233256] | 62 | #. ``.``: ARMv4T, ARM instruction set |
---|
[d755cbd] | 63 | |
---|
[c1d296a] | 64 | #. ``vfp/hard``: ARMv4T, ARM instruction set with hard-float ABI and VFPv2 support |
---|
| 65 | |
---|
[f233256] | 66 | #. ``thumb``: ARMv4T, Thumb-1 instruction set |
---|
[d755cbd] | 67 | |
---|
[f233256] | 68 | #. ``thumb/armv6-m``: ARMv6M, subset of Thumb-2 instruction set |
---|
[d755cbd] | 69 | |
---|
[f233256] | 70 | #. ``thumb/armv7-a``: ARMv7-A, Thumb-2 instruction set |
---|
[d755cbd] | 71 | |
---|
[f233256] | 72 | #. ``thumb/armv7-a/neon/hard``: ARMv7-A, Thumb-2 instruction set with |
---|
| 73 | hard-float ABI Neon and VFP-D32 support |
---|
[d755cbd] | 74 | |
---|
[f233256] | 75 | #. ``thumb/armv7-r``: ARMv7-R, Thumb-2 instruction set |
---|
[d755cbd] | 76 | |
---|
[f233256] | 77 | #. ``thumb/armv7-r/vfpv3-d16/hard``: ARMv7-R, Thumb-2 instruction set with |
---|
| 78 | hard-float ABI VFP-D16 support |
---|
[d755cbd] | 79 | |
---|
[f233256] | 80 | #. ``thumb/armv7-m``: ARMv7-M, Thumb-2 instruction set with hardware |
---|
| 81 | integer division (SDIV/UDIV) |
---|
[d755cbd] | 82 | |
---|
[f233256] | 83 | #. ``thumb/armv7-m/fpv4-sp-d16``: ARMv7-M, Thumb-2 instruction set with |
---|
| 84 | hardware integer division (SDIV/UDIV) and hard-float ABI FPv4-SP support |
---|
[d755cbd] | 85 | |
---|
[c1d296a] | 86 | #. ``thumb/cortex-m7/fpv5-d16``: Cortex-M7, Thumb-2 instruction set with |
---|
| 87 | hard-float ABI and FPv5-D16 support |
---|
| 88 | |
---|
[f233256] | 89 | #. ``eb/thumb/armv7-r``: ARMv7-R, Big-endian Thumb-2 instruction set |
---|
[d755cbd] | 90 | |
---|
[f233256] | 91 | #. ``eb/thumb/armv7-r/vfpv3-d16/hard``: ARMv7-R, Big-endian Thumb-2 instruction |
---|
| 92 | set with hard-float ABI VFP-D16 support |
---|
[d755cbd] | 93 | |
---|
[c1d296a] | 94 | Multilib 1., 2. and 3. support the standard ARM7TDMI and ARM926EJ-S processors. |
---|
[d755cbd] | 95 | |
---|
[c1d296a] | 96 | Multilib 4. supports the Cortex-M0 and Cortex-M1 cores. |
---|
[d755cbd] | 97 | |
---|
[c1d296a] | 98 | Multilib 9. supports the Cortex-M3 and Cortex-M4 cores, which have a special |
---|
[d755cbd] | 99 | hardware integer division instruction (this is not present in the A and R |
---|
| 100 | profiles). |
---|
| 101 | |
---|
[c1d296a] | 102 | Multilib 10. supports the Cortex-M4 cores with a floating point unit. |
---|
| 103 | |
---|
| 104 | Multilib 11. supports the Cortex-M7 cores with a floating point unit. |
---|
[d755cbd] | 105 | |
---|
[c1d296a] | 106 | Multilib 5. and 6. support the Cortex-A processors. |
---|
[d755cbd] | 107 | |
---|
[c1d296a] | 108 | Multilib 7., 8., 12. and 13. support the Cortex-R processors. Here also |
---|
[d755cbd] | 109 | big-endian variants are available. |
---|
| 110 | |
---|
[f233256] | 111 | Use for example the following GCC options: |
---|
| 112 | |
---|
| 113 | .. code-block:: shell |
---|
[d755cbd] | 114 | |
---|
| 115 | -mthumb -march=armv7-a -mfpu=neon -mfloat-abi=hard -mtune=cortex-a9 |
---|
| 116 | |
---|
| 117 | to build an application or BSP for the ARMv7-A architecture and tune the code |
---|
| 118 | for a Cortex-A9 processor. It is important to select the options used for the |
---|
[f233256] | 119 | multilibs. For example: |
---|
| 120 | |
---|
| 121 | .. code-block:: shell |
---|
[d755cbd] | 122 | |
---|
| 123 | -mthumb -mcpu=cortex-a9 |
---|
| 124 | |
---|
| 125 | alone will not select the ARMv7-A multilib. |
---|
| 126 | |
---|
| 127 | Calling Conventions |
---|
| 128 | =================== |
---|
| 129 | |
---|
[f233256] | 130 | Please refer to the *Procedure Call Standard for the ARM Architecture* |
---|
| 131 | (http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042c/IHI0042C_aapcs.pdf). |
---|
[d755cbd] | 132 | |
---|
| 133 | Memory Model |
---|
| 134 | ============ |
---|
| 135 | |
---|
| 136 | A flat 32-bit memory model is supported. The board support package must take |
---|
| 137 | care about the MMU if necessary. |
---|
| 138 | |
---|
| 139 | Interrupt Processing |
---|
| 140 | ==================== |
---|
| 141 | |
---|
| 142 | The ARMv4T (and compatible) architecture has seven exception types: |
---|
| 143 | |
---|
| 144 | - Reset |
---|
| 145 | |
---|
| 146 | - Undefined |
---|
| 147 | |
---|
| 148 | - Software Interrupt (SWI) |
---|
| 149 | |
---|
| 150 | - Prefetch Abort |
---|
| 151 | |
---|
| 152 | - Data Abort |
---|
| 153 | |
---|
| 154 | - Interrupt (IRQ) |
---|
| 155 | |
---|
| 156 | - Fast Interrupt (FIQ) |
---|
| 157 | |
---|
| 158 | Of these types only the IRQ has explicit operating system support. It is |
---|
| 159 | intentional that the FIQ is not supported by the operating system. Without |
---|
| 160 | operating system support for the FIQ it is not necessary to disable them during |
---|
| 161 | critical sections of the system. |
---|
| 162 | |
---|
| 163 | The ARMv7-M architecture has a completely different exception model. Here |
---|
[f233256] | 164 | interrupts are disabled with a write of 0x80 to the ``basepri_max`` register. |
---|
| 165 | This means that all exceptions and interrupts with a priority value of greater |
---|
| 166 | than or equal to 0x80 are disabled. Thus exceptions and interrupts with a |
---|
| 167 | priority value of less than 0x80 are non-maskable with respect to the operating |
---|
| 168 | system and therefore must not use operating system services. Several support |
---|
| 169 | libraries of chip vendors implicitly shift the priority value somehow before |
---|
| 170 | the value is written to the NVIC IPR register. This can easily lead to |
---|
[d755cbd] | 171 | confusion. |
---|
| 172 | |
---|
| 173 | Interrupt Levels |
---|
| 174 | ---------------- |
---|
| 175 | |
---|
| 176 | There are exactly two interrupt levels on ARM with respect to RTEMS. Level |
---|
| 177 | zero corresponds to interrupts enabled. Level one corresponds to interrupts |
---|
| 178 | disabled. |
---|
| 179 | |
---|
| 180 | Interrupt Stack |
---|
| 181 | --------------- |
---|
| 182 | |
---|
| 183 | The board support package must initialize the interrupt stack. The memory for |
---|
| 184 | the stacks is usually reserved in the linker script. |
---|
| 185 | |
---|
| 186 | Default Fatal Error Processing |
---|
| 187 | ============================== |
---|
| 188 | |
---|
[f233256] | 189 | The default fatal error handler for this architecture performs the following |
---|
| 190 | actions: |
---|
[d755cbd] | 191 | |
---|
| 192 | - disables operating system supported interrupts (IRQ), |
---|
| 193 | |
---|
| 194 | - places the error code in ``r0``, and |
---|
| 195 | |
---|
| 196 | - executes an infinite loop to simulate a halt processor instruction. |
---|
| 197 | |
---|
| 198 | Symmetric Multiprocessing |
---|
| 199 | ========================= |
---|
| 200 | |
---|
[87e1929] | 201 | SMP is supported on ARMv7-A. Available platforms are |
---|
| 202 | |
---|
| 203 | - Altera Cyclone V, |
---|
| 204 | |
---|
| 205 | - NXP i.MX 7, and |
---|
| 206 | |
---|
| 207 | - Xilinx Zynq. |
---|
[d755cbd] | 208 | |
---|
| 209 | Thread-Local Storage |
---|
| 210 | ==================== |
---|
| 211 | |
---|
| 212 | Thread-local storage is supported. |
---|