Visual Studio Ide for Arduino
https://www.visualmicro.com/forums/YaBB.pl
>> >> Unabe to upload via openocd to Adafruit Feather M4 (STM32F405)
https://www.visualmicro.com/forums/YaBB.pl?num=1581154663

Message started by Marco S on Feb 8th, 2020 at 9:37am

Title: Unabe to upload via openocd to Adafruit Feather M4 (STM32F405)
Post by Marco S on Feb 8th, 2020 at 9:37am
Hallo,
I try to upload a simple program (blink) to a Adafruit Feather M4 (STM32F405)https://learn.adafruit.com/adafruit-stm32f405-feather-express using the upload method "STLink 2.1 + OpenOCD (vMicro)".

Uploading does not work and I got the output:
...
Info : device id = 0x10076413
Warn : Cannot identify target as a STM32 family.
Error: auto_probe failed
embedded:startup.tcl:476: Error: ** Programming Failed **


The Command line executed is:
C:\ProgramData\vmicro\tools\openocd-0.10.0.1\bin\openocd.exe -d2 -s "C:\ProgramData\vmicro\tools\openocd-0.10.0.1/share/openocd/scripts/" -f "interface/stlink-v2-1.cfg" -f "target/stm32f3x.cfg" -c "echo -n {****[vMicro]**** Uploading ELF :}" -c "reset_config; telnet_port disabled; program {{C:\Users\ms\AppData\Local\Temp\VMBuilds\CIE-Test\STM32_~1\Debug/CIE-Test.ino.elf}} reset;reset_config;shutdown"

I think the problem comes from the wrong script because it is not a STM32F3x, it is a STM32F405. How can I change this ?

The selected board is "Generic STM32F4 series -> Adafruit Feather STM32F405".

Best regards,
Marco

Title: Re: Unabe to upload via openocd to Adafruit Feather M4 (STM32F405)
Post by Simon Hopkinson on Feb 8th, 2020 at 1:19pm
Thanks for the report, and we will correct this in an upcoming release.

In the meantime if you add a Local Board.txt to the project and put the below entry in, it will override the upload script for the project. (Right Click Project in Solution Explorer > Add > Local Board.txt)

[code]tools.openocd.upload.openocdscript=target/stm32f4x.cfg[/code]

Title: Re: Unabe to upload via openocd to Adafruit Feather M4 (STM32F405)
Post by Marco S on Feb 8th, 2020 at 4:30pm
Thank you. :D It works now.

Title: Re: Unabe to upload via openocd to Adafruit Feather M4 (STM32F405)
Post by Marco S on Feb 9th, 2020 at 6:50am
I tried the same fix with an other board: A ST Nucleo-144 STM32H743ZI (the older one with a ST-LINK 2.1)
https://os.mbed.com/platforms/ST-Nucleo-H743ZI/
.

The OpenOCD is invoked with -f "target/stm32f1x.cfg".
I changed the entry in board.txt to target/stm32h7x.cfg" but the file for the STM32H7 is missing:

embedded:startup.tcl:60: Error: Can't find target/stm32h7x.cfg

What should I do ?

Best regards
Marco

Title: Re: Unabe to upload via openocd to Adafruit Feather M4 (STM32F405)
Post by Simon Hopkinson on Feb 9th, 2020 at 11:29am
Thanks for the information, we will double check these before the next major release.

It appears this config is not in the version of OpenOCD which is integrated with vMicro at present, but it seems others have authored this config in the meantime (an example at the below link).  If you download this and drop it into the "C:\ProgramData\VMicro\tools\openocd-0.10.0.1\scripts\target" folder on your PC, and then try it again.

https://github.com/ntfreak/openocd/blob/master/tcl/target/stm32h7x.cfg

We can integrate these in future builds, and if this works please let us know.

Title: Re: Unabe to upload via openocd to Adafruit Feather M4 (STM32F405)
Post by Marco S on Feb 11th, 2020 at 4:54pm
This does not work for me. Maybe the most current stm32h7x.cfg file is not compatible with the openocd version from visual micro ?

The output is:

C:\ProgramData\vmicro\tools\openocd-0.10.0.1\bin\openocd.exe -d2 -s "C:\ProgramData\vmicro\tools\openocd-0.10.0.1/share/openocd/scripts/" -f "interface/stlink-v2-1.cfg" -f "target/stm32h7x.cfg" -c "echo -n {****[vMicro]**** Uploading ELF :}" -c "reset_config; telnet_port disabled; program {{C:\Users\ms\AppData\Local\Temp\VMBuilds\Sketch1\STM32_~2\Debug/Sketch1.ino.elf}} reset;reset_config;shutdown"
Open On-Chip Debugger 0.10.0
The uploader process failed
Licensed under GNU GPL v2
For bug reports, read
     http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
C:/ProgramData/vmicro/tools/openocd-0.10.0.1/bin/..//scripts/target/stm32h7x.cfg:70: Error: invalid command name "dap"
in procedure 'script'
at file "embedded:startup.tcl", line 60
at file "C:/ProgramData/vmicro/tools/openocd-0.10.0.1/bin/..//scripts/target/stm32h7x.cfg", line 70

Title: Re: Unabe to upload via openocd to Adafruit Feather M4 (STM32F405)
Post by Simon Hopkinson on Feb 20th, 2020 at 1:17pm
I didn't see this relies on an update to OpenOCD as you say, and we have a new version which can be tried in advance of the release. 

1)  Download Updated OpenOCD ZIP and Extract to "C:\ProgramData\vmicro\tools\" (so you should have a new openocd-0.10.0.20200213 folder within tools)

2) Add the below to a local board.txt in the project for the STM32H7x board
[code]# Local Board.txt Configuration for STM32H7x and Updated OpenOCD Download
tools.openocd.upload.path=C:\ProgramData\vmicro\tools\openocd-0.10.0.20200213
tools.openocd.debug.build.openocdscript=target/stm32h7x.cfg
tools.openocd.upload.openocdscript=target/stm32h7x.cfg
tools.openocd.upload.openocddebugger=stlink.cfg
tools.openocd.upload.pattern="{upload.path}/{upload.cmd}" {upload.verbose} -s "{upload.path}/scripts/" -f "interface/{upload.openocddebugger}" -f "{upload.openocdscript}" -c "echo -n {{upload.elf.message}}" -c "reset_config; telnet_port disabled; program {{build.path}/{build.project_name}.elf} reset;reset_config;shutdown"[/code]

3) Now the commands should run as expected for both upload and debug for this board

Let us know how it goes if you have time to try this out.

Title: Re: Unabe to upload via openocd to Adafruit Feather M4 (STM32F405)
Post by Marco S on Feb 20th, 2020 at 8:13pm
Thank you again. Both boards are working now  :)

Title: Re: Unabe to upload via openocd to Adafruit Feather M4 (STM32F405)
Post by Simon Hopkinson on Feb 21st, 2020 at 12:14pm
No problem, and great to hear its all working on all boards now, thanks for the additional testing.

Visual Studio Ide for Arduino » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2020. All Rights Reserved.