在ARM cortex-a系列上启用neon [英] Enable neon on ARM cortex-a series

查看:30
本文介绍了在ARM cortex-a系列上启用neon的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在裸机皮质 A-15 上初始化 NEON cp.按照 ARM 的指令 我在平台初始化序列的末尾写了这个序列:

I want to initialize on a bare metal cortex A-15 the NEON cp. After following ARM's directives I wrote this sequence at the end of my platform init sequence:

MOV r0, #0x00F00000
MRC p15, 0, r0, c1, c1, 2
ORR r0, r0, #0x0C00 
BIC r0, r0, #0xC000 
MCR p15, 0, r0, c1, c1, 2
ISB
MRC p15, 4, r0, c1, c1, 2
BIC r0, r0,  #0x0C00
BIC r0, r0, #(3<<14)
MCR p15, 4, r0, c1, c1, 2
ISB
MOV r3, #0x40000000
VMSR FPEXC, r3

我收到此错误:

Error: operand 0 must be FPSCR -- `vmsr FPEXC,r3'

我正在使用 arm-eabi-as --version:

GNU assembler (GNU Binutils) 2.21
Copyright 2010 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `arm-eabi'.

如果我将 FPEXC 更改为 FPSCR 程序将编译并且正在运行的引发 unhandler 异常:

If I change FPEXC to FPSCR the program compiles and the running raise unhandler exception:

MRC p15, 4, r0, c1, c1, 2

推荐答案

可以在 u-boot.

A sequence for initializing the VFPU can be found in u-boot source.

.macro init_vfpu
  ldr r0, =(0xF << 20)
  mcr p15, 0, r0, c1, c0, 2
  mov r3, #0x40000000
  .long 0xeee83a10
  /* vmsr FPEXC, r3 */
.endm /* init_vfpu */

binutils 邮件列表vmsr FPEXC 错误已在 binutils 中修复 2.23 分支 以及 HEAD 和 2.24 开发分支不久发布.binutils 的 2.23.1 和 2.23.2 版本中存在修复.

As documented in the binutils mailing list, the vmsr FPEXC bug has been fixed in the binutils 2.23 branch as well as the HEAD and the 2.24 development branch which will be released shortly. Fixes exist in the 2.23.1 and 2.23.2 releases of binutils.

这是一个示例会话,

$ cat t.S
init_vpu:
  ldr r0, =(0xF << 20)
  mcr p15, 0, r0, c1, c0, 2
  mov r3, #0x40000000
  vmsr FPEXC, r3
  bx  lr
  .ltorg
$ arm-none-linux-gnueabi-as -march=armv7-a -mcpu=cortex-a15 -mfpu=neon t.S -o t.o
$ arm-none-linux-gnueabi-as --version | grep assembler
GNU assembler (crosstool-NG hg+default-86a8d1d467c8) 2.23.1
This assembler was configured for a target of `arm-none-linux-gnueabi'.
$ objdump --version | grep Binutils
GNU objdump (GNU Binutils for Ubuntu) 2.23.2
$ objdump -S t.o 

t.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <init_vpu>:
   0:   e3a0060f        mov     r0, #15728640   ; 0xf00000
   4:   ee010f50        mcr     15, 0, r0, cr1, cr0, {2}
   8:   e3a03101        mov     r3, #1073741824 ; 0x40000000
   c:   eee83a10        vmsr    fpexc, r3
  10:   e12fff1e        bx      lr

上述序列应该适用于所有 Cortex-A 系列.该序列适用于没有 虚拟化TrustZone 活动的系统.

The above sequence should work for all of the Cortex-A series. The sequence is for a system without virtualization or TrustZone active.

这篇关于在ARM cortex-a系列上启用neon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