uvision 2 v2.40, c51 v7.09, bl51 v5.03 gives: *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?IS_OK_INC_DTARGET_SPD?SPDLIM spdlim.c has bit IS_OK_INC_DTARGET_SPD( void ) which returns a bit. (1) how do I fix this?
Created main.c, cf.c, af.a51 for project. The following paste does not show main's call to af(). This simple example still shows the linker warning.
// cf.c bit cf( void ); bit cf( void ) { bit retval; retval = 1; return ( retval ); }
;; af.a51 CS SEGMENT CODE RSEG CS extrn code ( cf ) public af af: call cf ret END
(In my opinion) The ONLY way to make assembler functions that can be seamlessly called from C is to make a skeleton function in C and use the generated assembler as a template. Make sure all variables are used in the skeleton. Erik
IMHO, the problem is calling a C function from assembly, not calling assembly from C.
IMHO, the problem is calling a C function from assembly, not calling assembly from C. To which the same strategy applies: do it (correctly, i.e. with a prototype declaration of the called function in scope) in a C program, and have C51 make you A51 soruce code demonstrates what exactly has to be done. That's the single most important rule about mixed assembly + C programming: the compiler knows how to do it, so don't ever hesitate to ask it.