pyocd / pyocd/pyOCD

Fail to program big files on stm32h743

Open
#1,200 12 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug flashing target
Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

Hello,

I'm trying to load a firmware on a nucleo_h743zi using pyocd.
When the firmware size is small (blinky, hello world, ~20kB) everything is fine: my firmware is downloaded onto target and runs smoothly.
However, if the firmware gets big (tried with 256k), pyocd says that it programmed the file correctly, however the firmware does not run or crash (fault trace from zephyr OS).

I dumped the content of my flash and saw that some portions of the flash was left unprogrammed (0xff) or set to 0.

When using openocd or STM32_Programmer I do not have that issue.

I tried to increase the size of an hello-world by adding random data at the end and tried programming it with STM32_Programmer_CLI (it works) and with pyocd (does not work).

Here are the various command line used:

  • Grow small binary file (hello.bin):
head -c 200k < /dev/urandom > random.bin
cat hello.bin random.bin >> big_hello.bin
  • programming firmware:
pyocd flash -e sector -a 0x8000000 -t stm32h743zitx -O reset_type=hw  --pack Keil.STM32H7xx_DFP.2.7.0.pack big_hello.bin 
STM32_Programmer_CLI -c port=SWD -d big_hello.bin 0x08000000 -rst
  • Dumping memory content:
pyocd commander -c "savemem 0x08000000 220712 dump_with_cmder.bin"
STM32_Programmer_CLI -c port=SWD  -u 0x08000000 220712 dump_from_stm32prog.bin

Memory read from the devices is always the same regardless of the method.
Memory written to the device is not correct when using pyocd.

Let me know if you need additional information.

Thanks.
ps: by now, I also get errors when programming small firmwares.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the issue with the provided pyocd flash and commander commands on the nucleo_h743zi, then compare the resulting dump with STM32_Programmer_CLI and OpenOCD; done means pyOCD programs and verifies the complete image without missing or zeroed regions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.