[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] [RFC] sections stub patch
From: |
Theodore A. Roth |
Subject: |
Re: [avr-libc-dev] [RFC] sections stub patch |
Date: |
Wed, 28 Aug 2002 09:41:24 -0700 (PDT) |
On Wed, 28 Aug 2002, Joerg Wunsch wrote:
:) > + <tr>
:) > + <td><tt>.init4</tt></td>
:) > + <td>Copies data from flash to SRAM. [Is this BSS init?]</td>
:) > + </tr>
:)
:) It is both, initializing .data and initializing .bss. In Unix-like
:) targets, .data is normally initialized by the OS directly from the
:) executable file. Since this is impossible in an MCU environment,
:) avr-gcc instead takes care of appending the .data variables after
:) ..text in the flash ROM image. .init4 then defines the function
:) weakly() which takes care of copying the contents of .data from the
:) flash to SRAM.
That's what I thought was happening. You mind if I just move the above
into the dox?
:)
:) Initializing .bss just means to zero it out, but that's indeed also
:) done inside .init4.
:)
:) Btw., if you look into the ld script(s), you'll notice that there's
:) also .init6 and .fini6 used for C++ constructors/destructors, .fini9
:) is used to implement _exit() (normally obviously just empty), and
:) ..fini0 is used for the infinite loop. All of this seems to be
:) implicit knowledge of avr-gcc.
Missed those. Thanks. Is there also ".fini[0-9]"? Are they always executed
in order from 0 to 9? Ah, to answer my own question, looking at one of my
map files:
*(.fini9)
*(.fini8)
*(.fini7)
*(.fini6)
*(.fini5)
*(.fini4)
*(.fini3)
*(.fini2)
*(.fini1)
*(.fini0)
.fini0 0x00000db2 0x2
/home/roth/local/avr/lib/gcc-lib/avr/3.3/avr5/libgcc.a(_exit.o)
0x00000db4 _etext = .
so .initN is 0 -> 9 and .finiN is 9 -> 0.
How does the .ctors and .dtors section work with .init6/.fini6 then?
One more question: Is it possible to have multiple functions assigned into
the same .initN section? I see this in a map file:
*(.init4)
.init4 0x00000098 0x1a
/home/roth/local/avr/lib/gcc-lib/avr/3.3/../../../../avr/lib/avr5/crtm128.o
0x00000098 __do_copy_data
.init4 0x000000b2 0x10
/home/roth/local/avr/lib/gcc-lib/avr/3.3/avr5/libgcc.a(_clear_bss.o)
0x000000b2 __do_clear_bss
Which seems to imply you can.
:) Hmm, if you put that here, the FAQ could be updated to just xref this
:) part instead of using the examples directly there.
That was the plan, eventually. ;-)
I also want to move the faq in the inline asm doc into the main faq.
Ted Roth
- [avr-libc-dev] [RFC] sections stub patch, Theodore A. Roth, 2002/08/27
- Re: [avr-libc-dev] [RFC] sections stub patch, Joerg Wunsch, 2002/08/28
- Re: [avr-libc-dev] [RFC] sections stub patch,
Theodore A. Roth <=
- Re: [avr-libc-dev] [RFC] sections stub patch, Joerg Wunsch, 2002/08/28
- Re: [avr-libc-dev] [RFC] sections stub patch, Theodore A. Roth, 2002/08/28
- Re: [avr-libc-dev] [RFC] sections stub patch, Joerg Wunsch, 2002/08/28
- Re: [avr-libc-dev] [RFC] sections stub patch, Theodore A. Roth, 2002/08/28
- Re: [avr-libc-dev] [RFC] sections stub patch, Joerg Wunsch, 2002/08/28
- Re: [avr-libc-dev] [RFC] sections stub patch, Theodore A. Roth, 2002/08/28
- Re: [avr-libc-dev] [RFC] sections stub patch, Joerg Wunsch, 2002/08/29
- Re: [avr-libc-dev] [RFC] sections stub patch, Theodore A. Roth, 2002/08/29