How to declare a global float register for ARMCC

For a power conversion application, we need to perform various floating point calculations on the ARM Cortex-M4 platform as quickly as possible.

We are developing with Keil uVision.

We would like to declare some variables as register variables, but get nothing but compiler errors.

It seems like this would be very useful since the FPU has 32 registers, and we could save a lot of cycles by storing our data in these registers, rather than rebooting from RAM every time our ISR is called.

We tried to use:

register float a1 __asm__("s0");

but get an error: unknown register name "s0"

It seems strange because in the debugger interface I see that the compiler uses the s0 register. If I declare the register as "r0", there is no error, so it seems that there is some support for FPU somewhere, but I don’t know where.

I look at the Assembler control line and it seems to be supported by floating point:

--cpu Cortex-M4.fp --pd "__EVAL SETA 1" -g --apcs=interwork 
-I D:\my_project
-I D:\Keil_v5\ARM\PACK\ARM\CMSIS\4.4.0\CMSIS\Include 

We also tried:

__global_freg(1) float a1;

That didn't work either.

Any ideas?

+4
source share
1 answer

You must comply with the EABI described in detail here: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf

, ( ) s16-s31. .

, , ISR VFP . , , - VFP .

0

Source: https://habr.com/ru/post/1609794/


All Articles