Skip to main content
Associate II
April 11, 2025
Question

PyOCD Programming

  • April 11, 2025
  • 2 replies
  • 812 views

Hello, I’m trying to use the PyOCD library to program an STM32H747 and an STM32U5A9 using .hex or .bin files generated by STM32CubeIDE. So far, I haven’t had much success, and I’d like to know if anyone has experience with this or can offer guidance on how to proceed. I’m also open to alternative ways of programming these devices besides using TouchGFX or STM32CubeIDE.

2 replies

Andrew Neil
Super User
April 11, 2025

@matias_efe wrote:

alternative ways of programming these devices besides using TouchGFX or STM32CubeIDE.


There's CubeProgrammer?

It has a command-line mode ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate II
April 11, 2025

Hi, the STM32CubeProgrammer doesn't work, and I get an error when uploading the file. The specific error is: Failed to upload file Sector [0].

Andrew Neil
Super User
April 11, 2025

GUI, or command-line ?

Please show more details  - screenshot; the full log text ...

Can you program OK from within the CubeIDE ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate II
April 11, 2025

matias_efe_0-1744382283759.png

matias_efe_1-1744382561527.png

 

In STM32CubeProgrammer, I encounter this error when loading a .hex file, and I get the other  issue from the console when using PyOCD.

Andrew Neil
Super User
April 11, 2025

Is this downloading directly from a build in CubeIDE ?

If CubeIDE can't download the file that it's built, then it's no surprise that PyOCD can't do it, either!

Need to find what's wrong!

Can CubeIDE download the ELF ?

Can CubeIDE build and download a simple Blinky ?

 


@matias_efe wrote:

program an STM32H747 and an STM32U5A9.


What do you mean by that?

Loading two chips simultaneously? One After the other? One chip is programming the other? Or what??

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.