How do I link several assembly files (src) together Hi! I am new into a project where I have several assembly files (.src) belonging to a project in my hand. I figured that almost 80% of them belong to the project and the rest 20% are just there (I am not too sure about it may be they are old source files). I created a new project using Keil uVision2 and added up all the assembly source file under it. But now how do I tell it which all source files it has to link and which not. Because as of now If i saw build target files it just tries to build every assembly source file in the order they where added. Can anyone help me to understand how actualy you link the various assembly source files in Keil uVision2. Since my project has no documentation is there also a smarter way to find out which all assembly source files belong together and should be linked. Regards Kumaran
"it just tries to build every assembly source file in the order they where added." Yes, that's exactly what it's supposed to do! "Can anyone help me to understand how actualy you link the various assembly source files in Keil uVision2" See above: if it's in the Project, it gets translated & linked - unless you uncheck the 'Include In Build' box for the specific file or its group. "Since my project has no documentation is there also a smarter way to find out which all assembly source files belong together and should be linked." If they cause link errors due to duplicate definitions. you must decide which to remove. Once it links without errors, you may be able to use the source browser to find unused definitions - bit sure if it works with Assembler, though.
Thank you Andrew for the information. My problem is I guss the whole project was developed using Riegel environment and now when I try to build the assembly source in Keil uVision2 it gives several errors like code line: MOV SP,#0FBFEH Error displayed for the above line Source\main.src(33): error A42: UNDEFINED IDENTIFIER Source\main.src(33): error A74: OPERAND TYPE MISMATCH And I have the same above error in many lines of the code. Hope you can give me an insight about this kind of error in most of my code lines. I guss only if I do away with these errors can I see If i am getting any link errors. Many Thanks! Kumaran
The problem may simply be that the assembler wants to see hexadecimals in C-type format. i.e.
MOV SP,#0xFBFEH
MOV SP,#0FBFEH
MOV SP,#0FBFEH Error displayed for the above line Source\main.src(33): error A42: UNDEFINED IDENTIFIER Source\main.src(33): error A74: OPERAND TYPE MISMATCH My guess is that SP is not defined (hence UNDEFINED IDENTIFIER). Jon
"My guess is that SP is not defined (hence UNDEFINED IDENTIFIER)." Yep - it always pays to read the error message, and take it literally! In porting from one assembler to another, you are always going to have to do some work in adapting the syntax. You will have to read the Manuals for both assemblers!
Thanks Andre, John and Graham. I tried MOV SP,#0xFBFEH (Graham) but it didnt help. So I guss too that SP is not defined. But what suprises me is the next line of code which moves data into the CP dosnt bring any error. Its just the first line. MOV SP,#0FBFEH MOV CP,#0F600H This whole code is in the main.src module and ur right I dont see any initialization for SP in main.src. How could have this code compliled before in Riegel if they had not defined it then? Can you let me know how I initialize SP for Keil uVision2 assembler? Regards Kumaran
How could have this code compliled before in Riegel if they had not defined it then? By means of an #include file, typically. Or because the assembler assumes it knows the target architecture well enough that it can predefine all SFRs. IIRC, Keil does that in A51 by default, but not in AX51 (the extended assembler). You really will have to read the manuals. Slowly. All of it at least once. You stand no chance of getting this project done unless you learn how to use all the tools involved. It may be better to step back from the actual project for the time being and investigate the Tutorial and examples coming with your Keil installation.
Yes thats why I am trying to work out the tutorials first. My problem is I was a database programmer before. The whole project is written in assembly with not a single line of C code so there is no #include in the code. All i can see is calls to various other modules from the main.src And ofcourse I see some INC files with EXTERN directives. But even there I dont see any SP initialization.
"How could have this code compliled before in Riegel if they had not defined it then?" Probably because it has some pre-defined symbol "SP" To confirm this, you will have to read the Riegel Manual(s) "Can you let me know how I initialize SP for Keil uVision2 assembler?" For this, you will have to read the Keil Manuals I'm sorry - there is no shortcut here: if you're porting from one assembler to another, you need a thorough understanding of both assemblers! Time for some serious reading!
"You really will have to read the manuals. Slowly. All of it at least once." That should be, "You really will have to read the manuals. Slowly. All of them at least once." That's all the Keil manuals and the Rigel manuals. "You stand no chance of getting this project done unless you learn how to use all the tools involved." Exactly - and that means both the Keil tools and the Rigel tools.
"My problem is I was a database programmer before." Yes, that's a big problem! ;-) seriously, if you have no idea about assembler, then you really need to learn assembler first - before you start trying to port undocumented Rigel assembler into Keil assembler! Maybe the honourable thing to do would be to admit now that you are not the right man for this job at this time - I think this is a job for an experienced embedded assembler programmer. "there is no #include in the code. All i can see is ... some INC files with EXTERN directives." That's the assembler equivalent of #include! Again, you really need to get to grips with assembler before trying to take this port any further at all!
Thanks for all the input. I too realise that I have to get a grasp with the manuals first. I plan to take up a training course which Keil offers. Hope that helps me to start with. I would have to do all this by end of this year and be ready to do some serious job. I dont know if its possible but I hope its possible.
Hi All! I would like to know if some of you can suggest a good book to learn assembler and C for embedded system programming. my platform is the Infinion C167CR-LM processor.
Here are a few places to start: http://www.keil.com/books/8051books.asp I learned 8051 assembly from the Intel Instruction Set Manual (http://www.keil.com/dd/docs/datashts/intel/ism51.pdf). Jon
Oops, I keep thinking this is an 8051 thread. Just ignore that last post. I learned the 166 by writing small programs and looking at the assembler output from the compiler. There are a lot of strange addressing modes the 16x can use and that was the easiest way for me to learn them. The old Siemens C167 databook wasn't too bad but it had a lot of Germlish (German converted to English). Jon