simulavr-devel
[Top][All Lists]
Advanced

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

Re: [Simulavr-devel] simple assembler program behaves incorrectly


From: Petr Hluzín
Subject: Re: [Simulavr-devel] simple assembler program behaves incorrectly
Date: Sat, 6 Aug 2011 13:13:31 +0200

(This is a reply to
http://lists.nongnu.org/archive/html/simulavr-devel/2011-07/msg00006.html.
Savannah's no-name mailinglist browser does not handle references
across month boundary.)

> On my System
>
>        avr-objdump --all-headers --disassemble --source --debugging
>           --syms       > experiment.elf
>
> yields:
>
>
> 00000000 <__vectors>:
>   0:   12 c0           rjmp    .+36            ; 0x26 <__ctors_end>
>   2:   17 c0           rjmp    .+46            ; 0x32 <__bad_interrupt>
>   4:   16 c0           rjmp    .+44            ; 0x32 <__bad_interrupt>
> .
> .
> .
>
> 00000026 <__ctors_end>:
>  26:   11 24           eor     r1, r1
>  28:   1f be           out     0x3f, r1        ; 63
>  2a:   cf ed           ldi     r28, 0xDF       ; 223
>  2c:   cd bf           out     0x3d, r28       ; 61
>  2e:   05 d0           rcall   .+10            ; 0x3a <main>
>  30:   08 c0           rjmp    .+16            ; 0x42 <_exit>
>
>
> It looks at least similar, to your output. Moreover the
> '<__do_copy_data>' section is missing.
>

This bugfix is useful for understanding why you have no __do_copy_data routine:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18145

The copying code seems to reside in
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/avr/libgcc.S and
appears to be used only if `avr_need_copy_data_p==true' in
http://gcc.gnu.org/viewcvs/trunk/gcc/config/avr/avr.c. (The libgcc.S
is not rebuild for each project.)

I do not know the structure of compiler/assembler. I guess the code
gcc/config/avr/avr.c resides in compiler and maybe the compiler is not
involved in your asm-only project, therefore the copying code is not
added.

You might workaround this by copying and implementing your own __do_copy_data:
http://www.mail-archive.com/address@hidden/msg02390.html

> So, according to you, the problem is, that the linker doesn't copy any
> instructions in the binary-file, that initialize the data in the SRAM!?
> Is this correct?

Correct.

> Maybe you have a tip, where to pose this question, to get an answer!?

I think people on avr-gcc-list will know better.

-- 
Petr Hluzin



reply via email to

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