I just started working with the STM32 library today and I'm not sure what the protocol is for including C files. I could go through and include all of the C files from the library that I am using, but this seems like a lot of legwork. On the firmware library datasheet it says that ''The header file stm32f10x_lib.h includes all the peripheral header files. This is the only file that needs to be included in the user application to interface with the library.'' If this is true, then how are the source files for library referenced? Is it up to me to include all of the source files individually? How do you all go about organizing your #include's and overall file structure?
Your questions are about general 'C' programming issues - nothing specifically to do with the STM32.
Therefore, you should start with a good 'C' textbook.
Quote:
When you organize your files do you separate the source and include files into separate folders in the main program directory?
That is entirely a matter of prefernce.
Quote:
When you do this, don't you have to go back through and change all the #include's to point to the folder location?
You can if you like to make work for yourself, but most (all?) tools provide a way for you to specify a list of locations to search for headers - see the documentation for your particular tools.
Okay, it looks like you include the primary library header file, then all of the .c source files utilized by the program.
When you organize your files do you separate the source and include files into separate folders in the main program directory? When you do this, don't you have to go back through and change all the #include's to point to the folder location? Example: #include ''library\source\stm32f10x_RCC.c'' I'm learning.
Nearly ALL of your questions are answered in the read.me text files which accompany every example. (at least this is true for the IAR/Keil versions) The exact files to be included are clearly listed. Start very simply - try to blink ONE led - many more ''set-ups'' are demanded in the ARM eco-system. It will seem like much work at first - but the flexibility & capability of these devices demand this - and reward you with unmatched performance & functionality. Lastly - don't promise your boss/partner/professor anything ''over-night.'' There is a rich pool of Ap Notes - as an educator I find most learn best by ACTIVELY DOING - run the simplest programs and change ONE thing at a time...
You are not supposed to #include .c files in other .c files. You should only #include .h (header) files in .c files. .c files need to be compiled individually to produce .o (object) files, and then object files are linked (using a linker) to produce a single binary.
Like st7 mentioned, this isn't stm32 related, it's just how C programming works on any platform.
That's strange because my linker didn't have a problem with the .c files being included. I'll go back and double check the outputs, but it looks right.