This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SYS/BIOS: Forcing Far Calls

Expert 2430 points
Other Parts Discussed in Thread: SYSBIOS

Target: C6474
CCS: v.5.1 (M7) (relevant because of compiler/linker options)
C Compiler: v.7.3.0
Sys/Bios: v.6.32.4.49

Given my limited on-chip memory, I am placing my code both on-chip and off-chip.  By default, this produces hundreds of trampolines which, in an of itself, uses up the very memory I am trying to conserve.  My application is linear enough that I don't mind the few hundred (or even thousand) extra cycles it will take to load the address into a register and make a full 32-bit branch (as opposed the the 21-bit offset branch), so I disable trampoline call generation (to force FAR calls), but I have been running into multiple problems.  Mainly, linking BIOS generates hundreds upon hundreds of linker errors complaining about the far calls.

So two questions:

  1. In the old days, there used to be a compiler option (-ml1) to make far calls the default.  With the current tools (and CCS's options tabs), how do I make far calls the default?
  2. Will I need to rebuild BIOS to support this, or are the libraries already built and included?  And if so, how do I make the linker select them?

 

  • I'll show you how to build without trampolines.  However, there is no guarantee this will save you the memory you want.  Trampolines take up space.  But so do far calls.  Once you know how, it is not difficult to just try it both ways and see which one uses less memory.

    Alex said:
    In the old days, there used to be a compiler option (-ml1) to make far calls the default.  With the current tools (and CCS's options tabs), how do I make far calls the default?

    Don't use -ml1.  Add the undocumented option --mem_model:code=far.  Since it is undocumented, there is no selection for it in the build options dialog in CCSv4.  You manually add it to the Command text box.  I attached a screen shot at the end of this post.

    Alex said:
    Will I need to rebuild BIOS to support this

    Probably.  They are not built that way by default.  I'll let the BIOS experts address that issue.

    Thanks and regards,

    -George

  • Alex,

    Just to confirm that SYSBIOS would need to be rebuilt with the same compile option.

    Judah

  • I presume you mean rebuilt in full, correct?  This actually brings up another question about something I have always been unclear about since moving from BIOS5 to BIOS6.

    In a BIOS6 RTSC application, for the SYS/BIOS library type, one can chose instrumented, non-instrumented, custom, or debug.  For the custom, one can and has to cite the "Custom Compiler Options."

    What exactly is that rebuilding?  BIOS, or just for the .cfg file and its generated code?

    I mean, it explicitly states "rebuild the SYS/BIOS from sources," and I tried it once and it seemed to work, but I am thinking it can't be that easy.

  • Alex,

    You are correct; the custom option will rebuild some parts of SYS/BIOS.  The parts that are rebuilt are determined by your configuration settings.  For example, I just did a test build with "custom" selected and here's some of the output:

    ...

    Starting build of library sources ...
    making C:/DOCUME~1/a0323418/MYDOCU~1/workspaceAbc/uiatest/src/sysbios/sysbios.lib ...
    Could Not Find C:\DOCUME~1\a0323418\MYDOCU~1\workspaceAbc\uiatest\src\sysbios\BIOS.obj
    cl674 C:/PROGRA~1/TEXASI~1/bios_6_33_00_07_eng/packages/ti/sysbios/BIOS.c ...
    ...

    Steve