embeded/ARM2015. 1. 28. 08:39

neon을 쓰기 위해서는 kernel이나 uboot 등에서

FPU/NEON을 활성화 해야 하는 것으로 보인다.


The NEON/VFP unit comes up disabled on power on reset. To enable Neon requires some co-processor commands. Below is the assembly code required to enable NEON/VFP. It is in the gcc type syntax. ARM code tools use a slightly different syntax.


Neon and VFP both support floating point, which should I use?

The VFPv3 is fully compliant with IEEE 754

Neon is not fully compliant with IEEE 754, so it is mainly targeted for multimedia applications


[링크 : http://processors.wiki.ti.com/index.php/Cortex-A8]


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 */


[링크 : http://stackoverflow.com/questions/19231197/enable-neon-on-arm-cortex-a-series]


Using the Advanced SIMD and VFP in Secure state and Non-secure state other than Hyp mode

To use the Advanced SIMD and VFP in Secure state and Non-secure state other than Hyp mode, you must first define the NSACR, then define the CPACR and FPEXC registers. See Non-Secure Access Control RegisterCoprocessor Access Control Register, and Floating-Point Exception Register.

  1. Enable Non-secure access to CP10 and CP11 and clear the NSASEDIS bit in the NSACR:

    MRC p15, 0, r0, c1, c1, 2
    
    ORR r0, r0, #(3<<10)	    ; Enable Non-secure access to CP10 and CP11
    
    BIC r0, r0, #(3<<14)	    ; Clear NSASEDIS bit
    
    MCR p15, 0, r0, c1, c1, 2
    
    ISB
    
  2. Enable access to CP10 and CP11 and clear the ASEDIS bit in the CPACR:

    MOV r0, 0x00F00000
    
    MCR p15, 0, r0, c1, c0, 2
    
    ISB
    
  3. Set the FPEXC.EN bit to enable Advanced SIMD and VFP:

    MOV r3, #0x40000000
    
    VMSR FPEXC, r3


Kernel mode NEON

================


Introduction

------------

It is possible to use NEON instructions (and in some cases, VFP instructions) in code that runs in kernel mode. However, for performance reasons, the NEON/VFP register file is not preserved and restored at every context switch or taken exception like the normal register file is, so some manual intervention is required. Furthermore, special care is required for code that may sleep [i.e.,may call schedule()], as NEON or VFP instructions will be executed in a non-preemptible section for reasons outlined below.


[링크 : https://www.kernel.org/doc/Documentation/arm/kernel_mode_neon.txt] 



아무튼.. 커널 패치하고 make ARCH=arm menuconfig 로 살펴보니 Floatting point emulation에

(x86일 기본 make menuconfig에서는 보이지 않음)


이렇게 뚜둥! VFP 하위에 Advanced SIMD(NEON)이라고 똭!


머. 도움말은 별거 없다.

[링크 : http://cateee.net/lkddb/web-lkddb/NEON.html]

'embeded > ARM' 카테고리의 다른 글

i.mx515 SDMA  (0) 2015.02.02
armv7 errata / kernel  (0) 2015.01.28
armel / armhf  (0) 2015.01.26
ltib on ubuntu  (0) 2015.01.12
i.mx283 부팅모드  (0) 2015.01.09
Posted by 구차니