Compiling fail for Bluepill STM32F103

I’ve tried to resolve below problem for a while now but need to reach out and ask for advice. I got this problem after a fresh installation of PlatformIO run as sudo.
Trying to compile my project on RPI Zero W running latest stable build of PIO Core.

Compilaton output

arm-none-eabi-gcc -o .pioenvs/prod/FrameworkArduinoVariant/PeripheralPins.c.o -c -std=gnu11 -Os -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections -Wall -nostdlib --param max-inline-insns-single=500 -DPLATFORMIO=30607 -DSTM32F1 -DSTM32F103xB -DARDUINO_BLUEPILL_F103C8 -DSTM32F1xx -DARDUINO=10808 -DARDUINO_ARCH_STM32 -DARDUINO_BLUEPILL_F103C8 -DBOARD_NAME=\"BLUEPILL_F103C8\" -DHAL_UART_MODULE_ENABLED -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/avr -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32 -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/LL -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/hid -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/cdc -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F1xx_HAL_Driver/Inc -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F1xx_HAL_Driver/Src -I/root/.platformio/packages/framework-arduinoststm32/system/STM32F1xx -I/root/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I/root/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src -I/root/.platformio/packages/framework-arduinoststm32/CMSIS/CMSIS/Core/Include -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Include -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino -I/root/.platformio/packages/framework-arduinoststm32/variants/BLUEPILL_F103XX -I/root/.platformio/packages/framework-arduinoststm32/variants/BLUEPILL_F103XX /root/.platformio/packages/framework-arduinoststm32/variants/BLUEPILL_F103XX/PeripheralPins.c

arm-none-eabi-g++ -o .pioenvs/prod/FrameworkArduinoVariant/variant.cpp.o -c -std=gnu++14 -fno-threadsafe-statics -fno-rtti -fno-exceptions -Os -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections -Wall -nostdlib --param max-inline-insns-single=500 -DPLATFORMIO=30607 -DSTM32F1 -DSTM32F103xB -DARDUINO_BLUEPILL_F103C8 -DSTM32F1xx -DARDUINO=10808 -DARDUINO_ARCH_STM32 -DARDUINO_BLUEPILL_F103C8 -DBOARD_NAME=\"BLUEPILL_F103C8\" -DHAL_UART_MODULE_ENABLED -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/avr -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32 -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/LL -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/hid -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/cdc -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F1xx_HAL_Driver/Inc -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F1xx_HAL_Driver/Src -I/root/.platformio/packages/framework-arduinoststm32/system/STM32F1xx -I/root/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I/root/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src -I/root/.platformio/packages/framework-arduinoststm32/CMSIS/CMSIS/Core/Include -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Include -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino -I/root/.platformio/packages/framework-arduinoststm32/variants/BLUEPILL_F103XX -I/root/.platformio/packages/framework-arduinoststm32/variants/BLUEPILL_F103XX /root/.platformio/packages/framework-arduinoststm32/variants/BLUEPILL_F103XX/variant.cpp

arm-none-eabi-g++ -o .pioenvs/prod/FrameworkArduino/HardwareSerial.cpp.o -c -std=gnu++14 -fno-threadsafe-statics -fno-rtti -fno-exceptions -Os -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections -Wall -nostdlib --param max-inline-insns-single=500 -DPLATFORMIO=30607 -DSTM32F1 -DSTM32F103xB -DARDUINO_BLUEPILL_F103C8 -DSTM32F1xx -DARDUINO=10808 -DARDUINO_ARCH_STM32 -DARDUINO_BLUEPILL_F103C8 -DBOARD_NAME=\"BLUEPILL_F103C8\" -DHAL_UART_MODULE_ENABLED -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/avr -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32 -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/LL -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/hid -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino/stm32/usb/cdc -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F1xx_HAL_Driver/Inc -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/STM32F1xx_HAL_Driver/Src -I/root/.platformio/packages/framework-arduinoststm32/system/STM32F1xx -I/root/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I/root/.platformio/packages/framework-arduinoststm32/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src -I/root/.platformio/packages/framework-arduinoststm32/CMSIS/CMSIS/Core/Include -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Include -I/root/.platformio/packages/framework-arduinoststm32/system/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc -I/root/.platformio/packages/framework-arduinoststm32/cores/arduino -I/root/.platformio/packages/framework-arduinoststm32/variants/BLUEPILL_F103XX -I/root/.platformio/packages/framework-arduinoststm32/variants/BLUEPILL_F103XX /root/.platformio/packages/framework-arduinoststm32/cores/arduino/HardwareSerial.cpp

In file included from /root/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/bits/uniform_int_dist.h:35:0,
from /root/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/bits/stl_algo.h:66,
from /root/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/algorithm:62,
from /root/.platformio/packages/framework-arduinoststm32/cores/arduino/wiring_constants.h:26,
from /root/.platformio/packages/framework-arduinoststm32/cores/arduino/wiring.h:34,
from /root/.platformio/packages/framework-arduinoststm32/cores/arduino/Arduino.h:32,
from /root/.platformio/packages/framework-arduinoststm32/cores/arduino/HardwareSerial.cpp:26:
/root/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/limits:1599:7: internal compiler error: Illegal instruction

min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; }

Platformio.ini

[env:prod]
platform = ststm32
framework = arduino
board = bluepill_f103c8

Advice?

Does the problem always appear, even with a simple LED code?

Above output are from compilation of a simple Blink sketch. So yes it does allways appear

Hello,
I have stm32f103c8t6(blue pill) and st-link v2. I am trying to put hex file inside the board. I am able connect to the device and able to see the memory of it but I am not able to put the hex file inside the board. It gives me an error called “programming error @:0x00000000” Can anyone help me?
Best regard

It doesn’t appear like the same problem as the original thread.

Also information is missing:

  • what platformio.ini
  • what code
  • output of a “Verbose Upload” or pio run -t upload -v?
1 Like

PlatformIO doesn’t support this IDE (supported: atom|clion|codeblocks|eclipse|emacs|netbeans|qtcreator|sublimetext|vim|visualstudio|vscode). Are you using PlatformIO at all?

Okay well if we completely overlook the fact that this is not using PlatformIO and you’re looking for the answer of a generic MCU / programming problem on the PlatformIO forums, the only thing I can say is:

Whatever tool you’re using to program it, it’s right. Location 0x0000000 does not map to programmable flash memory. Look at the datasheet

Normal flash memory starts the address 0x8000000. Depending on whether you pulling the BOOT0/BOOT1 pins of your chip to 0/1, you enter its bootloader mode – the memory is remapped in this case. In any case however users are only ever supposed to program flash in 0x8000000. (Unless you want to do tricks like running from SRAM – which however is at 0x2000000.)

So I’d guess in the blue that you’re telling your programming tool to start programming at 0x0 when you actually want to program flash at 0x8000000.

1 Like