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.
Hello All,
i wanted to apply some modular approach in my program designing, so i decided to pre-write some common modules which are frequently used by me (like a customizable 7 segment display code, LCD code, etc.) and include (add, or whatever) the corresponding file whenever i needed it.
Say, i am working on a new project and i want 7 segments, i simply include it's assembly file into the new one (or it's library, what ever is feasible) and since the code is fully customizable i call the corresponding functions to "initialize" the pre-written 7 segment code so that it can adapt to new project.
(i am creating segments and using DS control statements so that i don't have to worry for memory allocation, overlapping, etc.)
Now the problem is:
if i use the $INCLUDE(<complete filepath>) directive, then the linker gives me an error: L5: CODE SPACE MEMORY OVERLAP From: 0000H To: 0001H But i haven't included any code in this memory segment in the base (inherited) assembly file! i am only using an interrupt code-
CSEG 001B LJMP Base_Timer1_ISR
Yes there is a code in my new file (derived file) starting at 0000 and simply jumping to a pre-defined Main label (also in the new file)
i am unable to resolve this! Please help. There are ABUNDANCE of resources on how to link assembly and c files, but nothing about this problem.
Also, would using library files be more beneficial? if yes, please refer me to some material which solves my purpose described above.
Thank You for Your time.
@ Andy Neil
Assemble each source file to a separate object file, and use the Linker to Link them.
How can i do that? and would it not create the error?
a small example would be nice showing how to do it.
@ Hans-Bern hard Broeker
As a matter of fact, you have.
i am sorry i am unable to get You.
The error says Code Space Memory Lap from 0000H to 0001H whereas i have written code in memory location at 001BH... how can it generate an error for locations 0000-00001H?
if anyone wants, i can upload the code here?
You just add all the files to a uVision Project. uVision then handles translating & linking them.
There is a multi-file assembler example in your KEIL\C51\EXAMPLES\ASM folder.
No, you haven't!
Look again, very carefully, at precisely what you actually wrote.
Compare character-by-character...
Okay, i have studied the example and tried to implement the same and the good news is, it is now working! :) i'll test more in the morning and let You know if i dont understand something.
Thank You a lot for Your help! :)
Just 1 tiny little thing more:
In the Keil\C51\Examples\ASM example, i noticed there were also batch files present for each .a51 files they included into a single project, but in my case, there were no batch files created, yet the example is working fine.. why is it so?
Thank You again for Your time!