z88dk + rc2014 + cpm : Error : Unable to compile: undefined symbol: ___fsadd_callee

337 views
Skip to first unread message

Jo Ga

unread,
Sep 12, 2022, 7:29:29 AM9/12/22
to RC2014-Z80
New install, z88dk, cloned from git following the documentation.

the default test does compile with consist an empty main with a return.

Trying to do some additions/ subtractions. if i comment the lines doing the operations, the code compile and link.

I have tried several different combinations of parameters for the zcc and every one is giving me a problem. 
I did review the build log for the z88dk and i didn't see any problem.



Errors:

make
zcc +rc2014 -subtype=cpm -v -m --list -obin/test source/test.c

PROCESSING source/test.c
z88dk-zsdcpp -iquote"." -D__Z88DK -D__RC2014 -D__Z80 -D__SDCC -D__SDCC_IY -isystem"/home/jlgv/z88dk/lib/config//../..//include/_DEVELOPMENT/sdcc"  -D__SDCC  "source/test.c" "/tmp/tmpXXScdMY3.i2"
z88dk-zpragma -zcc-opt="/tmp/tmpzccXXFgHPg4/zcc_opt.def" < "/tmp/tmpXXScdMY3.i2" > "/tmp/tmpXXScdMY3.i"
z88dk-zsdcc --constseg rodata_compiler   --allow-unsafe-read --reserve-regs-iy -mz80 --no-optsdcc-in-asm --c1mode --emit-externs  --no-c-code-in-asm   --no-peep --peep-file "/home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/sdcc_peeph.2"  < "/tmp/tmpXXScdMY3.i" -o "/tmp/tmpXXScdMY3.opt"
z88dk-copt  "/home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/sdcc_opt.1" < "/tmp/tmpXXScdMY3.op1" > "/tmp/tmpXXScdMY3.opt"
z88dk-copt  "/home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/sdcc_opt.9" < "/tmp/tmpXXScdMY3.opt" > "/tmp/tmpXXScdMY3.op1"
z88dk-copt  "/home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/sdcc_opt.2" < "/tmp/tmpXXScdMY3.op1" > "/tmp/tmpXXScdMY3.asm"
cat "/tmp/tmpXXScdMY3.asm" >> "/tmp/tmpXXScdMY3.tmp"
cat "/tmp/tmpXXScdMY3.tmp" >> "/tmp/tmpXXScdMY3.asm"
z88dk-z80asm -D__SDCC_IY -I"/home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/target/rc2014" -I"/tmp/tmpzccXXFgHPg4" -D__SDCC -l   -s  -mz80 -I"/home/jlgv/z88dk/lib/config//../..//lib" "/tmp/tmpXXScdMY3.asm"

PROCESSING /home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/target/rc2014/rc2014_crt.asm.m4
m4 -I "/home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/target/rc2014" -I "/tmp/tmpzccXXFgHPg4" -I "/home/jlgv/z88dk/lib/config//../..//src/m4"  --define=__STARTUP=64  < "/home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/target/rc2014/rc2014_crt.asm.m4" > "/tmp/tmpXXsXUnf6.asm"
cat "/tmp/tmpXXsXUnf6.asm" >> "/tmp/tmpXXsXUnf6.tmp"
cat "/tmp/tmpXXsXUnf6.tmp" >> "/tmp/tmpXXsXUnf6.asm"
WILL ACT AS CRT

GENERATING OUTPUT
cat "/tmp/tmpXXScdMY3.lis" >> "source/test.c.lis"

PROCESSING CRT
z88dk-z80asm -D__SDCC_IY -I"/home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/target/rc2014" -I"/tmp/tmpzccXXFgHPg4" -D__SDCC -l   -s  -mz80 -I"/home/jlgv/z88dk/lib/config//../..//lib" "/tmp/tmpXXsXUnf6.asm"

