grblHAL / core

grblHAL core code and master Wiki
Other
304 stars 73 forks source link

Soft Float Point Emulation #451

Closed Schildkroet closed 4 months ago

Schildkroet commented 4 months ago

Hello, i am currently performing some optimization task about FPU and it seems grblHAL also (sometimes) uses emulated soft floating point arrithmetic (instead of hardware FPU).

In the symbol table you can see it links in soft floating point routines like __adddf3, __subdf3 etc. image

In the listing you can see where it is called e.g. mc_arc:

0800fa70 <mc_arc>:
 800fa70:   e92d 4ff0   stmdb   sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
 800fa74:   b0a1        sub sp, #132    ; 0x84
 [...]
 800fae6:   463b        mov r3, r7
 800fae8:   f7f8 fb18   bl  800811c <__adddf3>
 800faec:   19a3        adds    r3, r4, r6
[...]
 800fb00:   462b        mov r3, r5
 800fb02:   f7f8 fb0b   bl  800811c <__adddf3>
 800fb06:   9b04        ldr r3, [sp, #16]

If you want to use FPU, you have to mark ALL functions from math.h with f-postfix, so the use float+FPU instead of double emulation.

terjeio commented 4 months ago

I deliberately use double there to avoid rare arc errors due to rounding.

Schildkroet commented 4 months ago

Good to know float already reaches it limits