Re: GNUH8 mixed C and assembly
- From: paul$@pcserviceselectronics.co.uk (Paul Carpenter)
- Date: Sun, 13 Nov 2005 00:13:19 +0000 (GMT)
On 12 Nov, in article
<1131811847.205254.313210@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
cbarn24050@xxxxxxx wrote:
>Peter Harrison wrote:
>> I am working with HEW4 and GNUH8 5.03 targeted at the H8/3664 and
>> H8/3687 and I can write C programs with only moderate difficulty. I seem
>> to have no problem writing code in .src files and calling it from C.
>> What I seem unable to find out is how to write functions in assembler
>> and then either access the arguments that are passed in, or how to
>> return values to the calling function.
......
>> FWIW, the exact need just now is a soft time delay. These are short
>> delays of a few tens of microseconds I appreciate these are less than
>> ideal in many ways. I can write one in C - as appears in any number of
>> example projects. However, I am nervous about how the optimizer might
.....
>Soft delays are never fixed if they can be interupted, if you need a
>fixed delay use a timer. There are different ways of including assembly
>into your programs. Inline lines or blocks of assy instructions, C
>functions who's code is written in assembler or pure assy routines
>called directly. You need to look at the compiler docs for the syntax.
>You can usually get to a C value from assember by putting an underbar
>in front of the variable name but the H8 instructions mostly work only
>with registers so this method is very limited. The other way is to use
Considering the number of registers and sizes upto 32 bits not as limited
as quite a few processors.
>the frame pointer to acces the stack directly but this requires you to
>fully understand how your compiler works.
GCC/GNU uses R0 to R2 (for 16bit args) or ER0 to ER2 (32bit args) for the
first THREE parameters, the rest are passed on the stack.
> The H8 also has complex assy
>intructions best avoided if humanly possible.
Actually quite easy to use, some of the modes on some instructions
are limiting but a lot can be done in straight assembly. Most users
create their own startup code in assembly.
--
Paul Carpenter | paul@xxxxxxxxxxxxxxxxxxxxxxxxxxx
<http://www.pcserviceselectronics.co.uk/> PC Services
<http://www.gnuh8.org.uk/> GNU H8 & mailing list info
<http://www.badweb.org.uk/> For those web sites you hate
.
- References:
- GNUH8 mixed C and assembly
- From: Peter Harrison
- Re: GNUH8 mixed C and assembly
- From: cbarn24050
- GNUH8 mixed C and assembly
- Prev by Date: Re: GNUH8 mixed C and assembly
- Next by Date: Re: 8051 data compression
- Previous by thread: Re: GNUH8 mixed C and assembly
- Next by thread: Re: GNUH8 mixed C and assembly
- Index(es):
Relevant Pages
|