z88dk-z80asm -mz80 -b -d  -o"bin/test" -m -L.  -L"/home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/lib/sdcc_iy"   -D__SDCC_IY -I"/home/jlgv/z88dk/lib/config//../..//libsrc/_DEVELOPMENT/target/rc2014" -I"/tmp/tmpzccXXFgHPg4" -D__SDCC -l  -lrc2014    "/tmp/tmpXXsXUnf6.o" "/tmp/tmpXXScdMY3.o"
source/test.c:567: error: undefined symbol: ___fslt_callee
  ^---- ___fslt_callee
source/test.c:579: error: undefined symbol: ___fsadd_callee
  ^---- ___fsadd_callee
cat "/tmp/tmpXXsXUnf6.lis" >> "bin/test.lis"
make: *** [Makefile:42: all] Error 1


Code: is from a classics book "The C programming Language", should compile and link.

What i'm missing or what change i need to do the make, zcc 

#include <stdio.h>

int main (void) {
    int lower, upper, step;
    float fa,ce;

   
    lower = 0;
    upper = 300;
    step = 20;
   
    printf("Converting F Celcius   \n" );
   
    fa = lower;
   

    while ( fa <= upper ) {
        /*ce = ( 5.0/9.0) * ( fa -32.0);
        printf(" %4.0f %6.1f \n",fa,ce); */
        ce = 0;
        fa = fa + step;
       
    }
   
    return 0;
}



Phillip Stevens

unread,
Sep 12, 2022, 7:37:07 AM9/12/22
to RC2014-Z80
You just need to choose a floating point library.
Add —math32 to the command line. 

More info here.

Jo Ga

unread,
Sep 12, 2022, 8:14:47 AM9/12/22
to rc201...@googlegroups.com
Thank you for the information, that combination is working, and is able to compile and link. 

I will transfer the program to the RC2014 to test if it is running.
my cFLAGS are.

+rc2014 -subtype=cpm -v -m --list --math32

and thank you for the link.

Do you think I should be using the "sdcc" as a compiler for the rc2014, cpm, 512K/512K?

Jose.


--
You received this message because you are subscribed to a topic in the Google Groups "RC2014-Z80" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rc2014-z80/h9bNCIHrTBI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/8409ba92-e323-4a30-b1c9-166fb4f04498n%40googlegroups.com.

Phillip Stevens

unread,
Sep 12, 2022, 8:25:40 AM9/12/22
to RC2014-Z80
Jose wrote:
Thank you for the information, that combination is working, and is able to compile and link. 
I will transfer the program to the RC2014 to test if it is running.
my cFLAGS are.

+rc2014 -subtype=cpm -v -m --list --math32

and thank you for the link.

Do you think I should be using the "sdcc" as a compiler for the rc2014, cpm, 512K/512K?

There is a wiki for RC2014 here.

For pure CP/M applications it is possibly better to use the CPM target.
This supports access to file system too.

There’s lots of choice. Two compilers. Two libraries. Multiple math libraries.
The benchmarks offer some ideas on the options and their relevance.




Jo Ga

unread,
Sep 12, 2022, 11:52:44 AM9/12/22
to rc201...@googlegroups.com
Thank you for your help. I will see what combinations that better work for me.
The environment is new and z88dk is also new. 

Jose.


--
You received this message because you are subscribed to a topic in the Google Groups "RC2014-Z80" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rc2014-z80/h9bNCIHrTBI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rc2014-z80+...@googlegroups.com.

Phillip Stevens

unread,
Sep 12, 2022, 9:25:00 PM9/12/22
to RC2014-Z80
Jose wrote:
Thank you for your help. I will see what combinations that better work for me.
The environment is new and z88dk is also new.

z88dk can be a bit of a jungle, as it supports over 100 classic Intel and Zilog machines. Initially, it is just about beating the shortest path to the destination. But later you may find interesting enjoyable places by just wandering around and reading the code base.

Usually, the default for a particular target + subtype is a good place to start. But depending on how deep you want to go, there's a lot to explore.

