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

error: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS ????

when i compile my file the following error message is generated:
-------------------------------------
Build target 'Target 1'
compiling robo.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?_REVERSE?ROBO

creating hex file from "robot"...
"robot" - 0 Error(s), 1 Warning(s).
--------------------------------------
what does this warning mean ?
will my program run smoothly if i write this hex file to my microcontroller ?

Following is the source of my program:
#include <REG52.H>
#include <stdio.h>
#include <intrins.h>
unsigned char speedleft,speedright,speed=20;
unsigned char high,low,flag,time=500;

void delay (unsigned char c)
{
do {
_nop_(); _nop_();
}
while (--c);
}

Forward(char speed)
{
P1=0x64;
speedright = speed+10;
speedleft = speed;
delay(time);
}

TurnRight()
{
P1=0x68;
speedright = low+5;
speedleft = low;
delay(time);
}

TurnLeft()
{
P1=0x54;
speedright = low+5;
speedleft = low;
delay(time);
}

Reverse(char speed)
{
P1=0x58;
speedright = speed;
speedleft = speed+5;
delay(time);
}

Run()
{
char sensors;
sensors = (P3 &=0x0f);

if((sensors & 0x01)==0)
{
TurnRight();
flag = 1;
}
else if((sensors & 0x08)==0)
{
TurnLeft();
flag = 2;
} else if(sensors == 0x09)
{
Forward(high);
flag = 0;
} else if(((sensors==0x0b)||(sensors==0x0d))&&(flag==0))
Forward(low);
}

main()
{
P1=0x40;
P3=0xff;
high = 80;
low = 30;
flag = 0;

while(1)
{
P3|= 0x0f;
Run();
}
}

  • it simply means that the routine reverse is never called. your program will run smoothly. Although I believe it still places the code in rom.

  • Also note that that message is not actually an error, it's a warning.

    This is not Microsoft software. Among other things, that means error messages actually tell you meaningful things. So do yourself a favour: read them.

  • Because the 8051 doesn't have much stack, C51 can't use it for parameter passing & local variables like "normal" 'C' compilers do.

    Instead, Keil use a technique called "Overlaying" to achieve a similar effect - but at Link-time, instead of at Run-Time.

    The Linker analyses the Function calling structure of your code, and re-uses (or "Overlays") the temporary storage used by functions which can never be "active" simultaneously.

    If the Linker cannot find a call to a function, it must assume that it may be active at any time - and therefore cannot overlay its temporary memory. This may mean that your project uses more memory than really necessary, so the Linker gives you this warning.

    As already stated by others, it's only a Warning - not an error. Therefore, if you're happy that the functions really aren't being called, and you're not short of memory, there's probably no need to worry.

    For further details on "Overlaying," see the Manuals, and search the Knowledgebase.