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

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

AW: [avr-gcc-list] jump_to_null question


From: Haase Bjoern (PT/EMM1)
Subject: AW: [avr-gcc-list] jump_to_null question
Date: Thu, 24 May 2007 15:38:54 +0200

Just one question: Did you extract the line

>       RCALL   PC-0x0009

>From disassembling the completeley linked executable or from disassembly of 
>the object file?
Possibly the linker might have replaced (PC-0x0009) by the true distance 
between the PC position of the PC at the RCALL.?



-----Ursprüngliche Nachricht-----
Von: address@hidden [mailto:address@hidden Im Auftrag von Eric Weddington
Gesendet: Donnerstag, 24. Mai 2007 15:17
An: 'Dr. Jan Menzel'; address@hidden
Betreff: RE: [avr-gcc-list] jump_to_null question

 

> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Dr. Jan Menzel
> Sent: Thursday, May 24, 2007 6:40 AM
> To: address@hidden
> Subject: [avr-gcc-list] jump_to_null question
> 
> Hi all!
>       I'm currently working on a bootloader for Mega8 and 88 
> and found a 
> problem I do not yet understand. At the end of the bootloader the code
> has to jump to the main reset vector at address 0x0000. If I do the
> usual way
>       void (*jump_to_null)(void) = 0x0000;
> gcc 3.4.6 complies:
>       LDI     R30, 0x0102
>       LDI     R31, 0x0103
>       ICALL
> and everything works fine, as expected.
>       But if I try to be more specific and define
>       void (* const jump_to_main)(void) = 0x0000;
> gcc 3.4.6 complies
>       RCALL   PC-0x0009
> which unfortunately does not what I intended.
>       Could anyone please point me to my error in reasoning 
> or lack of 
> understanding? Many thanks!
> 

1. Why do you need to declare it const, when the first way works fine?
2. The best way to reset the AVR, is not by jumping to the reset vector.
When you do that, some of the registers may be left in a state that is not
the default. The best way to reset is to enable the watchdog timer on the
shortest time-out, go into an infinite loop, and let the watchdog reset the
AVR. Depending on which AVR you are using, you will have to turn off the
watchdog timer after reset, with code in the .init3 section, for example.

Eric 



_______________________________________________
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]