I'm new to the Keil compiler and am having problems with assembly subroutines. The program compiles and links just fine but when I download the debug file to my Metalink emulator the assembly subroutines show up has NOP's. Here's the C section:
if (have_ram) /* if ram available save cause of reset*/ { Chk_reg(); /* check if buffer variables are ok*/ if (WTRF) /* watchdog timeout*/ { wdrst++; /* increment number of times watchdog has occured*/ WTRF=0; /* clear flag*/ } trst++; /* increment total number of resets counter*/ Lrc_reg(); /* calculate new storage reg LRC*/ }
$TITLE(LRC_REG) PUBLIC LRC_REG DPL1 EQU 84H DPH1 EQU 85H LRC_REG SEGMENT CODE RSEG LRC_REG MOV DPTR,#7FE0H ; start location of buffer MOV B,#00H ; clear LRC1: MOVX A,@DPTR ; load data XRL A,B ; exclusive OR MOV B,A ; store INC DPTR ; next location MOV A,DPL1 ; check for end of buffer CJNE A,#0F7H,LRC1 ; loop if not end MOV A,B ; get computed checksum CPL A ; compliment for cleared RAM MOVX @DPTR,A ; store new checksum RET END
48B4 LRC_REG: NOP NOP NOP ...
What is the "C" source of Lrc_reg? Erik
Use the "Generate Assembly SRC file" option on a fuction header to get you prototype for you assembly functions. This:
void Lrc_reg( void ){}
; .\Main.SRC generated from: Main.c NAME MAIN ?PR?Lrc_reg?MAIN SEGMENT CODE PUBLIC Lrc_reg ; void Lrc_reg( void ){} RSEG ?PR?Lrc_reg?MAIN Lrc_reg: ; SOURCE LINE # 1 ?C0001: RET ; END OF Lrc_reg END
Thanks Jon. Great tip.