The error says that no main() function could be found in your project which is called into from the Reset_Handler. Does this function not exist?
To shed some light on that one would need to see the exact project you’re compiling. It looks to me as if you want to use the Arduino framework on the disco_f100rb. This should work perfectly line, as demonstrated by the example projects linkedabove.
I’m not even migrating my project yet, I just took an example blink and try to download it to understand if it works or not.
1.
[env:disco_f100rb]
platform = ststm32
board = disco_f100rb
framework = arduino
upload_protocol = stlink
error:
Uploading .pio/build/disco_f100rb/firmware.elf
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-12:31)
Licensed under GNU GPL v2
For bug reports, read OpenOCD: Bug Reporting
debug_level: 1
If you have a STM32F0DISCOVERY board (with the STM32F051R8T6 chip), you cannot use the Arduino framework. There is no Arduino core that supports this chip.
If you have a STM32VLDISCOVERY board (with the STM32F100RBT6 chip), then the Arduino framework works just fine. I’ve just verified it. Please show the blink example you are using so we can provide you more specific help.
You need to read the code you’re compiling. The main.c expects you to define -DF1 if you are compiling for a STM32F1 board, this is done via build_flags in the original example. So, just add build_flags = -DF1 to your platformio.ini. Also check if you need to change the blink pin as it’s currently set to PA5. (You’d need to check the discovery board’s schematics for that).
If that error appears again there’s probably something wrong with the reset_config in OpenOCD. You may try to: Hold down the reset button before the upload is started, and release it when OpenOCD starts up (at the right time), or modify the reset_config in the OpenOCD config files for your board (which you can find out by doing a “Verbose Upload” and looking at the -f *.cfg flags in the openocd command). There are threads about that (STM32F411CE (BlackPill) + STLink V2 + Arduino on Ubuntu - #2 by maxgerhardt)
Okay that doesn’t look good. That file is supposed to be in ~/.platformio/packages/framework-stm32cube/f1/Drivers/STM32F1xx_HAL_Driver/Inc, where ~/ is the user home directory. Can you manually look if the file is in there?
If not, remove the framework-stm32cube folder so that PIO will re-download a fresh, good version of it.
As a last try, can you change (in the main.c) the #include "stm32f1xx_hal.h" to #include <stm32f1xx_hal.h>and in the platformio.ini change -DF1 to -DF1=1?
Ah, I’ve also just noticed that you’re not running the latest ST-STM32 platform version (you’re on 8.1.0 whereas the latest is 9.0.0 from 2 days ago). Please do a Platform Update via VSCode
Also it wouldn’t hurt to update to the most recent PlatformIO core version. Open a PlatformIO Core CLI, execute pio upgrade --dev, and restart VSCode after that.
I deleted the STM32 framework and overloaded it with the platformio.
Next, pio update-dev then overloaded the platformio
And then pio run -t upload from the project folder
ruslanpavluchenko@Ruslans-MacBook-Pro-3 stm32cube-hal-blink % pio run -t upload
Processing disco_f051r8 (platform: ststm32; framework: stm32cube; board: disco_f051r8)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/tool-scons @ ~2.20501.7
Tool Manager: tool-scons @ 2.20501.191222 has been installed!
Tool Manager: Removing tool-scons @ 4.40001.0
Tool Manager: tool-scons @ 4.40001.0 has been removed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/disco_f051r8.html
PLATFORM: ST STM32 (9.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.200813
- tool-dfuutil 1.9.200310
- tool-ldscripts-ststm32 0.1.0
- tool-openocd 2.1000.200630 (10.0)
- tool-stm32duino 1.0.1
- toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 10 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
src/main.c:5:12: fatal error: stm32f1xx_hal.h: No such file or directory
***********************************************************************
* Looking for stm32f1xx_hal.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:stm32f1xx_hal.h"
* Web > https://platformio.org/lib/search?query=header:stm32f1xx_hal.h
*
***********************************************************************
#include <stm32f1xx_hal.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
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
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_dma.o
/Users/ruslanpavluchenko/.platformio/packages/framework-stm32cube/f0/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc.c: In function 'CRC_Handle_8':
/Users/ruslanpavluchenko/.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];
^
/Users/ruslanpavluchenko/.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];
^
/Users/ruslanpavluchenko/.platformio/packages/framework-stm32cube/f0/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_crc.c: In function 'CRC_Handle_16':
/Users/ruslanpavluchenko/.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_flash.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_flash_ex.o
*** [.pio/build/disco_f051r8/src/main.o] Error 1
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_gpio.o
================================================================================= [FAILED] Took 2.37 seconds =================================================================================
ruslanpavluchenko@Ruslans-MacBook-Pro-3 stm32cube-hal-blink %
I have STM32F100RBT6, the blink project was loaded on blue pill using ST-Link 2 without any problems,but it does not load on STM32F100RBT6 in the Arduino framework.
blue pill ini
[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
upload_protocol = stlink
I don’t understand anything anymore, I loaded blink into blue pill several times and just played with blink speed, but now I tried to load blink into blue pills again, I didn’t change the settings, but here’s what I got.
Loadings .PIO/build/bluepill_f103c8 / firmware.elf
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-12:31)
Licensed under GNU GPL v2
To receive bug reports, read http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
hla_swd
no single
Error: open failed
in the “program” procedure"
** OpenOCD initialization error * *
shutdown command called
5min later:)))
OH, MIRACLE! I disconnected the USB type C adapter from my Mac, waited for a while and turned it on, now the firmware is working again.
another 15 minutes later
, I checked both boards, blue pill really perfectly receives data on ST-Link in the Arduino framework, but STM32F100RBT6 does not want to react to my efforts.
At the same time this ini also works in the CUBE framework
[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = stm32cube
upload_protocol = stlink
build_flags = -DF1
True, the change to #define LED_PIN GPIO_PIN_13 did not lead to the led blink, but it is possible that the pins are marked differently, but this is not in this topic.
I’m still confused regarding the boards and chips you have. You mention a Blue Pill (STM32F103C8), Discovery board with STM32F100RBT6 and in platfromio.ini you also have declared a Discovery board with a STM32F051R8.
STM32F100RBT6
If you have an STM32F100RBT6, then it’s missing in the platformio.ini that you have post two posts ago.
I can easily get an Arduino blink sketch to compile if the board is set to disco_f100rb with this configuration:
I’ll try to put things in order.
I have three boards
1 STM32VLDISCOVERY (and all problems are associated with it)
2 STM32F103C8T6 (blue pill)
3 STM32F030F4P6
The 1st board is equipped with ST-link, has some peripherals on board in the form of buttons and LEDs, and I wanted to launch it.
I started the 2nd and 3rd boards without problems.
cube hall project ini file
STM32F103C8T6 (blue pill)
My only assumption is that STM32VLDISCOVERY is broken, I took it from a friend, but it has not been used for several years and although the LEDs are on when the power is turned on, there may be some kind of gap with the ST-link, I do not see any other problems.
If you write me a config that should work 100%, I will check it. I have no more versions: (((