In order not to deal with the glitches of various IDEs, I studied the software model through assembler. And then it was necessary to very quickly figure out the algorithm and had to fight with cubeIDE
Another way is to regenerate the code from the cube, this corrects the paths to the included files, but erases the code that is not in user sectors. In this case, the generator adds the same paths, but in a relative format. And everything works. Tod...
The problem arises when making changes to the hal files, apparently while they somehow fall off the compiler. It is solved by manually setting the paths. Project -> Settings -> Tool settings -> GCC compiler -> include paths.