Skip to main content
GeneralTao
Associate II
Jun 25, 2020 1:27 PM UTC
Question

Jumping to random file after pressing Run button

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.

230 replies

eos1d3
Associate II
Sep 1, 2022 6:28 PM UTC

I also have random file open automatically after run. But:

  1. it will not have this issue if I do not run debug.
  2. After running debug once, normal run will always open random file, but mostly it is startup file. This is exactly what mentioned by @Vertinhol in the above post.
  3. This has nothing related to workspace or settings. Just exit the IDE and run again within debug, it won't have any problem.

Please try Mac version as Mac versions have a lot more bugs than Windows.

Another very annoying issue and on Mac only:

When MX file is active and you would like to open other C or header file, after clicking any C or header file, the MX file will be open and active again. But if you clicking other file again, the MX file will not be active again. This happens from 1.8 to 1.10.1 and on Mac only. Windows versions do not have this issue.

These 2 bugs are very very annoying! Please fix them!!!

tungnguyen.dsc
Visitor II
Sep 8, 2022 5:23 PM UTC

Hi, I also faced exact the same issue and I found this.

Detach and then drag those files to the bottom corner, and even hide it if you want.

Next time the cursor will remain in main.c file.

0693W00000SurflQAB.png0693W00000SurbeQAB.png

PHolt.1
Senior
Sep 9, 2022 10:41 AM UTC

I can't replicate this.

I can Detach the file, but where is this "bottom corner"?

And do you have to do that with every file which pops up spuriously, and eventually you will have gone through all the .c files in the project?

tungnguyen.dsc
Visitor II
Sep 9, 2022 3:23 PM UTC

A more simple way that I usually do is that detach and drag all of those files to my second screen. It will take you sometime at first, but after that the cursor won't randomly jump to another file.

PHolt.1
Senior
Sep 9, 2022 3:29 PM UTC

Sorry but I struggle to work out what your "second screen" is. It is almost like you are running Cube on a phone, which you obviously aren't.

I have the standard Cube install setup i.e. the project hierarchy down the left, the edit screen in the middle, and the screen for stuff like breakpoints on the right. On the bottom is a screen for stuff like Console.

So there is no obvious place for me to drag the Detached file to.

tungnguyen.dsc
Visitor II
Sep 9, 2022 3:38 PM UTC

Sorry, I actually mean my second monitor.

PHolt.1
Senior
Sep 9, 2022 3:55 PM UTC

Ah, you Detach the file and drag it on the 2nd monitor, and then what do you do with it? Do you leave it open there, or Close it?

The issue with spurious files opening when one does a Debug build (the F11 option) is not so much that these files are getting opened. It is that the focus (the window to which keystrokes get directed) shifts to some random file. And if this is not detected (you can set Cube to automatically save modified files -not a good idea!) you get all sorts of problems. I've had to restore a file from a backup a few times, but I was lucky that the keystroke produced a compilation error. Sometimes a line gets deleted...

It is so arrogant of ST to push out a product like this and not fix it.

eos1d3
Associate II
Sep 9, 2022 4:07 PM UTC

For me, this problem is not related to second monitor as I use only one. And the easiest method to stop this problem is to exit the IDE and run again. It will occur if you run debug mode.

YKILI.1
Visitor II
Sep 20, 2022 5:02 PM UTC

Dear ST Official Guys, if you do not mind,

Will you solve this opening random files issue whenever it runs???

tarzan2
Associate III
Sep 21, 2022 5:04 PM UTC

I have exactly the same problem in run and debug mode since the beginning of cube IDE (all versions) and also with previous IDE (sys workbench). Using 4 different computers (debian, win10, win7). For all projects.

Generally the file opened is the startup.s file but sometime it's a random HAL file.

This is absolutely boring and it hard to believe that ST cannot reproduce the behavior.

PHolt.1
Senior
Sep 21, 2022 7:35 PM UTC

Of course they know about it but they aren't interested.

One can almost understand Cube opening the file which runs when the code is started (startup-something.s). Pointless and dangerous due to potential keystrokes absorbed but maybe not surprising. After that it has an optional feature to breakpoint on main(), but the checkbox for making that optional seems to have disappeared (I can't find it in v9 onwards).

The random other .c file opened is just totally dumb. And dangerous.

HSung.1
Visitor II
Feb 27, 2023 7:58 AM UTC

Same issue on v.1.11.2 started after first debug.

This still continued for new projects and even after IDE program remove and reinstall.