Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/17/03 08:51
Read: times


 
#60810 - RE: Asm variables from C keil
Responding to: ???'s previous message
Sachin:

Your attempt to code assembly language with C code tells me that you are using multiple source files for your project. It also tells me that you are using the linker to resolve and connect variable name and code label links between the various object files that are produced by the C compiler and the Assembler.

Here are some points I think you should ponder as you look forward to a solution...

1) You should really try access the documentation that comes with your tool set. It has quite a bit of good information on working with C and assembly language together.

2) I would make your C subroutine in one source file and then make up a trial C code main module call the C subroutine and permit its testing. Get this all working so that you are 100% confident with the C subroutine. Then change this trial main "calling module" so that it has the #pragma SRC directive at the top. This will make the compiler spit out a "FILENAME.SRC" file of assembler language that you can look at. This should lead you to some tips as to how the original assembler that you are mucking in should be written as regards to how the variable names, segments, PUBLICS, and EXTERNs should be adapted.

Personally I think the use of hard coded addresses for variable names is about 90% of your problems. You may want to look at comments I have previously made about hard coded subroutine addresses in the following posts. (Keep in mind you probably want to read the rest of the threads where in my posted comemnts are found).

http://www.8052.com/forum/read.phtml?id=35740
http://www.8052.com/forum/read.phtml?id=59234

The path where you are going will likely have you becoming familiar with the assembly language concept of the RSEG directive. Look at some of these links..

http://www.8052.com/forum/read.phtml?id=42598
http://www.8052.com/forum/read.phtml?id=50090
http://www.8052.com/forum/read.phtml?id=58136


Michael Karas



List of 18 messages in thread
TopicAuthorDate
Asm variables from C keil            01/01/70 00:00      
   Answer already on Keil forum            01/01/70 00:00      
      RE: Answer already on Keil forum            01/01/70 00:00      
   RE: Asm variables from C keil            01/01/70 00:00      
      Cross-posting            01/01/70 00:00      
   RE: Asm variables from C keil            01/01/70 00:00      
      RE: Asm variables from C keil            01/01/70 00:00      
         RE: Asm variables from C keil            01/01/70 00:00      
            RE: Asm variables from C keil            01/01/70 00:00      
               RE: Asm variables from C keil            01/01/70 00:00      
                  RE: Asm variables from C keil            01/01/70 00:00      
      RTFM!            01/01/70 00:00      
         RE: RTFM!            01/01/70 00:00      
            RE: RTFM!            01/01/70 00:00      
               RE: RTFM!            01/01/70 00:00      
                  Dont do it!            01/01/70 00:00      
   RE: Asm variables from C keil off topic            01/01/70 00:00      
      RE: Asm variables from C keil off topic            01/01/70 00:00      

Back to Subject List