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.

getSects() does not appear to be called

Hello,


In one of my custom XDC modules I am attempting to add my own getSects() function into package.xs. For whatever reason it does not seem that the function is called. I added print to see if I could find it in the output but it is not there. I also looked in the .xdl file for any of my template output, and nothing is there.


getSects():

function getSects()
{
    print("Ethernet Driver Package getSects\n");
    return "prog/drivers/ethernet/Ethernet_link.xdt";
}

Ethernet_link.xdt:

%var Ethernet = xdc.module('prog.drivers.ethernet.Ethernet');

SECTIONS {
   `Ethernet.EthernetSectionNamePrefix` : {
      __ethernet_region_start__ = .
      `Ethernet.EthernetSectionNamePrefix + "." + Ethernet.TxDescriptorSectionName` : {*(`Ethernet.EthernetSectionNamePrefix + "." + Ethernet.TxDescriptorSectionName`)} > LSRAM
      `Ethernet.EthernetSectionNamePrefix + "." + Ethernet.RxDescriptorSectionName` : {*(`Ethernet.EthernetSectionNamePrefix + "." + Ethernet.RxDescriptorSectionName`)} > LSRAM
      `Ethernet.EthernetSectionNamePrefix + "." + Ethernet.RxBufferSectionName`     : {*(`Ethernet.EthernetSectionNamePrefix + "." + Ethernet.RxBufferSectionName`)}     > LSRAM
      __ethernet_region_end__ = .
}

I must be missing something?

  • You should verify first that your package is being loaded. If it's not already there, add a function init() to your package.xs and add a print statement there.
    Also, which target are you using?
    Have you specified your own Program.linkTemplate in the CFG script? If you did, then that new template has to invoke getSects() for all loaded packages. Look at ti/targets/linkcmd.xdt for an example. That file invokes a helper function genContributions() from ti/targets/linkUtils.xs.
  • My Package is getting loaded, I see a print from my package.xs close() function.

    The target I'm using is gnu.targets.arm.M3. But it looks like I've been running off of a slightly modified stellaris link template. The genContributions call from linkUtils.xs appears to have been removed.

    Once I added it back getSects is functioning properly.

    Thanks for pointing me in the right direction!