Nucleo -> Generic STM32 upload help wanted

Hello Everyone!

I need help in uploading of Nucleo code into Generic STM32 chip.

I have Nucleo STM32F103RB board and developed a firmware for it using Arduino (with STM32Duino latest Framework). Now I need to upload and use this firmware into generic STM32F103RB chip. Chips are the same. I use ST-Link V2 Mini for connection to the chip.

ST-Link utility allows me to connect to the chip. I can read its memory. So it works. When I try to upload firmware from VSCode PIO IDE to the chip I get the following error:

GNU MCU Eclipse OpenOCD, 32-bitOpen On-Chip Debugger 0.10.0+dev-00593-g23ad80df4 (2019-04-22-16:40)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
debug_level: 1
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Error: timed out while waiting for target halted
TARGET: stm32f1x.cpu - Not halted
in procedure 'program'

embedded:startup.tcl:479: Error: ** Unable to reset target **
in procedure 'program' 
in procedure 'program_error' called at file "embedded:startup.tcl", line 504
at file "embedded:startup.tcl", line 479
*** [upload] Error 1

So, it seems that the programmer can’t reset my chip.

For testing that I started a new project that uses GenericSTM32F103RB board. And it can upload the test firmware very well:
GNU MCU Eclipse OpenOCD, 32-bitOpen On-Chip Debugger 0.10.0+dev-00593-g23ad80df4 (2019-04-22-16:40)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
debug_level: 1
hla_swd
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080024ec msp: 0x20005000
** Programming Started **
auto erase enabled
wrote 19456 bytes from file .pio\build\genericSTM32F103RB\firmware.elf in 1.128910s (16.830 KiB/s)
** Programming Finished **
** Verify Started **
verified 19244 bytes in 0.341058s (55.102 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked

I can’t compile my firmware for GenericSTM32F103RB because it uses mapple core instead of STM32Duino.

What shall I try to solve the problem?

It seems that I’ve managed to fix this thinking for a little bit. The solution in platformio.ini:

[env:CNTRL]
platform = ststm32
board = genericSTM32F103RB
platform = https://github.com/platformio/platform-ststm32.git
framework = arduino
upload_protocol = stlink
debug_tool = stlink
board_build.core = stm32
build_flags = -fexceptions

Using this environment I’ve manage to compile and upload :slight_smile:

2 Likes