cancel
Showing results for 
Search instead for 
Did you mean: 

libPDMFilter_GCC.a (pdm_filter.o) does not uses VFP

lin
Associate II
Posted on November 08, 2012 at 03:36

How I can build my application with STM32F4-Discovery_FW_V1.1.0 in VFP notification?

arm-none-eabi-ar -r libstm32f4.a misc.o stm32f4xx_dma.o stm32f4xx_rcc.o stm32f4xx_adc.o stm32f4xx_exti.o stm32f4xx_rng.o stm32f4xx_can.o stm32f4xx_flash.o stm32f4xx_rtc.o stm32f4xx_crc.o stm32f4xx_fsmc.o stm32f4xx_sdio.o stm32f4xx_cryp_aes.o stm32f4xx_gpio.o stm32f4xx_spi.o stm32f4xx_cryp.o stm32f4xx_hash.o stm32f4xx_syscfg.o stm32f4xx_cryp_des.o stm32f4xx_hash_md5.o stm32f4xx_tim.o stm32f4xx_cryp_tdes.o stm32f4xx_hash_sha1.o stm32f4xx_usart.o stm32f4xx_dac.o stm32f4xx_i2c.o stm32f4xx_wwdg.o stm32f4xx_dbgmcu.o stm32f4xx_iwdg.o stm32f4xx_dcmi.o stm32f4xx_pwr.o

