Hello,
I have a problem with #pragma SRC directive. First, when I write it at the begining of my C file the compiler (CARM) writes:
MAIN.C(1): warning C2: 'SRC': unknown #pragma/control, line ignored
Then I removed this line and right-clicked main.c in project window and under Options I checked Generate Assembler SRC file and I got this message:
Build target 'MCB2140' compiling main.c... linking... *** WARNING L23: UNRESOLVED EXTERNAL SYMBOLS *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ?C?INIT ADDRESS: 00000104H Program Size: data=1168 const=16 code=296 Target not created
This is strange because I have main routine in my main.c file. Can anyone help me?
Best regards,
Borut
"I have a problem with #pragma SRC directive."
I think the basic problem is that you didn't check in the Manual first to see if the CARM compiler actually supports a "#pragma SRC" directive - obviously, it doesn't!
"This is strange because I have main routine in my main.c file."
But you have converted your main.c to assembler. So the tools now see it as just an assembler source file - not a 'C' source file. Therefore, they don't automatically include the necessary 'C' support files.
You have to manually include the necessary 'C' support - search the knowledge base for details (try searching on that error message).
But why are you converting to assembler anyway? Just don't do it - then you won't get the problem!
First, CARM supports SRC directive (I checked the manual before : SRC - Creates an assembler source file instead of an object file - written in CARM User Manual). Second, the error about missing ?C?INIT is said to be because of missing void main (void) in C file - http://www.keil.com/support/docs/2917.htm) so that is why I'm asking about this. An last, I'm trying to convert to SRC file becasue I want to see how to mix assembler and C and this way I can see how calling conventions are done. Andy, no hard feelings, but your answers aren't always helpful - I know about manuals and stuff but still.... If your answer can only be read the Manual than don't answer anything.
Regards, Borut
"I'm trying to convert to SRC file becasue I want to see how to mix assembler and C and this way I can see how calling conventions are done."
That's a good way to do it. And, if all you're doing is reading the generated assembler, it doesn't matter that it doesn't link.
The problem is still remains: the assembler doesn't generates *.SRC file. So I don't even see the generated file. That is why I putted this question on. Why the SRC directive doesn't work (althoug the CARM manual says it does) and why the enabled option for C file generates the ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ?C?INIT, even if I have the main function in C file and again the SRC file is not generated.
Thank you for your time. Borut
Typing error above: Enabled option for C file is Generate Assembler SRC file.
"the assembler doesn't generates *.SRC file."
Of course it doesn't - the .SRC file is the input to the assembler!
The .SRC file is (or should be) generated by the compiler - instead of a .OBJ file See: http://www.keil.com/support/man/docs/ca/ca_cm_srcfile.htm
Are you sure you are looking in the correct folder for it?
You are right - compiler generates it. My mistake. But the problem here is that the compiler doesn't generates it as I already mentioned before. I checked the project's folder and I there isn't any *.SRC file (there is always an error and the target isn't built - one is that the #pragma SRC is not recognized by the compiler or if I enable the Generate Assembler SRC under Options for C file there is the error of ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ?C?INIT as I already wrote). Now you see my problem? :) In the begining of my C source file I wrote #pragma SRC and there was the unrecognized directive. Then i erased this and I enabled the Generate Assembler SRC file under Options for my source file. Again an error L128.... Next, I read the manual for CARM and there it says that SRC is supported by the CARM. What am I doing wrong here? Thank you again.
Are there any evaluation restrictions (my CARM is an evaluation software)?
"I checked the project's folder and I there isn't any *.SRC file"
Have you specified a separate folder for output files? Perhaps the compiler puts it in its output folder?
"if I enable the Generate Assembler SRC under Options for C file there is the error of ERROR L128"
This suggests that the .SRC file is correctly generated byt the compiler, and correctly translated to .OBJ by the assembler, in this case
"Are there any evaluation restrictions"
Of course there are!
http://www.keil.com/demo/limits.asp
But nothing about SRC being unavailable or restricted, though...