[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Is "noreturn" attribute still not supported?
From: |
Ned Konz |
Subject: |
Re: [avr-gcc-list] Is "noreturn" attribute still not supported? |
Date: |
Mon, 24 Jan 2005 21:01:11 -0800 |
User-agent: |
KMail/1.7.2 |
On Sunday 23 January 2005 10:54 pm, Lin Gu wrote:
> I actually dynamically generate the code in g() or the
> code labeled after G at run time. So I cannot write
> it statically that way.
>
> The bottom line is that g() needs to know an
> address to JMP to. I assume I cannot use
> a label like F outside a
> function where it is defined. Hence I need a
> function. This is why I need to have a function
> that is compiled with 'noreturn' attribute.
>
> Without "noreturn", I have to write the function
> completely in assembly code.
Why would that be?
You don't need anything more than an address. Presumably, you have an address,
since you've written to the flash.
So all you have to do is to replace the return address on the top of the stack
with the address you want to jump to, and then do a return.
You could do the replacement with an assembly language macro that takes the
desired destination address.
This assumes, of course, that you have a software stack (in RAM), and not a
hardware stack like on some of the ATTiny devices.
--
Ned Konz
http://bike-nomad.com