"Error writing to flash" when trying to run project

Discuss how to use the features of Atollic TrueSTUDIO, including the editor, assembler, C/C++ compiler, linker, debugger, static code analysis and team collaboration tools.

Moderators: Markus Girdland, Mattias Norlander

Posts: 1
Joined: Tue Aug 07, 2018 2:20 pm

"Error writing to flash" when trying to run project

Postby jugglingcats » Tue Aug 07, 2018 2:30 pm

Hi, I have a new project in TrueStudio for STM32 H7 board. I have been successfully coding and running this project for a while.

Sometimes when I add code to the project it compiles fine but gives the following error when I try to run/debug it:

Failure at line: 6 in "Target Software Startup Scripts". Please edit the debug configuration settings.

Error writing to flash

If I remove the latest code that was added it will run again fine. So it is consistent, but there is no apparent reason for the failure when it does occur. When fails it fails consistently, until I change the code again. Then it runs consistently, until the code is changed again. And so on.

Sometimes adding _more_ code will fix the issue. For example, I can add some dead code like this:

Code: Select all

  double t;
  for (int n=0; n< 10; n++) { t=1; }

This apparently can fix the issue - sometimes!

I have tried changing the Runtime Library settings under Settings -> Tool Settings -> General. Setting it to "Newlib standard" seems to alleviate the problem, but doesn't remove it completely.

Any suggestions greatly appreciated!

Mattias Norlander
Posts: 198
Joined: Fri Apr 29, 2016 10:01 am

Re: "Error writing to flash" when trying to run project

Postby Mattias Norlander » Thu Aug 09, 2018 6:51 am

What would happen if you let STM32CubeProgrammer flash the binary and then disconnect that app and let TS connect without using the "load" command in the Software startup script?

Return to “Atollic TrueSTUDIO tool discussions”

Who is online

Users browsing this forum: No registered users and 1 guest