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

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

Re: [avr-libc-dev] Possible hole in the assembler interrupt documentatio


From: Paulo Marques
Subject: Re: [avr-libc-dev] Possible hole in the assembler interrupt documentation
Date: Fri, 02 Nov 2012 14:45:33 +0000
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Hi, Eric

Weddington, Eric wrote:
> You're right. That's exactly what we need.

FWIW, I think that is what the "used" attribute does.

Specially with -combine -fwhole-program, gcc tends to throw away
interrupt definitions if I don't precede them with
__attribute__((used)), because apparently no one is calling them.

This is not specific to AVR as I've seen it happen with ARM too, at least.

>> -----Original Message-----
>> From: Dale [mailto:address@hidden
>> Sent: Thursday, November 01, 2012 9:05 AM
>> To: Weddington, Eric
>> Cc: address@hidden; address@hidden
>> Subject: Re: [avr-libc-dev] Possible hole in the assembler interrupt
>> documentation
>>
>> Hi,
>>
>> Its not just an assembler issue, I've been bitten by this with 'C' code
>> as well. If the ISR is the only code compiled into an object module, ie.
>> with no references to code or variables in other object modules, it
>> won't be linked into the app.
>>
>> It would be useful if there was an attribute on all ISR declarations
>> which indicate to the linker that they are to be kept regardless of
>> whether they are referenced by other code.
>>
>>> Hi Brendan,
>>>
>>> Thanks for pointing this out. Admittedly, there are not a lot of people
>> who write their ISR in assembly. Most are able to write their ISRs in C.
>>> Would you be willing to fill out a bug report on the avr-libc project?
>> Emails have a tendency to be forgotten about over time and we want to make
>> sure that we capture this issue in our system so we can get the
>> documentation fixed.
>>> Thanks,
>>> Eric Weddington
>>>
>>>> -----Original Message-----
>>>> From: address@hidden
>>>> [mailto:address@hidden On
>>>> Behalf Of Brendan Hanna
>>>> Sent: Thursday, November 01, 2012 6:09 AM
>>>> To: address@hidden
>>>> Subject: [avr-libc-dev] Possible hole in the assembler interrupt
>>>> documentation
>>>>
>>>> Hello,
>>>>
>>>> I have just spent some time trying to get my freshly minted interrupt
>>>> vector to linked into my executable and appear in the vector table at
>> the
>>>> start of flash. I feel that there is a small, but non-obvious hole in
>> the
>>>> interrupt documentation that could be patched up.
>>>>
>>>> I had written my ISR in assembler but for the life of me could not
>> figure
>>>> why it had not been linked into the main application. I thought the
>> 1.6.4
>>>> libc documentation was implying that all I needed to do was name the
>> vector
>>>> with one of the standard vector names (PCINT0_vect in my case), and
>> like
>>>> magic all the pieces would come together.
>>>>
>>>> It took me some time to realise that the vector would not be considered
>> for
>>>> linking unless its object file contained a dependency required by the
>> main
>>>> object file. In real life this would probably be achieved with some ISR
>>>> initialisation code defined in the assembly source file and called at
>> start
>>>> up. My organically growing code did not have this yet - so I had to
>> falsify
>>>> it with a global variable accessed by the main application but defined
>> in
>>>> assembly.
>>>>
>>>> I thought raising this issue here could help improve the documentation
>> a
>>>> little.

P.S.: please don't top-post... :(

-- 
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"This version has many new and good features. Sadly, the good ones are
not new and the new ones are not good."



reply via email to

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