platformio / platform-ststm32

ST STM32: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/ststm32
Apache License 2.0
394 stars 307 forks source link

GCC 5.4.1: `arm-none-eabi-ar` missing #355

Open stertingen opened 4 years ago

stertingen commented 4 years ago

My platformio.ini:

[env:disco_f051r8]
platform = ststm32
board = disco_f051r8
framework = stm32cube
platform_packages =
    toolchain-gccarmnoneeabi@~1.50401.0

Build log:

Processing disco_f051r8 (platform: ststm32; board: disco_f051r8; framework: stm32cube)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/disco_f051r8.html
PLATFORM: ST STM32 6.0.0 > ST STM32F0DISCOVERY
HARDWARE: STM32F051R8T6 48MHz, 8KB RAM, 64KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES: 
 - framework-stm32cube 2.0.181130 
 - toolchain-gccarmnoneeabi 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/disco_f051r8/src/main.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_adc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_adc_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_can.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_cec.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_comp.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_cortex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_crc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_crc_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_dac.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_dac_ex.o
/home/hermann/.platformio/packages/framework-stm32cube/f0/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc.c: In function 'CRC_Handle_8':
/home/hermann/.platformio/packages/framework-stm32cube/f0/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc.c:475:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
        *(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
        ^
/home/hermann/.platformio/packages/framework-stm32cube/f0/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc.c:479:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
        *(uint16_t volatile*) (&hcrc->Instance->DR) = ((uint32_t)pBuffer[4*i]<<8) | (uint32_t)pBuffer[4*i+1];
        ^
/home/hermann/.platformio/packages/framework-stm32cube/f0/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc.c: In function 'CRC_Handle_16':
/home/hermann/.platformio/packages/framework-stm32cube/f0/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc.c:511:8: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
        *(uint16_t volatile*) (&hcrc->Instance->DR) = pBuffer[2*i]; 
        ^
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_dma.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_flash.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_flash_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_gpio.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_i2c.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_i2c_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_i2s.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_irda.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_iwdg.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_pcd.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_pcd_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_pwr.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_pwr_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_rcc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_rcc_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_rtc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_rtc_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_smartcard.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_smartcard_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_smbus.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_spi.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_spi_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_tim.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_tim_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_tsc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_uart.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_uart_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_usart.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_wwdg.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_adc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_comp.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_crc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_crs.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_dac.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_dma.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_exti.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_gpio.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_i2c.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_pwr.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_rcc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_rtc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_spi.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_tim.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_usart.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_utils.o
Compiling .pio/build/disco_f051r8/FrameworkCMSISDevice/gcc/startup_stm32f051x8.o
Compiling .pio/build/disco_f051r8/FrameworkCMSISDevice/system_stm32f0xx.o
Archiving .pio/build/disco_f051r8/libFrameworkCMSISDevice.a
sh: arm-none-eabi-ar: command not found
*** [.pio/build/disco_f051r8/libFrameworkCMSISDevice.a] Error 127
=================================================================================================================== [FAILED] Took 5.88 seconds ===================================================================================================================

The reason why this fails is quite easy: The package toolchain-gccarmnoneeabi is missing some symlinks in version 1.50401.190816 which happen to exist in newer versions.

ls -ll ~/.platformio/packages/toolchain-gccarmnoneeabi@1.60301.0/bin lists the directory with correct symlinks for arm-none-eabi-ar:

total 18104
-rwxr-xr-x 1 hermann hermann  857448 Feb 16  2017 arm-none-eabi-addr2line
lrwxrwxrwx 1 hermann hermann      23 Mar  7 12:47 arm-none-eabi-ar -> ../arm-none-eabi/bin/ar
lrwxrwxrwx 1 hermann hermann      23 Mar  7 12:47 arm-none-eabi-as -> ../arm-none-eabi/bin/as
-rwxr-xr-x 1 hermann hermann  907592 Feb 16  2017 arm-none-eabi-cpp
-rwxr-xr-x 1 hermann hermann  907592 Feb 16  2017 arm-none-eabi-c++
-rwxr-xr-x 1 hermann hermann  852968 Feb 16  2017 arm-none-eabi-c++filt
-rwxr-xr-x 1 hermann hermann   31544 Feb 16  2017 arm-none-eabi-elfedit
-rwxr-xr-x 1 hermann hermann  903496 Feb 16  2017 arm-none-eabi-gcc
lrwxrwxrwx 1 hermann hermann      17 Mar  7 12:47 arm-none-eabi-gcc-6.3.1 -> arm-none-eabi-gcc
-rwxr-xr-x 1 hermann hermann   27160 Feb 16  2017 arm-none-eabi-gcc-ar
-rwxr-xr-x 1 hermann hermann   27160 Feb 16  2017 arm-none-eabi-gcc-nm
-rwxr-xr-x 1 hermann hermann   27160 Feb 16  2017 arm-none-eabi-gcc-ranlib
-rwxr-xr-x 1 hermann hermann  511464 Feb 16  2017 arm-none-eabi-gcov
-rwxr-xr-x 1 hermann hermann  470496 Feb 16  2017 arm-none-eabi-gcov-tool
-rwxr-xr-x 1 hermann hermann 5056544 Feb 16  2017 arm-none-eabi-gdb
-rwxr-xr-x 1 hermann hermann 5285440 Feb 16  2017 arm-none-eabi-gdb-py
-rwxr-xr-x 1 hermann hermann  920168 Feb 16  2017 arm-none-eabi-gprof
lrwxrwxrwx 1 hermann hermann      17 Mar  7 12:47 arm-none-eabi-g++ -> arm-none-eabi-c++
lrwxrwxrwx 1 hermann hermann      23 Mar  7 12:47 arm-none-eabi-ld -> ../arm-none-eabi/bin/ld
lrwxrwxrwx 1 hermann hermann      23 Mar  7 12:47 arm-none-eabi-ld.bfd -> ../arm-none-eabi/bin/ld
lrwxrwxrwx 1 hermann hermann      23 Mar  7 12:47 arm-none-eabi-nm -> ../arm-none-eabi/bin/nm
lrwxrwxrwx 1 hermann hermann      28 Mar  7 12:47 arm-none-eabi-objcopy -> ../arm-none-eabi/bin/objcopy
lrwxrwxrwx 1 hermann hermann      28 Mar  7 12:47 arm-none-eabi-objdump -> ../arm-none-eabi/bin/objdump
lrwxrwxrwx 1 hermann hermann      27 Mar  7 12:47 arm-none-eabi-ranlib -> ../arm-none-eabi/bin/ranlib
lrwxrwxrwx 1 hermann hermann      28 Mar  7 12:47 arm-none-eabi-readelf -> ../arm-none-eabi/bin/readelf
-rwxr-xr-x 1 hermann hermann  857320 Feb 16  2017 arm-none-eabi-size
-rwxr-xr-x 1 hermann hermann  857448 Feb 16  2017 arm-none-eabi-strings
lrwxrwxrwx 1 hermann hermann      26 Mar  7 12:47 arm-none-eabi-strip -> ../arm-none-eabi/bin/strip

ls -ll ~/.platformio/packages/toolchain-gccarmnoneeabi@1.50401.190816/bin only lists some binaries, arm-none-eabi-ar is missing, which explains the error in above build log:

total 17008
-rwxr-xr-x 1 hermann hermann  823296 Aug 16  2019 arm-none-eabi-addr2line
-rwxr-xr-x 1 hermann hermann 1426592 Aug 16  2019 arm-none-eabi-as
-rwxr-xr-x 1 hermann hermann  824520 Aug 16  2019 arm-none-eabi-cpp
-rwxr-xr-x 1 hermann hermann  824520 Aug 16  2019 arm-none-eabi-c++
-rwxr-xr-x 1 hermann hermann  818744 Aug 16  2019 arm-none-eabi-c++filt
-rwxr-xr-x 1 hermann hermann  820424 Aug 16  2019 arm-none-eabi-gcc
-rwxr-xr-x 1 hermann hermann  820424 Aug 16  2019 arm-none-eabi-gcc-5.4.1
-rwxr-xr-x 1 hermann hermann   27816 Aug 16  2019 arm-none-eabi-gcc-ar
-rwxr-xr-x 1 hermann hermann   27816 Aug 16  2019 arm-none-eabi-gcc-nm
-rwxr-xr-x 1 hermann hermann   27816 Aug 16  2019 arm-none-eabi-gcc-ranlib
-rwxr-xr-x 1 hermann hermann 4685216 Aug 16  2019 arm-none-eabi-gdb
-rwxr-xr-x 1 hermann hermann  824520 Aug 16  2019 arm-none-eabi-g++
-rwxr-xr-x 1 hermann hermann 1156320 Aug 16  2019 arm-none-eabi-ld
-rwxr-xr-x 1 hermann hermann 1156320 Aug 16  2019 arm-none-eabi-ld.bfd
-rwxr-xr-x 1 hermann hermann 1011736 Aug 16  2019 arm-none-eabi-objcopy
-rwxr-xr-x 1 hermann hermann 1279504 Aug 16  2019 arm-none-eabi-objdump
-rwxr-xr-x 1 hermann hermann  823200 Aug 16  2019 arm-none-eabi-size

https://docs.platformio.org/en/latest/platforms/ststm32.html#packages links the launchpad repository for the ARM GCC, which links to https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads, where I downloaded the GCC 5.4.1 by myself; I installed the toolchain to /opt.

ls -ll /opt/gcc-arm-none-eabi-5_4-2016q2/bin lists the directory with a binary named arm-none-eabi-ar:

total 27132
-rwxr-xr-x 1 root root  772164 Jun 22  2016 arm-none-eabi-addr2line
-rwxr-xr-x 2 root root  800200 Jun 22  2016 arm-none-eabi-ar
-rwxr-xr-x 2 root root 1302984 Jun 22  2016 arm-none-eabi-as
-rwxr-xr-x 1 root root  776368 Jun 22  2016 arm-none-eabi-cpp
-rwxr-xr-x 2 root root  777136 Jun 22  2016 arm-none-eabi-c++
-rwxr-xr-x 1 root root  770340 Jun 22  2016 arm-none-eabi-c++filt
-rwxr-xr-x 1 root root   25520 Jun 22  2016 arm-none-eabi-elfedit
-rwxr-xr-x 2 root root  776368 Jun 22  2016 arm-none-eabi-gcc
-rwxr-xr-x 2 root root  776368 Jun 22  2016 arm-none-eabi-gcc-5.4.1
-rwxr-xr-x 1 root root   24324 Jun 22  2016 arm-none-eabi-gcc-ar
-rwxr-xr-x 1 root root   24292 Jun 22  2016 arm-none-eabi-gcc-nm
-rwxr-xr-x 1 root root   24324 Jun 22  2016 arm-none-eabi-gcc-ranlib
-rwxr-xr-x 1 root root  447252 Jun 22  2016 arm-none-eabi-gcov
-rwxr-xr-x 1 root root  418572 Jun 22  2016 arm-none-eabi-gcov-tool
-rwxr-xr-x 1 root root 4526856 Jun 22  2016 arm-none-eabi-gdb
-rwxr-xr-x 1 root root 5004552 Jun 22  2016 arm-none-eabi-gdb-py
-rwxr-xr-x 1 root root  837764 Jun 22  2016 arm-none-eabi-gprof
-rwxr-xr-x 2 root root  777136 Jun 22  2016 arm-none-eabi-g++
-rwxr-xr-x 4 root root 1091400 Jun 22  2016 arm-none-eabi-ld
-rwxr-xr-x 4 root root 1091400 Jun 22  2016 arm-none-eabi-ld.bfd
-rwxr-xr-x 2 root root  784196 Jun 22  2016 arm-none-eabi-nm
-rwxr-xr-x 2 root root  953668 Jun 22  2016 arm-none-eabi-objcopy
-rwxr-xr-x 2 root root 1172484 Jun 22  2016 arm-none-eabi-objdump
-rwxr-xr-x 2 root root  800200 Jun 22  2016 arm-none-eabi-ranlib
-rwxr-xr-x 2 root root  464724 Jun 22  2016 arm-none-eabi-readelf
-rwxr-xr-x 1 root root  773188 Jun 22  2016 arm-none-eabi-size
-rwxr-xr-x 1 root root  772772 Jun 22  2016 arm-none-eabi-strings
-rwxr-xr-x 2 root root  953668 Jun 22  2016 arm-none-eabi-strip

So I guess the package delivered as toolchain-gccarmnoneeabi for version ~1.50401.0 is broken.

Does anyone know where the toolchain package is generated for PlatformIO?

valeros commented 4 years ago

Hi @stertingen ! What is your OS ?

stertingen commented 4 years ago

Hi @stertingen ! What is your OS ?

Up-to-date Arch linux; PlatformIO installed via AUR. (https://aur.archlinux.org/packages/platformio)

valeros commented 4 years ago

And the architecture? x64? ARM? BTW, is there a reason why you need 5.4.1?

stertingen commented 4 years ago

And the arhitecture? x64? ARM? BTW, is there a reason why you need 5.4.1?

It's x86_64.

GCC 5.4.1 is convention in a student robotics group due to compiler bugs in later versions. While evaluating whether PlatformIO might be a good choice for embedded development, I stumbled upon this bug.

And since PlatformIO ships GCC 5.4.1, this package should not produce any errors.

Can you tell me who maintains the GCC package for PlatformIO? I'd also like to file a bug report there.

valeros commented 4 years ago

This package is maintained internally, so there is no repository for it. Also, there are no guarantees that this package is compatible with ststm32 since it's meant to be used only with the teensy platform and for some reason arm-none-eabi-ar is replaced with arm-none-eabi-gcc-ar.

stertingen commented 4 years ago

This package is maintained internally, so there is no repository for it.

Alright, so the chances that this will be fixed are low.

for some reason arm-none-eabi-ar is replaced with arm-none-eabi-gcc-ar.

No, it's not replaced. arm-none-eabi-gcc-ar is always there in the bin directory. It's just arm-none-eabi-ar that's missing. In version 6.3.1, it's a symlink to ../arm-none-eabi/ar, in version 5.4.1, the symlink does not exist, but the file it would point to.