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

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
  • OK,
    more info:
    This is a patch to an existing program in ROM code. The patches reside in XRAM while maintaining the context of Bank 3 of the ROM. Hardware makes this happen. The C runtime libraries exist in the common bank of the ROM. I have very little space in the XRAM so adding the libraries there is not an option.

    When I have implemented patches in assembly I have just called the library routines directly using LCALL. I want to be able to do the same thing from C. When I built a test function it compiled fine, but the multiplication operation is expecting the C runtime library multiply routine. I would like to set the link file or some pragma to get the linker to realize the library exists but that it does not have to actually link it into the absolute image. I could do this manually for my own functions but I cannot do it for the compiler as it specifies the routines it needs to generate the relocatable image.
    So to re-iterate: for example my C runtime library routine to multiply two integers is at location 0x1234 in the ROM. I know this by examining the link map generated by the ROM build. I want to configure the compiler and the linker such that when the compiler encounters "a = b * c" and calls the multiply routine, the linker supplies the absolute address as it exists in the ROM to my image.

Reply
  • OK,
    more info:
    This is a patch to an existing program in ROM code. The patches reside in XRAM while maintaining the context of Bank 3 of the ROM. Hardware makes this happen. The C runtime libraries exist in the common bank of the ROM. I have very little space in the XRAM so adding the libraries there is not an option.

    When I have implemented patches in assembly I have just called the library routines directly using LCALL. I want to be able to do the same thing from C. When I built a test function it compiled fine, but the multiplication operation is expecting the C runtime library multiply routine. I would like to set the link file or some pragma to get the linker to realize the library exists but that it does not have to actually link it into the absolute image. I could do this manually for my own functions but I cannot do it for the compiler as it specifies the routines it needs to generate the relocatable image.
    So to re-iterate: for example my C runtime library routine to multiply two integers is at location 0x1234 in the ROM. I know this by examining the link map generated by the ROM build. I want to configure the compiler and the linker such that when the compiler encounters "a = b * c" and calls the multiply routine, the linker supplies the absolute address as it exists in the ROM to my image.

Children