In fact, the right atom has a good template engineering ... User. Lab file, obj.
A face is a library function operation mode ....
For ease of administration, within the project folder, I divided the following folders: "PROJ" Storage project files, "APP" Storage "main.c", "aplication.c" files, "basedrive" stored "uart.c" file, "Extidrive" Storage is "flash.c", "DOC" is stored in the "Readme" file, corresponding to ". h" file stored in the corresponding folder.
Can write absolute path when containing header file: "#include xxx/extidrive/' Flash.h '", but too troublesome, can also set the directory where the header file is located in the compilation software,
A) How to set the IAR:
Right-click the project file name and select "option"-"C/c++complier"-"proprocessor"-"additonal Include directories".
b) How to set the Keil:
"Project"-"Option for Target XXX"--"C + +"--"Include Paths".
This writes the relative path directly: "#include ' Flash.h '", the header file can also be found by the compiler.
The pre-bedding so much, and now began to get to the point: "Multiple. c files each other contains. h files what to do with"?
Declare variables and functions within each ". C" file, if some variables/functions are called by other ". h" files, then the variable/function is extern in the corresponding "." File, and if there are files to use these variables/functions, simply include their header files. A macro definition can be defined directly within a header file.
Hello World Firmware Library