1
\$\begingroup\$

I have designed custom-made PCB with STM32L071C8 MCU. I'm using OpenOCD 'master' branch and SWD interface via FT2232H to debug the MCU.

I successfully did some RAM reading and Flash writing, erasing on the MCU via the OpenOCD so the OpenOCD ->FT2232H-> SWD on MCU works.

But, I have a weird problem with writing to Flash more than 192 bytes or in other words 128 bytes (page) + 64 (half page). the OpenOCD prints an error message about failing to write the data to the desired flash address

error writing to flash at address 0x08000000 at offset 0x00000000

I have executed OpenOCD with debug prints and came up with these logs.

Log of successfully writing 100 bytes to flash.

Log of failure to write 192 bytes to flash - the problem described above.

as you can see in the logs I'm using 'fillb' OpenOCD command to write bytes to flash.

Before each 'fillb' command I take care to erase the desired flash page. I didn't mention the erasing in log.

Have you any advice about how can I investigate this problem? or maybe any solution?

\$\endgroup\$
  • \$\begingroup\$ Pragmatically, why do you need to do this? Loading files works for you, right? So what do you need this process to accomplish? Is using 'fillb' (vs 'fillw') even allowed on a flash that must be written in full words, and unlike some other types (including STM32F's) does not allow overwriting yet unwritten bits further away from the erased state? \$\endgroup\$ – Chris Stratton May 6 at 21:40
  • \$\begingroup\$ @ChrisStratton When I'm using 'flash write_image erase' command I see the same error as I get from 'fillb' command. it seems it doesn't matter. \$\endgroup\$ – Mercury Avangburg May 6 at 21:54
  • \$\begingroup\$ Hmm, that's odd, I program STM32L072's all the time. Granted my OpenOCD is maybe two years stale before they did some sweeping changes to the config files that I'm yet to update our custom stuff to match. \$\endgroup\$ – Chris Stratton May 6 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.