avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [RFC] catching misspeeled signal names


From: Theodore A. Roth
Subject: Re: [avr-libc-dev] [RFC] catching misspeeled signal names
Date: Wed, 21 Apr 2004 11:26:26 -0700 (PDT)

On Wed, 21 Apr 2004, Dmitry K. wrote:

> Hi.
>
> Next items are working with `avr-libc-misspeeled-sig-2.diff':
>   - SIGNAL(SIG_INTERRUPT0) in C and asm, OK
>   - SIGNAL(SIG_MISSED) produced error in C and asm, OK
>
> But after this patch:
>   1. It is necessary to rewrite asm
>   2. It is impossible to call ISR-function as common C function.
>
> I propose next scheme, that is removing last disadvantages:
>
>   SIGNAL(SIG_INTERRUPT0)
>   ==>  SIG_INTERRUPT0 ## _TMP()     // signal.h
>   ==>  __vector_1 ## _TMP()         // signal.h
>   ==>  __vector_1_TMP()             // signal.h
>   ==>  __vector_1                   // vec_tmp.h
>
> Now:
>   SIGNAL(): with spelling cheking (C and asm)
>   SIG_XXX:  for direct substitution (old asm and function names)
>
> Files:
>   signal.h  - changed
>   vec_tmp.h - added (builded from `vec_tmp.sh')
>
> Notes:
>   - it is possible to add asm macro (.globl, .type ...)
>   as in `avr-...-2.diff'
>   - it is necessary to add comments and strings, as "-> Missp..."
>
> Attached contains files above and examples.

Ok, we're looking better now, but there's still some problems with your
scheme.

Doing this in an asm file:

  SIGNAL(SIG_INTERRUPT2):
        reti

which generates this:

  __vector_3:
        reti

won't work. You must have the .global (or .globl) or the linker will not
be able to insert the jmp/rjmp to the handler into the vector table. The
only way I see to do that is with the .macro I had in my 2nd patch. If
there's a better way I'm all ears.

This still generates an unused handler in asm:

  .globl        SIG_FOO
  SIG_FOO:
        reti

since we don't get the misspell check. Not much we can do here though. I
say if the user wants to do that, fine. If they want the spelling check
in asm, then use the SIGNAL() #define in what ever final form it takes.

It would be nice to have the SIGNAL() macro insert the .global using
this form:

  SIGNAL(SIG_FOO):
     reti

but I couldn't figure out how to do that, thus I previously ended up
with this form:

  SIGNAL(SIG_FOO)
     reti

which I'm not exciting about since it looks even less like normal asm
code than with the semicolon at the end.

On a purely personal preference note, I'm not too excited about adding
the vec_tmp.h header. I'm also not excited about all the
__vector_N_TMP() defines, but I don't see a way around it.

One other thing I added to your patch was the string left in the temp
files to help give a clue as to why things failed. Gcc's warnings don't
really help lead you to the problem too well.

Attached is a slight reworking of Dmitry's patch.

I think we're getting close now. I like Dmitry's idea better than my
original since it does require changed the io*.h files. ;-)

---
Ted Roth
PGP Key ID: 0x18F846E9
Jabber ID: address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]