djunho
djunho

Reputation: 23

floating point library on cortex-m0plus

I am working on a project that uses dynamic relocations, it works fine for the Cortex-M4, but I am having some problems with the Cortex-M0+.

The problems are occuring with the symbols of the functions of floating point. This cores do not have floating point unit.

So I was trying to understand the difference between the codes generated of the two cores (M4 and M0+).

The code is this:

#include <stdint.h>
#include <math.h>           // <fastmath.h>

float a, b, c; //, d, e;

void ldMain(void)
{
    a = 1.100000f + a;
    b = 1.100000f - b;
    c = 1.100000f * c;
    //d = 1.100000f / d;
}

The commands to compile and linking are these:

arm-none-eabi-gcc.exe -c TESTE.c -o TESTE.o0 -mthumb -mcpu=cortex-m0plus -O0 -mlong-calls -mword-relocations -mabi=atpcs -mfloat-abi=soft -mcaller-super-interworking

arm-none-eabi-ld.exe -o TESTE.o TESTE.o0 --relocatable --strip-all --discard-all --embedded-relocs

The symbols that are generated are (get with arm-none-eabi-readelf):

Relocation section '.rel.text' at offset 0x2e4 contains 6 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000028  00000b02 R_ARM_ABS32       00000004   a
0000002c  00000c02 R_ARM_ABS32       00000000   __addsf3
00000034  00000602 R_ARM_ABS32       00000004   b
00000038  00000802 R_ARM_ABS32       00000000   __subsf3
0000003c  00000902 R_ARM_ABS32       00000004   c
00000040  00000a02 R_ARM_ABS32       00000000   __mulsf3

Independent of the flag -mcpu=cortex-m0plus or -mcpu=cortex-m4 used on the gcc command, the symbols generated are the same.

The problem is that these symbols appear does not exist on cortex-m0plus.

The libgcc of cortex-m0plus (armv6-m) located at C:\Program Files (x86)\GNU Tools ARM Embedded\4.9 2015q2\lib\gcc\arm-none-eabi\4.9.3\armv6-m not have these symbols. It was verified with the command arm-none-eabi-nm.

Does anyone know why these symbols are used if they do not exist for the cortex-m0plus?

I am using the version 4.9 2015q2 of the GCC ARM Embedded.

Upvotes: 2

Views: 1504

Answers (1)

Richard at ImageCraft
Richard at ImageCraft

Reputation: 665

These functions are defined in GCC glibc (either newlib or nanolib). This post is almost 4 years old, and I do not have experience with the 2015 GCC. However, the recent (e.g. 2018 etc.) GCC definitely has these FP software routines in the libraries.

Upvotes: 0

Related Questions