AdaCore / bb-runtimes

Source repository for the GNAT Bare Metal BSPs
Other
65 stars 51 forks source link

Runtime does not compile when Has_FPU is set to False #43

Closed NicoPy closed 4 years ago

NicoPy commented 4 years ago

Hi,

To do some tests, I need to compile the runtime (ravenscar full) with soft Float instead of hard Float. Here is what I did :

Setting _HasFPU to False makes the runtime compilation fail :

C:\Users\Nicolas\AppData\Local\Temp\cctSKb2B.s: Assembler messages:
C:\Users\Nicolas\AppData\Local\Temp\cctSKb2B.s:83: Error: selected FPU does not support instruction -- `vstmdbeq r12!,{s16-s31}'
C:\Users\Nicolas\AppData\Local\Temp\cctSKb2B.s:94: Error: selected FPU does not support instruction -- `vldmiane r12!,{s16-s31}'

This error is not a surprise since I instructed the compiler to not use hard float instructions (-msoft-float switch).

However, setting _HasFPU to False makes the runtime compilation fail :

s-statxd.adb:396:22: construct not allowed in configurable run-time mode
s-statxd.adb:396:22: file s-fatflt.ads not found
s-statxd.adb:396:22: entity "System.Fat_Flt.Attr_Float" not available

When I fix this error by manually disabling Streams, the same error rises again somewhere else.

How can I fix this problem ?

NicoPy commented 4 years ago

I have understood how the FPU configuration works (for ARM architecture). Here it is for reference.

cortexm.py is used to configure the runtime sources/configuration :

In _s-bbparaxxxx.ads_ the constant _HasFPU is indirectly related to the runtime configuration. When _HasFPU is True, the floating point context is saved/restored in _Pend_SVHandler() (_s-bcpcstpendsv.adb_).


To be more complete : _has_double_precisionfpu() _has_single_precisionfpu() --> compiler switch _HasFPU
False False --> soft float -msoft-float False
False True --> single precision : hard
double precision : soft
-mfpu=xxx True
True False --> single precision : soft
double precision : hard
-mfpu=xxx True
True True --> single precision : hard
double precision : hard
-mfpu=xxx True
Fabien-Chouteau commented 4 years ago

Hi @NicoPy, I am glad you found the answer :)