Keil Logo

BL51: Warning L16 (Uncalled Segment, Ignored for Overlay)


Information in this article applies to:

  • C51 All Versions

QUESTION

My simple project has two modules, a C and an Assembly module. I am trying to call one of the C functions from within the assembly module, but each time I build the project I get:

 WARNING 16 : UNCALLED SEGMENT - IGNORED FOR OVERLAY PROCESS.

I have already checked the knowledgebase and have seen several articles relating to this warning, but they don't help. How do I fix this problem?

ANSWER

The following is a solution should accomplish what you are trying to do:


Test.c

void foo(void);    // C function declaration

extern void FOO_CALLER(void);  // referencing a function
                                                     // defined elsewhere - C style

void main(void)
{
   FOO_CALLER();

   while(1);
}

void foo(void)    // C function definition
{
}


Asm_Test.asm

NAME ASMTEST       ; module name

EXTRN CODE (foo)    ; referencing a function defined
                                   ; elsewhere - assembly style

?PR?TSEG?ASM_TEST SEGMENT CODE
PUBLIC  FOO_CALLER     ; assembly routine declaration

RSEG ?PR?TSEG?ASM_TEST
using   0

FOO_CALLER:        ; assembly routine definition
        call foo

   RET
   END

CAUSE

The reason you may be receiving this warning is that although you have an assembly module that calls a C function, the assembly module itself is not being called by anything.

RESOLUTION

As illustrated above, you have to define a routine in your assembly module that calls the C function. The assembly routine then must be called from main or some other function that is called from main in C. Note that programs must have a "main" routine and in this example, the "main" routine is in the C module.

See the Attached Files section below to download an example project.

The actual code for the assembly module was generated using the SRC pragma.

MORE INFORMATION

SEE ALSO


ATTACHED FILES

Request the files attached to this knowledgebase article.

Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.