Quote Originally Posted by Kisen View Post
So, I think i have fixed this. Although i dont know how or why it is fixed exactly.

so i changed the Header to contain just the defines...

Code:
#ifndef MCU_CONFIG_H        
#define MCU_CONFIG_H


#define SYS_FREQ 80000000           //MAIN SYSTEM CLOCK FREQUENCY - 80MHz
#define PBCLK (SYS_FREQ/1)          //PERIPHERAL CLOCK FREQUENCY / 1 = 80MHz


#endif
I then moved all the pragma code to a MCU_Config.c file and included MCU_Config.h

This now compiles and works as i wanted it too.
Including the MCU_Config.h in my Delay files allows the use of SYS_FREQ.

I can only assume at this point, because i cant find an answer, that the pragma code in the header file can be called multiple times, but putting it into the .c file it cant??
The meaning of Compiler pragmas are different for each compiler.
based on the errors you got I am guessing some of the pragmas generate binary code. Most binary code cannot be in headers.

Also, macros with starting underline and uppercase letters "_MCU_CONFIG_H" are not really safe to use; I think they are reserved for compiler writers.

Tim S.