Generally... 
  • sdcc together with the sdcc_iy library works best for newlib targets. sdcc uses IX as its stack index, so it can be quite slow compared to other stack management mechanisms.
  • The sdcc_ix library should be avoided as this implies sharing the IX register between library and compiler which means it needs to preserved (overhead) on each function call.
  • sccz80 is the only option for 8080, 8085, or GBZ80 targets. It uses HL to access the stack.
  • The classic library (default for CP/M target) can access the CP/M file system. The newlib libraries can't do this, so if you want to read CP/M files then avoid new, sdcc_ix, sdcc_iy libraries.
  • If you're using CP/M on hbios (with the 512k/512k Module), then you can access any remaining FATFS disk space from within CP/M by using +rc2014 subtype=hbios). But as this is newlib it can't access CP/M files at the same time.

Development direction...
  • The goal for z88dk is to integrate the advanced features of newlib into classic. It may be a few years before this is completed though.
  • In practice this means moving classic code into newlib, and code sharing wherever possible.
  • It is quite complex to do this within the limits of 8080/85 and GBZ80 processors vs Z180 and Z80N, and Rabbit processors, as newlib library code takes advantage of index registers in many places.
  • Currently, it is just the stdio functions that remain separate. Most everything else has been completed.
  • Helpfully, z80asm has the ability to process assembly to produce different byte codes depending on the machine type selected. This allows us to unify code between 8080, 8085, and gbz80 to a great extent. ( Eg depending on the machine a JR instruction converts to JP. A LD (HL+),A converts to LD (HL),A  INC HL  ). Just the index register and alternate register usage in newlib remains a difficulty.

And for floating point maths...
  • The genmath library is useful for specific classic targets and was the first floating point solution, and is therefore the default for the classic library: -lm 
  • The math48 library is the default for newlib -lm, but from classic it needs to be linked over with -lmath48. It is the most accurate (40 bit mantissa), but because of the amount of data it needs to shuffle it can be slow. sdcc can't use its additional accuracy of IEEE single precision.
  • The math32 library was written to take advantage of Z180 hardware and Z80N (Spectrum Next) hardware --math32, and to be useful with sdcc at IEEE single precision 24 bit mantissa resolution. It is generally quite fast for Z80 machines and I'm quite proud of this work.
  • In the classic library there are a number of other math libraries that will work with sccz80. If you'd like to use them then you should use the classic CP/M with sccz80, and just link in the preferred option.

And some other hints, if you're using classic library...
  • The format conversion for width (eg %04d for a 4 character wide decimal) is not automatically linked to save space (%d is default). So it needs to be declared in a #pragma for any format conversion type.
  • To avoid linking the full file access capabilities in CP/M then use -lndos to link some stubs (which will override the default). This makes the binary smaller.

Ok, just ask if you've any questions.

Cheers, Phillip

Jo Ga

unread,
Sep 13, 2022, 9:25:34 PM9/13/22
to rc201...@googlegroups.com


Quick question:
 In my test the printf formatting for float any of them are not working. 
  Any printf(“ %6.2f “, f);  where f is a float is not printing
  Already added the —math32 , 
  Other numbers int int16 etc are ok. I’m using the same program

Jose.



On Sep 12, 2022, at 11:52 AM, Jo Ga <jlgv...@gmail.com> wrote:



Phillip Stevens

unread,
Sep 13, 2022, 9:51:28 PM9/13/22
to RC2014-Z80
Jose wrote:
Quick question:
 In my test the printf formatting for float any of them are not working. 
  Any printf(“ %6.2f “, f);  where f is a float is not printing
  Already added the —math32 , 
  Other numbers int int16 etc are ok. I’m using the same program

You need to enable those conversions using a #pragma as described here.
 

Jo Ga

unread,
Sep 14, 2022, 4:05:33 PM9/14/22
to rc201...@googlegroups.com
Thank you again. I was looking over the functions printf  and others that normally use formating, and I was not able to find it.
I was under the impression my z88dk had a bug. 
I will continue my learning journey, which has been slower than I anticipated , but I will keep moving forward. Thank you and a huge amount of others following the group and helping.

Thank you.

--
You received this message because you are subscribed to a topic in the Google Groups "RC2014-Z80" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rc2014-z80/h9bNCIHrTBI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rc2014-z80+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages