This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can keil compiled library be used in segger embedded studio?

dear all 

    Can keil compiled library be used in segger embedded studio? For example, I have a paw8001_ ofn114009_ 12_ m4f_ keil.lib

Library, can I put it directly into NRF connect SDK project to compile?

Best Regards

Parents Reply Children
  • Yes, that should be no problem (but note that it must map the IC you use. For instance if the library is built to use floating point instructions you cannot use it with nRF5 devices that does not have and FPU, etc).

  • My current library just uses floating point operations,The device IC is nrf52840, my pri.conf is 
    CONFIG_FPU=y
    CONFIG_NEWLIB_LIBC=y
    CONFIG_CBPRINTF_FP_SUPPORT=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

    but There are many such errors when compiling the library

    Are there any good suggestions for me to solve these problems ?

    I found these functions in math. H, but I can't use them

    It seems to have something to do with this condition

    #if __ISO_C_VISIBLE >= 1999

    best regards

  • Hi,

    Have you attempted to build with CONFIG_COMPILER_OPT="-lm"?

    (In SES you add compiler options by clicking Extended Settings in the dialog  you get from Open nRF Connect SDK Project..., and then add it under Extra CMake Build Options)

  • hi 

    I put the config_ COMPILER_ Opt = - LM "into my pri.conf, the problem still exists, But there's one amazing thing,When I put the following code in *. C,Even though I don't make any calls。The compilation is successful。

    It looks like there's something wrong with the compiler。

    #include <math.h>

    #if(1)
    int compare(const void *, const void *);
    void test(void)
    {
    const char *a[10] = {"enter", "number", "size", "begin", "of", "cat", "case","program","certain","a"};
    float op;
    float result;
    op = 0.08;
    result= sqrtf(op);
    result= log10f(op);
    result= expf(op);
    result= cosf(op);
    qsort(a, 10, sizeof(a[0]), compare);
    result= tanf(op);
    result= sinf(op);
    result= logf(op);
    }

    int compare(const void *c, const void *d)
    {
    int m,n,r;
    char **a, **b; // !!
    a = (char **)c;
    b = (char **)d;
    m = strlen(*a);
    n = strlen(*b);
    r = m - n;
    if (r != 0)
    return r; 
    return memcmp(*a,*b,m); 
    }
    #endif

    best regards

  • Hi,

    It is good you have a work around, but it seems odd. I agree this seems like a compiler issue. I am not able to find any reference to this, but perhaps it is worth testing a different GCC version (though the workaround seems fair enough).

Related