hua_wind
stranger
Reged: Oct 25 2007
Posts: 12
Loc: jiang su ,China
|
|
Please use Code tags to maintain formatting and improve code readability. I have added them here. (admin) Code:
void delay(unsigned char x);
void main() { while(1) { #asm MOV a,50 CALL _delay #endasm } } void delay(unsigned char x) { while(x--); }
编译中... HI-TECH C COMPILER (Holtek MCU) V9.10PL6 Copyright (C) 1984-2006 HI-TECH SOFTWARE licensed for evaluation purposes only this licence will expire on Tue, 04 Dec 2007 : 0: (800) undefined symbol "_delay" Compilation failed - error code 1
why?
Edited by Mark Pappin (Mon Nov 05 2007 09:08 PM)
|
Dan Henry
Guru
  
Reged: Oct 16 2003
Posts: 3210
Loc: Boulder, Colorado U.S.A.
|
|
I don't use the Holtek toolchain, but HI-TECH's documentation for other processors has been pretty good about detailing the naming conventions required to interface C to ASM. Does your query originate because of a discrepancy between the toolchain documentation and the toolchain behavior?
|
Mark Pappin
 
Reged: Nov 01 2004
Posts: 599
Loc: Brisbane, Australia
|
|
Quote:
: 0: (800) undefined symbol "_delay" why?
Our PRO compilers with OCG (of which the HOLTEK compiler is one) do very aggressive dead-code elimination and if a C function or variable is not accessed from within C code it will probably not exist in the output. Unless you've got a very good reason to do so, you should not try to do stuff with inline assembly code that can much more easily be done in C.
By The Way, you should also avoid using #asm / #endasm close to C flow-control constructs like for, while, if, etc., as recommended in the manual.
-------------------- Mark Pappin - HI-TECH Software
|
hua_wind
stranger
Reged: Oct 25 2007
Posts: 12
Loc: jiang su ,China
|
|
please explain me the rule of parameters' transmition (from asm to c) ex: xyz(unsigned char x,unsigned char y,unsigned char z)
|
hua_wind
stranger
Reged: Oct 25 2007
Posts: 12
Loc: jiang su ,China
|
|
in other words,what's the difference between holtek c compile and HI-tech c compile about parameters'transmiting(from asm to c)
|
C.J. Prins
Reged: Jun 08 2005
Posts: 3
Loc: Nijkerk, The Netherlands
|
|
I'm using the H8/300H compiler. For that compiler it's better to use the C-function asm() to have assembly lines included. In that way, many problems can be prevented. For example:
asm("BCLR #7,@_SCI0_SSR"); // TDRE = 0
With kind regards from a rainy Holland.
Cojan Prins.
|
hua_wind
stranger
Reged: Oct 25 2007
Posts: 12
Loc: jiang su ,China
|
|
Unless you've got a very good reason to do so, you should not try to do stuff with inline assembly code that can much more easily be done in C.
using by interrupt program.........
|