EtchedPixels / FUZIX

FuzixOS: Because Small Is Beautiful
Other
2.18k stars 272 forks source link

Missing resp. Incomplete functions in Raspberry pi Pico port #957

Open roman65536 opened 1 year ago

roman65536 commented 1 year ago

Tried to port Lua on Fuzix and looks like trigonometry Functions are incomplete :

arm-none-eabi-ld: ../../Library/libs/libmarmm0.a(sin.o): in function sin': /tmp/FUZIX2/FUZIX/Library/libs/sin.c:72: undefined reference tosin' arm-none-eabi-ld: /tmp/FUZIX2/FUZIX/Library/libs/sin.c:70: undefined reference to `rem_pio2' arm-none-eabi-ld: /tmp/FUZIX2/FUZIX/Library/libs/sin.c:73: undefined reference to __cos' arm-none-eabi-ld: /tmp/FUZIX2/FUZIX/Library/libs/sin.c:74: undefined reference tosin' arm-none-eabi-ld: /tmp/FUZIX2/FUZIX/Library/libs/sin.c:76: undefined reference to `cos'

longjmp/setjmp/mktime/strftime is also missing.

rgds roman

EtchedPixels commented 1 year ago

longjmp/setjmp are used by various base apps so definitely exist somewhere

strftime and mktime are not in the Fuzix libc. There is a mktime in Applications/util/setdate.c but it's GPLv2 not LGPL so can't go into the C library.

sin/cos is a bug in the library makefile I think. Some ports are not pulling in the helpers.

roman65536 commented 1 year ago

Found the longjmp/setjmp stuff, thanks for the hint.

sin/cos I think is more then just makefile. sin/cos has there helper functions sin/cos, they call __rem_pio2. In __rem_pio2 is an macro called "STRICT_ASSIGN" and that one is missing:

/tmp/FUZIX2/FUZIX$ find . -name .[chsS] -exec fgrep -H STRICT_ASSIGN {} \; ./Library/libs/__rem_pio2.c: STRICT_ASSIGN(double, fn, xinvpio2 + 0x1.8p52); ./Library/libs/__rem_pio2_large.c: STRICT_ASSIGN(double,fw,fw);

but was able to get around by steeling from https://github.com/micropython/micropython/tree/master/lib/libm_dbl :)