C library calls at fixed ROM addresses

I need to write a small function running in XRAM that uses the C runtime library routines that are present in existing ROM code. I know the absolute locations of the library routines from the ROM link map. What is the syntax to force the BL51 linker to use these locations but not link in the code?

For example,
the internal multiply routine is at 0x17D8 in the ROM, common bank. I need to use this statement in a function:

 ...
 a = b * 5;
 ...

and I want the linker to LCALL 0x17D8 when it calls ?C?IMUL. This is running on a customized 80320 processor. I have specialized hardware that transfers control to XRAM when a selectable address in the ROM is about to be executed.

Thanks

Parents
  • I don't quite understand the question. You don't need to force the linker to use the addresses in the link map. It will use those anyway. (That's how they got into the link map in the first place.)

    It doesn't make any difference whether your program store is physically RAM or ROM. You have to decode your RAM into the code space in order to fetch and execute instructions there. (Normally I think of von Neumann memory the other way around; that is, mapping the code space into the xdata address space. Whatever.)

    Do you mean that you have ROM and a RAM that overlays that ROM, and you switch to the RAM when you execute at a certain address? (This would be some sort of specialized debubging hardware to let you set breakpoints in your code? Or perhaps some sort of patch buffer?) In that case, just fill the RAM with the complete program that matches the ROM -- assuming it's big enough and covers the whole address space.

    If you have part of the code space implemented in ROM and part in RAM, then tell the linker where to put the parts that live in RAM. The linker will call back down into the ROM segments normally.

    If the problem is just that you want an image of one bank of a banked application, then you could let the linker generate the entire image as it likes, and then just trim down the hex/bin/omf file to keep the part that you want.

Reply
  • I don't quite understand the question. You don't need to force the linker to use the addresses in the link map. It will use those anyway. (That's how they got into the link map in the first place.)

    It doesn't make any difference whether your program store is physically RAM or ROM. You have to decode your RAM into the code space in order to fetch and execute instructions there. (Normally I think of von Neumann memory the other way around; that is, mapping the code space into the xdata address space. Whatever.)

    Do you mean that you have ROM and a RAM that overlays that ROM, and you switch to the RAM when you execute at a certain address? (This would be some sort of specialized debubging hardware to let you set breakpoints in your code? Or perhaps some sort of patch buffer?) In that case, just fill the RAM with the complete program that matches the ROM -- assuming it's big enough and covers the whole address space.

    If you have part of the code space implemented in ROM and part in RAM, then tell the linker where to put the parts that live in RAM. The linker will call back down into the ROM segments normally.

    If the problem is just that you want an image of one bank of a banked application, then you could let the linker generate the entire image as it likes, and then just trim down the hex/bin/omf file to keep the part that you want.

Children
More questions in this forum