Shop OBEX P1 Docs P2 Docs Learn Events
Question about fpu_cog — Parallax Forums

Question about fpu_cog

ReinhardReinhard Posts: 489
edited 2014-06-11 12:33 in Propeller 1
Hello Forum,
in the html - documentation for simpletools library v0.96.1 I read something about fpu_cog.
not so in the v0.98.

Is this functionality supported ?

I try this, after I read the source of fpucog.c
#include "simpletools.h"

int main(void)
{
  int cog = start_fpu_cog();
  int32_t A = asInt(0.5);
  int32_t B = asInt(2.0);
  uint64_t C =  doCmdxx( A,  B, CMD_FMUL;
  double D = asDouble(C);
  stop_fpu_cog();

  return 0;
}

but the build was not successful
/tmp/ccuTpTEU.o: In function `_main':

 (.text+0x3): undefined reference to `_start_fpu_cog'

 /tmp/ccuTpTEU.o: In function `_main':
 (.text+0xb): undefined reference to `_asInt'
 /tmp/ccuTpTEU.o: In function `_main':
 (.text+0x17): undefined reference to `_asInt'
 /tmp/ccuTpTEU.o: In function `_main':
 (.text+0x1f): undefined reference to `_doCmdxx'
 /tmp/ccuTpTEU.o: In function `_main':
 (.text+0x27): undefined reference to `_asDouble'
 /tmp/ccuTpTEU.o: In function `_main':
 (.text+0x2a): undefined reference to `_stop_fpu_cog'
 collect2: ld returned 1 exit status
 Done. Build Failed!




Seems that libsimpletools.a not include this code ?

Or what do I wrong ?

Comments

  • jazzedjazzed Posts: 11,803
    edited 2014-06-11 08:50
    Automatic fpucog.c support appears to have been deprecated in the library because of some function issue. I don't recall what it was, and it was never reported.

    To include fpucog.c support today, it must be added to the project.

    The other thing is that fpucog.c functions are not meant to be called. They should be included automatically to speed up floating point and reduce code size.
  • ReinhardReinhard Posts: 489
    edited 2014-06-11 09:17
    Ok, it seems I have a old version from fpucog.c
    But one issue is not clear for me
    The other thing is that fpucog.c functions are not meant to be called. They should be included automatically to speed up floating point and reduce code size.
    If I start a new fpucog, whence know the cog what I will do (add,sub,mul,somewhat) ?
    What is the interface for operations ?
  • jazzedjazzed Posts: 11,803
    edited 2014-06-11 12:14
    Reinhard wrote: »
    Ok, it seems I have a old version from fpucog.c
    But one issue is not clear for me

    If I start a new fpucog, whence know the cog what I will do (add,sub,mul,somewhat) ?
    What is the interface for operations ?


    The interface is the fpucog.c constructor function. Everything that requires floating point operations defined in the file will use those functions. Without fpucog.c in the project, the default floating point library will be used.
  • ReinhardReinhard Posts: 489
    edited 2014-06-11 12:24
    So easy
    In simple;-)) words for my understand:

    If the fpucog is started, any line of code like
    res = 0.5 * 2.0
    is performed by the fpu coprocessor.

    brilliant







    .
  • jazzedjazzed Posts: 11,803
    edited 2014-06-11 12:33
    Eric is the brilliant one who added the feature. The constructor methodology is standard in GCC.
Sign In or Register to comment.