make[1]: Leaving directory `/home/lin/stm32f4/blinky/lib'

arm-none-eabi-gcc -g -O2 -Wall -Tstm32_flash.ld -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Iinc -Ilib -Ilib/inc -Ilib/inc/core -Ilib/inc/peripherals -I/home/lin/stm32f4/src/STM32F4-Discovery_FW_V1.1.0/Utilities/STM32F4-Discovery src/main.c src/stm32f4xx_it.c src/system_stm32f4xx.c lib/startup_stm32f4xx.s /home/lin/stm32f4/src/STM32F4-Discovery_FW_V1.1.0/Utilities/STM32F4-Discovery/libPDMFilter_GCC.a -o main.elf -Llib -lstm32f4

/home/lin/stm32f4/bin/lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/bin/ld: error: main.elf uses VFP register arguments, /home/lin/st32f4/src/STM32F4-Discovery_FW_V1.1.0/Utilities/STM32F4-Discovery/libPDMFilter_GCC.a(pdm_filter.o) does not

/home/lin/st32f4/bin/lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /home/lin/st32f4/src/STM32F4-Discovery_FW_V1.1.0/Utilities/STM32F4-Discovery/libPDMFilter_GCC.a(pdm_filter.o)

collect2: ld returned 1 exit status

make: *** [main.elf] Error 1

9 REPLIES 9
Posted on November 08, 2012 at 06:06

The library was built with Atollic using GNU/GCC 4.5.1

You might need to use setting which are coherent with that, and those used by Atollic.

I think it just used -mpcu=cortex-m4 but as it doesn't embedded the command line settings in the ELF object it's hard to tell for sure. I will look how I built the DSP libraries using 4.6.2

Compiler

-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -fno-strict-aliasing -ffunction-sections

Defines

ARM_MATH_CM4, ARM_MATH_MATRIX_CHECK, ARM_MATH_ROUNDING, __FPU_PRESENT = 1

Linker

-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -Wl,--gc-sections
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
lin
Associate II
Posted on November 20, 2012 at 08:02

Thanks. Where I can found libPDMFilter_GCC.a (pdm_filter.o) compiled with -mfloat-abi=hard options? Or source code? My toolchain is supports FPU.

git clone git://github.com/esden/summon-arm-toolchain

arm-none-eabi-gcc -v

Using built-in specs.

COLLECT_GCC=./bin/bin/arm-none-eabi-gcc

COLLECT_LTO_WRAPPER=./bin/libexec/gcc/arm-none-eabi/4.6.2/lto-wrapper

Target: arm-none-eabi

Configured with: ../gcc-linaro-4.6-2011.10/configure --target=arm-none-eabi --prefix=/home/lin/st32f4/bin/ --enable-multilib --enable-languages=c,c++ --with-newlib --with-gnu-as --with-gnu-ld --disable-nls --disable-shared --disable-threads --with-headers=newlib/libc/include --disable-libssp --disable-libstdcxx-pch --disable-libmudflap --disable-libgomp --disable-werror --with-system-zlib --disable-newlib-supplied-syscalls : (reconfigured) ../gcc-linaro-4.6-2011.10/configure --target=arm-none-eabi --prefix=/home/lin/st32f4/bin/ --enable-multilib --enable-languages=c,c++ --with-newlib --with-gnu-as --with-gnu-ld --disable-nls --disable-shared --disable-threads --with-headers=newlib/libc/include --disable-libssp --disable-libstdcxx-pch --disable-libmudflap --disable-libgomp --disable-werror --with-system-zlib --disable-newlib-supplied-syscalls

Thread model: single

gcc version 4.6.2 20111004 (prerelease) (Linaro GCC 4.6-2011.10)

frankmeyer9
Associate II
Posted on November 20, 2012 at 08:20

I would try to build your application with ''-mfloat-abi=softfp'', as clive suggested.

That uses the FPU, too, but passes the arguments in 'normal' registers and the stack.

The performance loss is rather minute.

lin
Associate II
Posted on November 23, 2012 at 03:22

There is a problem

.

Take the

robust project based on the

stm32-

template

(

with flashing

LEDs)

and

re-make it

with -

mfloat

-

abi

=

softfp option

and it

stops working.

Posted on November 23, 2012 at 05:05

Fortunately gross failure are the easiest to debug, break out the debugger and step in.

Make sure you have code enabling the FPU if there are instructions (push/pop) expecting it to work.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
lin
Associate II
Posted on December 05, 2012 at 09:57

>Fortunately gross failure are the easiest to debug,

>break out the debugger and step in.

$ arm-none-eabi-gdb main.elf

GNU gdb (Linaro GDB) 7.3-2011.10

Copyright (C) 2011 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type ''show copying''

and ''show warranty'' for details.

This GDB was configured as ''--host=x86_64-unknown-linux-gnu --target=arm-none-eabi''.

For bug reporting instructions, please see:

<http://bugs.launchpad.net/gdb-linaro/>...

Reading symbols from /home/lin/stm32f4/blinky/main.elf...done.

0x00000000 in ?? ()

(gdb) load

Error erasing flash with vFlashErase packet

(gdb) quit

$ cat .gdbinit

set tdesc filename target.xml

target extended-remote localhost:3333

$ cat target.xml

<?xml version=''1.0''?>

<!DOCTYPE target SYSTEM ''gdb-target.dtd''>

<target>

  <feature name=''org.gnu.gdb.arm.core''>

    <reg name=''r0'' bitsize=''32'' type=''uint32''/>

    <reg name=''r1'' bitsize=''32'' type=''uint32''/>

    <reg name=''r2'' bitsize=''32'' type=''uint32''/>

    <reg name=''r3'' bitsize=''32'' type=''uint32''/>

    <reg name=''r4'' bitsize=''32'' type=''uint32''/>

    <reg name=''r5'' bitsize=''32'' type=''uint32''/>

    <reg name=''r6'' bitsize=''32'' type=''uint32''/>

    <reg name=''r7'' bitsize=''32'' type=''uint32''/>

    <reg name=''r8'' bitsize=''32'' type=''uint32''/>

    <reg name=''r9'' bitsize=''32'' type=''uint32''/>

    <reg name=''r10'' bitsize=''32'' type=''uint32''/>

    <reg name=''r11'' bitsize=''32'' type=''uint32''/>

    <reg name=''r12'' bitsize=''32'' type=''uint32''/>

    <reg name=''sp'' bitsize=''32'' type=''data_ptr''/>

    <reg name=''lr'' bitsize=''32''/>

    <reg name=''pc'' bitsize=''32'' type=''code_ptr''/>

    <reg name=''cpsr'' bitsize=''32'' regnum=''25''/>

  </feature>

  <feature name=''org.gnu.gdb.arm.fpa''>

    <reg name=''f0'' bitsize=''96'' type=''arm_fpa_ext'' regnum=''16''/>

    <reg name=''f1'' bitsize=''96'' type=''arm_fpa_ext''/>

    <reg name=''f2'' bitsize=''96'' type=''arm_fpa_ext''/>

    <reg name=''f3'' bitsize=''96'' type=''arm_fpa_ext''/>

    <reg name=''f4'' bitsize=''96'' type=''arm_fpa_ext''/>

    <reg name=''f5'' bitsize=''96'' type=''arm_fpa_ext''/>

    <reg name=''f6'' bitsize=''96'' type=''arm_fpa_ext''/>

    <reg name=''f7'' bitsize=''96'' type=''arm_fpa_ext''/>

    <reg name=''fps'' bitsize=''32''/>

  </feature>

</target>

Why my GDB can't load firmware?

>Make sure you have code enabling the FPU if there are instructions

>(push/pop) expecting it to work.

Like this?

   SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));

there are 2 project with different compile options:

diff -r stm32f4-discovery-template-hard/ stm32f4-discovery-template-softp/

diff -r stm32f4-discovery-template-hard//Makefile stm32f4-discovery-template-softp//Makefile

18,19c18,19

< CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16

< #CFLAGS += -mfloat-abi=softfp -mfpu=fpv4-sp-d16

---

> #CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16

> CFLAGS += -mfloat-abi=softfp -mfpu=fpv4-sp-d16

Both project sucssefully writed into flash but

stm32f4-discovery-template-hard

work,

stm32f4-discovery-template-softfp not work.

Why?

frankmeyer9
Associate II
Posted on December 05, 2012 at 20:52

    <reg name=''f1'' bitsize=''96'' type=''arm_fpa_ext''/>

 

    <reg name=''f2'' bitsize=''96'' type=''arm_fpa_ext''/>

 

    <reg name=''f3'' bitsize=''96'' type=''arm_fpa_ext''/>

 

    ...

 

I usually don't mess with GDB on CLI level, but this seems strange.

The FPU registers are single-sized, and can be combined to double size IMHO.

there are 2 project with different compile options:

 

...

 

< CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16

 

< #CFLAGS += -mfloat-abi=softfp -mfpu=fpv4-sp-d16

 

---

 

> #CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16

 

> CFLAGS += -mfloat-abi=softfp -mfpu=fpv4-sp-d16

 

Disassembling libPDMfilter_gcc.a, there are no FPU instructions. This library seems not to be compiled with 

-mfloat-abi=hard

. Instead, one finds calls to

_aeabi_fmul

and similiar functions.

Not sure where this comes from, but parameters are put into core registers, which is 

-mfloat-abi=softfp

, and not 

-mfloat-abi=hard

.

Both project sucssefully writed into flash but

 

stm32f4-discovery-template-hard

work,

stm32f4-discovery-template-softfp not work.

 

Why?

 

I'm not sure about all the libs & objects involved in your project.

But compiling and linking something into a downloadable file doesn't mean much.

Like this?

 

   SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));

 

Or that:

/*FPU settings*/

ldr r0, =

0xE000ED88

/* Enable CP10,CP11 */

ldr r1,[r0] orr r1,r1,

#

(

0xF

<<

20

) str r1,[r0]

lin
Associate II
Posted on December 06, 2012 at 03:13

 there are 2 project with different compile options:

 

diff -r stm32f4-discovery-template-hard/ stm32f4-discovery-template-softp/

diff -r stm32f4-discovery-template-hard//Makefile stm32f4-discovery-template-softp//Makefile

18,19c18,19

< CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16

< #CFLAGS += -mfloat-abi=softfp -mfpu=fpv4-sp-d16

---

> #CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16

> CFLAGS += -mfloat-abi=softfp -mfpu=fpv4-sp-d16

Both project sucssefully writed into flash but

stm32f4-discovery-template-hard

work,

stm32f4-discovery-template-softfp not work.

Why?

Maybe the reason is the absence a float-abi-softfp

entry in thumb/cortex-m4 directory?

$ ls  -l lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/thumb/

итого 16

drwxr-xr-x 2 lin users 4096 Окт 30 11:02 arm7tdmi-s

drwxr-xr-x 2 lin users 4096 Окт 30 11:02 cortex-m0

drwxr-xr-x 2 lin users 4096 Окт 30 11:02 cortex-m3

drwxr-xr-x 3 lin users 4096 Окт 30 11:02 cortex-m4

ls  -l lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/thumb/cortex-m4/

итого 17600

-rw-r--r-- 1 lin users    2292 Окт 30 11:02 crt0.o

drwxr-xr-x 3 lin users    4096 Окт 30 11:02 float-abi-hard

-rw-r--r-- 1 lin users     195 Окт 30 11:02 iq80310.specs

-rw-r--r-- 2 lin users 3606978 Окт 30 11:02 libc.a

-rw-r--r-- 2 lin users 3606978 Окт 30 11:02 libg.a

-rw-r--r-- 1 lin users   11932 Окт 30 11:02 libgloss-linux.a

-rw-r--r-- 1 lin users 1296714 Окт 30 11:02 libm.a

-rwxr-xr-x 1 lin users   70022 Окт 30 11:02 libnosys.a

-rw-r--r-- 1 lin users   37916 Окт 30 11:02 librdimon.a

-rw-r--r-- 1 lin users   31230 Окт 30 11:02 librdpmon.a

-rw-r--r-- 1 lin users 8584594 Окт 30 11:02 libstdc++.a

-rw-r--r-- 1 lin users    2355 Окт 30 11:02 libstdc++.a-gdb.py

-rwxr-xr-x 1 lin users     935 Окт 30 11:02 libstdc++.la

-rw-r--r-- 1 lin users  639578 Окт 30 11:02 libsupc++.a

-rwxr-xr-x 1 lin users     930 Окт 30 11:02 libsupc++.la

-rw-r--r-- 1 lin users    3192 Окт 30 11:02 linux-crt0.o

-rw-r--r-- 1 lin users     121 Окт 30 11:02 linux.specs

-rw-r--r-- 1 lin users     192 Окт 30 11:02 pid.specs

-rw-r--r-- 1 lin users    2852 Окт 30 11:02 rdimon-crt0.o

-rw-r--r-- 1 lin users     147 Окт 30 11:02 rdimon.specs

-rw-r--r-- 1 lin users    2372 Окт 30 11:02 rdpmon-crt0.o

-rw-r--r-- 1 lin users     147 Окт 30 11:02 rdpmon.specs

-rw-r--r-- 1 lin users    1940 Окт 30 11:02 redboot-crt0.o

-rw-r--r-- 1 lin users    6119 Окт 30 11:02 redboot.ld

-rw-r--r-- 1 lin users     192 Окт 30 11:02 redboot.specs

-rw-r--r-- 1 lin users   11432 Окт 30 11:02 redboot-syscalls.o

frankmeyer9
Associate II
Posted on December 06, 2012 at 08:03

I think your application, and libPDMfilter_GCC.a, are finally linked against libm.a, the standard C math library.

...

 

-rw-r--r-- 2 lin users 3606978 Окт 30 11:02 libc.a

 

-rw-r--r-- 2 lin users 3606978 Окт 30 11:02 libg.a

 

-rw-r--r-- 1 lin users   11932 Окт 30 11:02 libgloss-linux.a

 

-rw-r--r-- 1 lin users 1296714 Окт 30 11:02 libm.a

 

-rwxr-xr-x 1 lin users   70022 Окт 30 11:02 libnosys.a

 

...

 

 

 

From this listing, it is not obvious which ABI this version uses. Most toolchains have them in separate folders. My CodeSourceryLite installation for instance has them in 3 separate folders:

soft in  .../arm-none-eabi/lib/thumb/libm.a

softfp in .../arm-none-eabi/lib/softfp/libm.a

hard  .../arm-none-eabi/lib/fpu/libm.a

As long as not all dependant parts of the application match in the ABI, you get those strange results. I had been fighting with it, too ...