Other HI-TECH Compilers & Products >> Other HI-TECH Compilers & Products

Pages: 1
hua_wind
stranger


Reged: Oct 25 2007
Posts: 12
Loc: jiang su ,China
why? about hi-tech c for HT
      #30434 - Mon Nov 05 2007 08:14 PM

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)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Dan HenryModerator
Guru
****

Reged: Oct 16 2003
Posts: 3210
Loc: Boulder, Colorado U.S.A.
Re: why? about hi-tech c for HT [Re: hua_wind]
      #30435 - Mon Nov 05 2007 08:26 PM

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?

Post Extras: Print Post   Remind Me!   Notify Moderator  
Mark Pappin

***

Reged: Nov 01 2004
Posts: 599
Loc: Brisbane, Australia
Re: why? about hi-tech c for HT [Re: hua_wind]
      #30437 - Mon Nov 05 2007 09:32 PM

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


Post Extras: Print Post   Remind Me!   Notify Moderator  
hua_wind
stranger


Reged: Oct 25 2007
Posts: 12
Loc: jiang su ,China
Re: why? about hi-tech c for HT [Re: Mark Pappin]
      #30438 - Mon Nov 05 2007 09:40 PM

please explain me the rule of parameters' transmition (from asm to c)
ex:
xyz(unsigned char x,unsigned char y,unsigned char z)


Post Extras: Print Post   Remind Me!   Notify Moderator  
hua_wind
stranger


Reged: Oct 25 2007
Posts: 12
Loc: jiang su ,China
Re: why? about hi-tech c for HT [Re: hua_wind]
      #30439 - Mon Nov 05 2007 10:01 PM

in other words,what's the difference between holtek c compile and HI-tech c compile about parameters'transmiting(from asm to c)

Post Extras: Print Post   Remind Me!   Notify Moderator  
C.J. Prins



Reged: Jun 08 2005
Posts: 3
Loc: Nijkerk, The Netherlands
Re: why? about hi-tech c for HT [Re: hua_wind]
      #30444 - Tue Nov 06 2007 03:04 AM

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.


Post Extras: Print Post   Remind Me!   Notify Moderator  
hua_wind
stranger


Reged: Oct 25 2007
Posts: 12
Loc: jiang su ,China
Re: why? about hi-tech c for HT [Re: Mark Pappin]
      #30463 - Tue Nov 06 2007 08:45 PM

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.........


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 2 anonymous users are browsing this forum.

Moderator:  ndouglas, jtemples, Dan Henry, garth, Andrew L, Ryan, mikerj 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 2586

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5