2020-11-02 07:48 AM
I'm a beginner using stm32 and cubeIDE. I find that having all the setup and functions in one file is a little annoying to navigate - is there a way I can put my functions in a different file, for example? Or what are some way of managing large programs and keeping them neat and easy to navigate?
2020-11-02 09:11 AM
> I find that having all the setup and functions in one file is a little annoying to navigate
The "outline" view can be used to jump to files within a function. Pressing F3 while within a function name will jump to its definition. Both can be helpful for navigating within the source code.
> is there a way I can put my functions in a different file, for example? Or what are some way of managing large programs and keeping them neat and easy to navigate?
Functions grouped into files different based on functionality is common. You can add source files just by creating a new file within a source directory. You can also make a new directory and mark it as a source directory to further group files. I think the default organization produced by CubeMX is fairly typical of large programs.
2020-11-04 02:25 AM
Thanks, when I add a new file to the source directory and add the functions there instead in main.c i get a lot of compiler errors - is there something I need to add to the file (an include etc.) to make it work?
2020-11-04 06:06 AM
I can't see the error messages on your screen. Use those to guide you as to what the problem is, and if including header files would solve it. It is rare to have a source file which has no includes, but it is possible.
2020-11-04 07:20 AM
for example one of my functions references a LUT in main.c - after I move the function to an external file it shows an error as it no longer knows where the LUT is. How can I solve this error?