We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Can someone tell me, which of Keil CARM and RealView generate smaller code?
The problem is,
RTOS (FreeRTOS) compiled with RV is so much larger than it would with CARM, beyond belief. Actually I cant compile with RV, it has linker error
DemoProj.axf: error: L6047U: The code in this image is 21360 bytes - this version of the linker will not create images that large
It really shouldnt be that big. What could be the problem?
Thumb or ARM mode? Different optimization settigs?
Sorry, my mistake. Didnt realise that particular RV FreeRTOS port include a very large header file.
"...that particular RV FreeRTOS port include a very large header file."
How can a header file have code defined on it? Does that header define large data arrays?
"How can a header file have code defined on it?"
Very easily!
There is nothing special about so-called "header" files - as far as the compiler is concerned, it's all just source text.
So you can do anything in "header" files that you can do in any other 'C' source file - including defining (not just declaring) functions and data.
Whether it is wise to do so is, of course, another matter entirely...
"you can do anything in "header" files that you can do in any other 'C' source file"
Every now and again we see abuse of header files.
Of course you can but, as you said, it is not good to do so. The preprocessor will not complain, but other fellow programmers will.
Risking being obvious: A header file (.h) should contain descriptions of the data and functions declared in a particular (.c) file, so these data and functions can be used by other program modules. Besides extern data and functions, all public typedefs, enums, #define macros and constants should be declared in header files, so they will be visible by all modules including the header.
And never, NEVER #include a (.c) file into another.