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

Code and Date Memory Allocation Question

Please explain what the statement:
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?_FSUB?TEST

means in terms of not linking in a function that is not called. The memory map reports that code and data memory are being used in the build or that is the way I am interpreting it.

Below is a simple, do nothing, application indicating what I am referring to:

unsigned char fsub(unsigned long a,unsigned long b)
{ return b-a;
}

unsigned long fadd(unsigned long a,unsigned long b)
{ return a+b;
}

void main(void)
{ fadd (5,10);
}

I see the compiler/linker reporting
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?_FSUB?TEST

Program Size: data=25.0 xdata=0 code=76
LINK/LOCATE RUN COMPLETE. 1 WARNING(S), 0 ERROR(S)

I get a different report if I comment out the unused function.
//unsigned char fsub(unsigned long a,unsigned long b)
//{
// return b-a;
//}

unsigned long fadd(unsigned long a,unsigned long b)
{ return a+b;
}

void main(void)
{ fadd (5,10);
}

Rebuild target 'Target 1'
compiling test.c...
linking...
Program Size: data=17.0 xdata=0 code=62
creating hex file from ".\Objects\junk"...
".\Objects\junk" - 0 Error(s), 0 Warning(s).
Build Time Elapsed: 00:00:01

I am sure this is basic 'stuff' but I am a bit confused
Thanks for your help
Jim

Parents
  • OK...
    I understand now that if you use the LX51 linker and use the REMOVEUNUSED option I get the results I was expecting. I was misinterpreting the *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT message. It makes sense now.

    This brings up my next question, I thought the Cx51/Lx51 tools were only intended for a specific microcontroller family. Is this correct or can they be used for the generic 51 family?

Reply
  • OK...
    I understand now that if you use the LX51 linker and use the REMOVEUNUSED option I get the results I was expecting. I was misinterpreting the *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT message. It makes sense now.

    This brings up my next question, I thought the Cx51/Lx51 tools were only intended for a specific microcontroller family. Is this correct or can they be used for the generic 51 family?

Children