Gentoo Archives: gentoo-embedded

From: Stuart Longland <stuartl@×××××××××××××××.org>
To: gentoo-embedded@l.g.o
Subject: [gentoo-embedded] Building a bare-metal ARM hard-float compiler, what ABI?
Date: Sat, 05 Sep 2015 04:56:50
Message-Id: 55EA7699.9070200@longlandclan.yi.org
1 Hi all,
2
3 I'm trying to build firmware for Rowetel's SM1000 smart microphone,
4 which is based around the STM32F4 microcontroller.
5
6 http://www.rowetel.com/blog/?page_id=3902
7
8 The device is basically a digital voice modem for radio communications,
9 the firmware implements code that encodes and decodes audio into Codec2
10 format and modulating that for transmission via HF radio. It needs
11 hardware floating point to work.
12
13 I *had* thought `crossdev -t arm-none-eabi` would be sufficient for
14 this, but imagine my surprise when I received this error:
15
16 > arm-none-eabi-gcc -std=gnu99 -O0 -g -Wall -Tstm32_flash.ld -DSTM32F40_41xxx -DCORTEX_M4 -mlittle-endian -mthumb -mthumb-interwork -nostartfiles -mcpu=cortex-m4 -fsingle-precision-constant -Wdouble-promotion -mfpu=fpv4-sp-d16 -mfloat-abi=hard -D__FPU_PRESENT=1 -D__FPU_USED=1 -DUSE_STDPERIPH_DRIVER -ISTM32F4xx_DSP_StdPeriph_Lib/Libraries/STM32F4xx_StdPeriph_Driver/inc -ISTM32F4xx_DSP_StdPeriph_Lib/Project/STM32F4xx_StdPeriph_Templates -ISTM32F4xx_DSP_StdPeriph_Lib/Libraries/CMSIS/Include -ISTM32F4xx_DSP_StdPeriph_Lib/Libraries/CMSIS/Device/ST/STM32F4xx/Include -DARM_MATH_CM4 -D__EMBEDDED__ -I../src -I../unittest -Iinc -Iusb_conf -Iusb_lib/cdc -Iusb_lib/core -Iusb_lib/otg -c -o STM32F4xx_DSP_StdPeriph_Lib/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.o STM32F4xx_DSP_StdPeriph_Lib/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.c
17 > arm-none-eabi-gcc -std=gnu99 -O0 -g -Wall -Tstm32_flash.ld -DSTM32F40_41xxx -DCORTEX_M4 -mlittle-endian -mthumb -mthumb-interwork -nostartfiles -mcpu=cortex-m4 -fsingle-precision-constant -Wdouble-promotion -mfpu=fpv4-sp-d16 -mfloat-abi=hard -D__FPU_PRESENT=1 -D__FPU_USED=1 -DUSE_STDPERIPH_DRIVER -ISTM32F4xx_DSP_StdPeriph_Lib/Libraries/STM32F4xx_StdPeriph_Driver/inc -ISTM32F4xx_DSP_StdPeriph_Lib/Project/STM32F4xx_StdPeriph_Templates -ISTM32F4xx_DSP_StdPeriph_Lib/Libraries/CMSIS/Include -ISTM32F4xx_DSP_StdPeriph_Lib/Libraries/CMSIS/Device/ST/STM32F4xx/Include -DARM_MATH_CM4 -D__EMBEDDED__ -I../src -I../unittest -Iinc -Iusb_conf -Iusb_lib/cdc -Iusb_lib/core -Iusb_lib/otg -c -o STM32F4xx_DSP_StdPeriph_Lib/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_wwdg.o STM32F4xx_DSP_StdPeriph_Lib/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_wwdg.c
18 > find STM32F4xx_DSP_StdPeriph_Lib -type f -name '*.o' -exec ar crs libstm32f4.a {} ";"
19 > arm-none-eabi-gcc -std=gnu99 -O0 -g -Wall -Tstm32_flash.ld -DSTM32F40_41xxx -DCORTEX_M4 -mlittle-endian -mthumb -mthumb-interwork -nostartfiles -mcpu=cortex-m4 -fsingle-precision-constant -Wdouble-promotion -mfpu=fpv4-sp-d16 -mfloat-abi=hard -D__FPU_PRESENT=1 -D__FPU_USED=1 -DUSE_STDPERIPH_DRIVER -ISTM32F4xx_DSP_StdPeriph_Lib/Libraries/STM32F4xx_StdPeriph_Driver/inc -ISTM32F4xx_DSP_StdPeriph_Lib/Project/STM32F4xx_StdPeriph_Templates -ISTM32F4xx_DSP_StdPeriph_Lib/Libraries/CMSIS/Include -ISTM32F4xx_DSP_StdPeriph_Lib/Libraries/CMSIS/Device/ST/STM32F4xx/Include -DARM_MATH_CM4 -D__EMBEDDED__ -I../src -I../unittest -Iinc -Iusb_conf -Iusb_lib/cdc -Iusb_lib/core -Iusb_lib/otg -DPROFILE src/codec2_profile.c src/gdb_stdio.c src/stm32f4_machdep.c src/startup_stm32f4xx.s src/init.c src/system_stm32f4xx.c ../src/lpc.c ../src/nlp.c ../src/postfilter.c ../src/sine.c ../src/codec2.c ../src/kiss_fft.c ../src/interp.c ../src/lsp.c ../src/phase.c ../src/quantise.c ../src/pack.c ../src/codebook.c ../
20 s
21 rc/codebookd.c ../src/codebookjvm.c ../src/codebookge.c ../src/dump.c ../src/fdmdv.c ../src/freedv_api.c ../src/varicode.c ../src/golay23.c -o codec2_profile.elf libstm32f4.a -lg -lnosys -lm
22 > ../src/freedv_api.c: In function ‘freedv_comptx’:
23 > ../src/freedv_api.c:260:46: warning: unused variable ‘nspare’ [-Wunused-variable]
24 > int data, codeword1, data_flag_index, nspare;
25 > ^
26 > ../src/freedv_api.c:258:29: warning: unused variable ‘k’ [-Wunused-variable]
27 > int bit, byte, i, j, k;
28 > ^
29 > ../src/freedv_api.c: In function ‘freedv_comprx’:
30 > ../src/freedv_api.c:516:77: warning: unused variable ‘nspare’ [-Wunused-variable]
31 > int recd_codeword, codeword1, data_flag_index, n_ascii, nspare;
32 > ^
33 > ../src/freedv_api.c:515:58: warning: unused variable ‘k’ [-Wunused-variable]
34 > int i, j, bit, byte, nin_prev, nout, k;
35 > ^
36 > /usr/libexec/gcc/arm-none-eabi/ld: error: codec2_profile.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/libg.a(lib_a-assert.o) does not
37 > /usr/libexec/gcc/arm-none-eabi/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/libg.a(lib_a-assert.o)
38 > /usr/libexec/gcc/arm-none-eabi/ld: error: codec2_profile.elf uses VFP register arguments, /usr/lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/libg.a(lib_a-exit.o) does not
39 > /usr/libexec/gcc/arm-none-eabi/ld: failed to merge target specific data of file /usr/lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/libg.a(lib_a-exit.o)
40
41 Okay, so I read that as "newlib has been built using softfloat". No
42 matter. I thought maybe I can coax a hardfloat toolchain out by
43 manipulation of the target.
44
45 When I try `crossdev -t arm-hardfloat-eabi` (as clearly "none" gave me a
46 softfloat one) I got this building gcc at stage 1.
47
48 > configure:3389: /tmp/portage/cross-arm-hardfloat-eabi/gcc-4.9.3/work/build/./gcc/xgcc -B/tmp/portage/cross-arm-hardfloat-eabi/gcc-4.9.3/work/build/./gcc/
49 > -B/usr/arm-hardfloat-eabi/bin/ -B/usr/arm-hardfloat-eabi/lib/ -isystem /usr/arm-hardfloat-eabi/include -isystem /usr/arm-hardfloat-eabi/sys-include -mt
50 > humb -o conftest -g -O2 -pipe conftest.c >&5
51 > conftest.c: In function 'main':
52 > conftest.c:12:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI
53 > {
54
55 Now, there's an option to pass in ABIs to crossdev, and for the default
56 one to be identified. Question is, where can I find what the ABIs are
57 called?
58 --
59 Stuart Longland (aka Redhatter, VK4MSL)
60
61 I haven't lost my mind...
62 ...it's backed up on a tape somewhere.

Replies

Subject Author
Re: [gentoo-embedded] Building a bare-metal ARM hard-float compiler, what ABI? Stuart Longland <stuartl@×××××××××××××××.org>