简体   繁体   中英

Setup / Errors with Floating Point on TI AM3517 Cortex-A8

I'm getting an undefined instruction exception when executing:

   0xED2D8B0E         VPUSH    {D8-D14}

(Note: The statement was generated by the compiler as part of C language function entry protocol.)

Initialization code:

;; Initialize VFP (if needed).
;; BL      __iar_init_vfp  HJ REMOVED AND REPLACED WITH BELOW
 MRC    p15, #0, r1, c1, c0, #2         ; r1 = Access Control Register
 ORR    r1, r1, #(0xf << 20)            ; enable full access for p10,11
 MCR    p15, #0, r1, c1, c0, #2         ; Access Control Register = r1
 MOV    r1, #0
 MCR    p15, #0, r1, c7, c5, #4         ; flush prefetch buffer because of FMXR below
                                        ; and CP 10 & 11 were only just enabled
                                        ; Enable VFP itself
 MOV    r0,#0x40000000
 FMXR   FPEXC, r0                       ; FPEXC = r0

I get the undefined exception when the target FPU is set up as VFPv3 or VFPV3 + NEON.

The initialization code is placed in the "cstartup.c" file, at the __iar_program_start and ?cstartup code, following this code snippet:

MRC         p15,0,R1,C1,C0,0
LDR         R0,=CP_DIS_MASK      ;; 0xFFFFEFFA
AND         R1,R1,R0
ORR         R1,R1,#(1<<12)
MCR         p15,0,R1,C1,C0,0

Registers (before VPUSH):

CPSR:  0x80000113  
APSR:  0x80000000  
SPSR:  0x000001D3

Tools:

  • IAR Embedded Workbench IDE & Compiler - 7.40
  • I-Jet debugging probe
  • Zoom AM3517 eval board
  • TI AM35X Cortex-A8 processor

Questions:

  1. In the initialization code above, which statements are required for NEON and which for VFP?
  2. Are there any initialization instructions I'm missing for NEON and VFP initialization?
  3. Are there statements I need to place in the macro file for the debug probe?

The code presented in the question correctly initializes the floating point processor on a Cortex-A8 processor.

The issue of getting undefined instruction exception (which led up to this question), was caused by the OS writing an invalid value to the FPEXC register, causing the Floating Point Processor to be disabled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM