Upload error with clone ST-Link and clone device F103

Post here all questions related to LibMaple core if you can't find a relevant section!
Post Reply
hennep
Posts: 10
Joined: Wed Jan 15, 2020 2:10 pm
Location: Netherlands

Upload error with clone ST-Link and clone device F103

Post by hennep »

For quite some time I am getting error messages when I compile and upload a STM32 project with the Arduino IDE.

Code: Select all

Sketch uses 14148 bytes (43%) of program storage space. Maximum is 32768 bytes.
Global variables use 2064 bytes (20%) of dynamic memory, leaving 8176 bytes for local variables. Maximum is 10240 bytes.
java.lang.NullPointerException
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingProgrammer(SerialUploader.java:295)
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:90)
	at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
	at processing.app.SketchController.upload(SketchController.java:732)
	at processing.app.SketchController.exportApplet(SketchController.java:703)
	at processing.app.Editor$UploadHandler.run(Editor.java:2061)
	at java.lang.Thread.run(Thread.java:748)
I have two environments available and I cannot remember how I got these.
.../Arduino/hardware/Arduino_STM32
.../Arduino/hardware/Arduino_STM32-SteveStrong

Years ago, I started with https://github.com/rogerclarkmelbourne/Arduino_STM32, but those files might have been overwritten with another set of files.

Also these lines were added to the 'Additional Boards Manager URLs':
http://dan.drown.org/stm32duino/package ... index.json
https://github.com/stm32duino/BoardMana ... index.json
https://github.com/stm32duino/BoardMana ... index.json
Possibly these lines were added in an attempt to repair the problem. That was at least a year ago, I could not resolve this issue and I gave up and installed STM32Cube and I even bought an original ST-Link programmer.

Apart from my work in Cube, I would like to program some sketches that I've already made.
I found a workaround to do this. By downloading the separate programmer software from the ST website, I am able to use the Arduino generated .elf file from the temp directory and program that into the device with STM32Cube Programmer.

I would like to automate that process. ST included a command line tool to do the job and I can do the programming with this line:

Code: Select all

/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI -c port=swd -d  /tmp/arduino_build_458370/Blink.ino.elf
I found a way to automate that process. I changed the contents of this file: ~/.arduino15/packages/stm32duino/tools/stm32tools/2021.5.31/linux/stlink_upload
with this:

Code: Select all

#!/bin/bash
echo "==========================";
echo "Using .elf instead of .bin"
echo  ${1/.bin/".elf"};
echo "==========================";

/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI -c port=swd -d ${1/.bin/".elf"} 0x8000000
In case this work will be overwritten with a future update and as a reminder to myself, I post this on the forum.
If anyone can tell how to improve this, please let me know.

I am using version 2.9 of the programmer.
https://www.st.com/en/development-tools ... eprog.html
Post Reply

Return to “General discussion”