avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] redefining __init / start


From: Torsten Mohr
Subject: Re: [avr-gcc-list] redefining __init / start
Date: Fri, 29 Jul 2005 22:44:39 +0200
User-agent: KMail/1.8

Hi,

i worked a quite clean way around the problem by putting the
necessary functions in section .init1.  After a look into
gcrt1.S i think that no real code is executed before .init1.

I'm still interested in a solution to use --wrap, i don't
understand why it did not work.


Best regards,
Torsten.


Here's what i do at the moment:

.global fbl_real_reset
.global fbl_starter
.global reset_vector


        .section .init1,"ax",@progbits

reset_vector:
        ldi     r16, 1
        sts     fbl_real_reset, r16
        jmp     e_init1

fbl_starter:
        cli
        eor     r0, r0
        sts     fbl_real_reset, r0

e_init1:



> Hi,
>
> i got all your hints for the bootloader start/initialisation
> and now try to redirect the reset vector to an own function
> to set a certain byte to mark that the startup cause was a
> real reset.
>
> I still use avr-libc and no own linker script.
>
> Whatever i try to redirect the reset vector to another function
> fails, when i look into the final list file (generated with
> avr-objdump -h -S) fails, at location 0x1e000 there's still
> an "rjmp __init".
>
> I tried:
>
> # Always:
> avr-gcc \
> -Wl,--section-start=.text=0x1e000 \
> -Wl,-Tdata=0x800900,--defsym=__heap_end=0x8010ff \
> -Wl,--defsym,__stack=0x08fe \
>
> # and additionally:
> -Wl,--defsym,__vector_0=reset_vector \
>
> -Wl,--defsym,__init=reset_vector \
>
> -Wl,--wrap,__init \
> # i also rewrote my startup code to use __wrap___init
> and __real___init
>
> -Wl,--entry,start \
>
> I did not find any reference in /opt/avr/avr/lib/ldscripts
> to "entry", "start" or "init".  In avr-libcs gcrt1.S in function
> __vectors in section .vectors it starts with an XJMP __init and
> __init is set to be .weak __init.  So i understand that the
> standard symbol "start" is not used, but why overwriting __init
> did not work i don't know.  Also --wrap should have worked,
> especially as avr-nm shows this:
>
> address@hidden:~/p/avr/fbl> avr-nm obj/fbl_start.o | grep init
>          U __init
>          U __real___init
> 00000000 T __wrap___init
>
> address@hidden:/opt/avr/avr/lib> avr-nm crtm128.o | grep init
> 00000000 W __init
>
>
> Is there a way to redirect __init without own linker script?
>
>
> Best regards,
> Torsten.
>
>
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list




reply via email to

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