[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Re: re-initialising an ATMega128 as much as possible (wit
[avr-gcc-list] Re: re-initialising an ATMega128 as much as possible (without real reset)
Sun, 14 Aug 2005 12:38:51 +0200
On Sun, 14 Aug 2005 07:50:10 +0200, Torsten Mohr wrote:
> i program an ATMega128, there's a bootloader at 0x1e000
> and a normal application at 0x00000.
> When the application starts the bootloader, it does that
> by directly jumping into it.
> In the bootloader i'd like to un-initialise as much of
> the micro as possible, i think it is not possible to
> initialise everything the same way as after a real reset.
I would do it by a different way (or better, I did it another way).
The best way to ensure that the device behaves like after a reset is
to use the watchdog timeout, do a simple test at the beginning of
your bootloader to decide if the application should be startet or
not, and if, do a simple jump to the application. With that you
ensure that all your registers are set to the default state.
Of course you need a test criteria for the decision. I use a
dedicated pin to distinguish if the bootloader should be used or
not. If your decision is based on a different event, you need to use