Skip to main content
GeneralTao
Associate II
June 25, 2020
Question

Jumping to random file after pressing Run button

  • June 25, 2020
  • 105 replies
  • 56095 views

Hello. When I press to Run (Run main.c) button, STM32CubeIDE opens random file, possibly, from current repository, for example: startup_stm32l452xx.s, core_cm4.h etc...

Code is loading successful, but this side effect bothers me.

I would like to disable this function. How can I do it?

If you need more information about this behavior please, ask.

Thank you for reading.

105 replies

mattias norlander
ST Employee
June 30, 2020

I imagine most people would want the editor to open the file to be able to show the line where the execution is halted. So in your case the problem is that it is not the right file that is opened?

Some follow-up questions:

  • CubeIDE only opens one file each time it halts correct?
  • Which CubeIDE version and which OS are you running on?

Which optimization level are you using when debugging? This could be a result of using a high optimization levels. The source code look-up only works with -O0 and -Og.

HTD
Senior II
May 13, 2023

Oh, it's an old thread, but to make it perfectly clear, it doesn't halt like on breakpoint. It just opens the file, the debug session goes on. Without a debug session, when just `Run` option is used - it's the same. The app starts normally, but some files (usually startup / boot code) is opened. For STM32H7 project it's usually the startup file (so it's not random - it's really the first thing that is executed), then some system drivers and OS files, like usb drivers, diskio, that sort of thing. It's almost never the user code, however, it happened too - my application file was opened without a reason once or two.

So I'd take strong educated guess, that the file open is never unrelated to the project, it's always a file whose content was executed.

The problem is following: why does it open? When there is a breakpoint in a file AND when I'm in the `Debug` mode - it SHOULD open. Then and ONLY then. Here both conditions are false. There is no breakpoint in the startup file and I'm not in the debug mode. The file opens.

Another interesting detail: the spurious files are also opened on TERMINATING the debug session. I press stop, then a file opens. Let's say it takes a good hour from my work day just to close those files over and over again and then recalling what I was doing before and what was the file I was working on a while ago.

May 31, 2023

The same here. After many debug sessions my IDE is full of unwanted opened files. Very annoying.

Looks like a long-playing problem ...

Version: 1.12.1

Build: 16088_20230420_1057 (UTC)

GeneralTao
Associate II
July 3, 2020

Thank you for answer.

I mean just Run mode, not Debug mode (image on the bottom). CubeIDE opens different files. Last time it opened startup_stm32l452xx.s and system_stm32l4xx.c.

Also I noticed, that it opens files only when ide detects some errors.

For example, if I gives none r-value to third parameter of HAL_DMA_Start_IT function like here:

HAL_DMA_Start_IT(&hdma_usart2_tx, (uint32_t)mes, (uint32_t)&huart2.Instance->TDR, strlen(mes));

Ide shows me system_stm32l4xx.c file and places cursor to 7 line (in code further):

 /* Configure the Vector Table location add offset address ------------------*/
#ifdef VECT_TAB_SRAM
 SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
 SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif
} // <------------ here is cursor

May be it tries to help me to define error, but I don't understand how should I use this information.

I just know: if ide opens file for me - something wrong in code.

Also, I use

Windows 10,

STM32CubeIDE Version: 1.3.1 Build: 6291_20200406_0752 (UTC)

My optimization level is None (-O0)

mattias norlander
ST Employee
July 3, 2020

Sounds like unexpected behavior. I cannot reproduce on my environment Windows 10. What happens if you just for the sake of testing:

  1. Start a new workspace
  2. Create a new test project
  3. Use the "Run" button to download code.

Would be interesting to know if it is still the same issue with a fresh workspace? If no issue with new workspace, then I wonder if you made any preferences settings in old workspace?! Eclipse is a huge jungle of settings. Few people on planet earth know them all and the implications they may have in various corner cases...

Piranha
Principal III
July 4, 2020

And also Eclipse is probably the only IDE on planet Earth, where some "geniuses" thought that blending together IDE settings with project settings is a good idea. Damaged workspaces are a thing exactly because of this "genius" design... :)

GeneralTao
Associate II
July 7, 2020

Thank you for answer. And sorry for delay.

mattias norlander, I tried your advice. It really helped me. May be during learning this ide I changed some configs.

I also amazed, what new workspace was created with new interface icons. May be some update changes take effect only in new workspace.

Jenny Kenny
Visitor II
December 2, 2021

I faced the same problem! Interferes with work! Constantly, even when there are no errors, a random file from the project opens in the tab after clicking on "Run" (Run as).

0693W00000GZkaTQAT.gif

ToStei
Associate II
December 23, 2021

For me (and a co-worker) too. New project doesn't change the behavior... I am working with CubeIDE 1.8.0 . Have you found a solution, its quite annoying?

Best wishes and a nice Christmas

Tobias

sintech
Associate
March 22, 2022

Same issue on 1.9.0.

Loic1
Associate II
May 13, 2022

I have exactly the same issue (on 1.9.0) without any errors or warnings when building.

Ugilten
Associate III
May 17, 2022

I am jumping in here two say I have the same problem (and to follow allong with any answers)

It seems to me that it opens the file/line that corrosponds to the program counter when it is reset for programing. I have seen on multiple occasions where it shows the debug program counter indicator (maybe this has a better name) in the main while(1) loop, or some of the error handler while(1) loops.

Maybe this can provide some clue someone clever ??

TomC
Senior
June 1, 2022

Just here to add my name to the tally. This has always happened for me also

SCole.19
Associate
June 2, 2022

Not an answer, just a confirmation.

This is not an isolated incident, I have done about 500 extra mouse clicks this week just closing the random files that open on each compile or debug, and this has happened with every version of Cubeide that I have used.