VYbrid FPU

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VYbrid FPU

Jump to solution
1,668 Views
jackdean
Contributor I

I can't seem to make the FPU in the VYBrid work.

If I enable it, the cpu hangs on the first FPU instruction.

I'm only setting --fpu-VFPv4 in the DS-5 code generation page.

I get code, but the board instantly crashes, and must be power off to reset; the reset button has not effect.

Any clues?

0 Kudos
Reply
1 Solution
1,291 Views
kef2
Senior Contributor V

Oh, I have

--cpu=Cortex-A5.neon

and am using Neon features as well.

View solution in original post

0 Kudos
Reply
4 Replies
1,292 Views
kef2
Senior Contributor V

Oh, I have

--cpu=Cortex-A5.neon

and am using Neon features as well.

0 Kudos
Reply
1,291 Views
jackdean
Contributor I

Thank you for your help and input.

0 Kudos
Reply
1,291 Views
kef2
Senior Contributor V

Fore some weird reason DS-5 doesn't care about enabling FPU. You need to have something like this in your startup file:

     MRC p15, 0, r0, c1, c1, 2
     ORR r0, r0, #(3<<10)            ; //enable fpu
     MCR p15, 0, r0, c1, c1, 2
     ;//2. Set the CPACR for access to CP10 and CP11:
     MOV r0, #(0xF << 20)
     MCR p15, 0, r0, c1, c0, 2
     ;//3. Set the FPEXC EN bit to enable the FPU:

     MOV R3, #0x40000000
     VMSR FPEXC, R3

0 Kudos
Reply
1,291 Views
jackdean
Contributor I

Hi Edward,

Thank you for your reply.

I had this:

        ; CPACR is located at address 0xE000ED88

        LDR.W   R0, =0xE000ED88

        ; Read CPACR

        LDR     R1, [R0]

        ; Set bits 20-23 to enable CP10 and CP11 coprocessors

        ORR     R1, R1, #(0xF << 20)

        ; Write back the modified value to the CPACR

        STR     R1, [R0]; wait for store to complete

        DSB

        ;reset pipeline now the FPU is enabled

        ISB

Which is from ARM. With your suggestion I get this error:

"F:/VYBrid/Whetstone/src/cpu/crt0_armcc.s", line 120: Error: A1854E: Unknown opcode 'VMSR', maybe wrong target CPU?

with

-DTOWER -DARMCC_A5 -I../../../../../src/common -I../../../../../src/drivers/ccm -I../../../../../src/cpu/header/CMSIS -I../../../../../src/cpu/header -I../../../../../src/cpu -I../../../../../src/platforms -I../../../../../src/drivers/ddr -I../../../../../src/drivers/serial -I../../../../../src/drivers/lptmr -I../../../../../src/projects/Whetstone -O0 --cpu=Cortex-A5 --littleend --arm --fpu=vfpv4 -g --diag_suppress=1786

Thank you again.

j

0 Kudos
Reply