[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?
From: |
Georg-Johann Lay |
Subject: |
Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup? |
Date: |
Wed, 04 Jul 2012 16:21:54 +0200 |
User-agent: |
Thunderbird 2.0.0.24 (X11/20100302) |
Bob Paddock wrote:
> When does the Stack Frame Pointer (Y) get setup?
- If a frame pointer is needed
- If its setup is not avoided, e.g. by attribute naked
> Should the following code work?
No. The code obviously relies on a frame but inhibits frame
generation by "naked".
> I find it trashing memory in bss:
>
> void id_filter_init8( void ) __attribute__ ((naked)) __attribute__
> ((section(".init8")));
> void id_filter_init8( void )
> {
> uint8_t ff_u8[128U];
>
> /* memset() should really be used here */
> for( uint16_t idx_u16 = 0U; idx_u16 < (uint16_t) sizeof( ff_u8 ); idx_u16++
> )
> {
> ff_u8[ idx_u16 ] = 0U;
> }
Consider writing this as a constructor, i.e.
__attribute__ ((constructor))
instead of
__attribute__ ((naked, section(".init8")))
Johann
- Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?, (continued)
Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?, Joerg Wunsch, 2012/07/04
Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?, Joerg Wunsch, 2012/07/04
Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?,
Georg-Johann Lay <=
Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?, Don Kinzer, 2012/07/03
Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?, Don Kinzer, 2012/07/03
Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?, Don Kinzer, 2012/07/04
Re: [avr-gcc-list] When does the Stack Frame Pointer (Y) get setup?, Don Kinzer, 2012/07/04