This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Questions about linker/relocator

Hi everyone,

in my projects j often use the philips 87LPC764 (8051 derivative low pin count). The micro is good but it has only 4K of code memory, so j'm always searching methods to compact my code as much as possible.
In one project j use some modules written in assembler, and since the total amout of code of that modules is less than 2K j tried to use AJMP and ACALL to save memory.
Unfortunately the linker locates somewhere in memory the modules so j must use JMP and CALL to correct the situation.
J used a little trick to correct it, in the project j loaded first the assembler modules and after the other.
The linker seems to link modules in order and this trick functions good, but my answer is : How to get the modules located in low 2K of memory using a more elegant and/or fast method???
Thanks in advance.

Sorry for the long post!!!!!

Parents
  • "They work within any 2K block - there is no need to restrict it to the bottom 2K!"

    Yes, you are right! But the problem is to have BOTH modules in same block, because some functions in module N° 2 call functions in module 1.

    "Did you make sure to use both ROM(COMPACT) for the 'C' code and INBLOCK for the assembler?"

    Yes j did it. For ROM(COMPACT) there was no problem, but when j use INBLOCK j get a "improper fixup" error from the linker.
    J think the problem is that modules are relocated in a 2K block, but NOT the SAME block.

    My solution it's a simple trick but it works (j tested it)!

Reply
  • "They work within any 2K block - there is no need to restrict it to the bottom 2K!"

    Yes, you are right! But the problem is to have BOTH modules in same block, because some functions in module N° 2 call functions in module 1.

    "Did you make sure to use both ROM(COMPACT) for the 'C' code and INBLOCK for the assembler?"

    Yes j did it. For ROM(COMPACT) there was no problem, but when j use INBLOCK j get a "improper fixup" error from the linker.
    J think the problem is that modules are relocated in a 2K block, but NOT the SAME block.

    My solution it's a simple trick but it works (j tested it)!

Children
No data