simulavr-devel
[Top][All Lists]
Advanced

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

Re: [Simulavr-devel] Whats to do on execution of "illegal instruction"


From: Joerg Wunsch
Subject: Re: [Simulavr-devel] Whats to do on execution of "illegal instruction"
Date: Fri, 5 Feb 2016 23:11:52 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

As Klaus Rudolph wrote:

> > A real controller doesn't "terminate" if it runs into ffff

> A real controller does "something" on all illegal instructions. And
> I could not find out what really happens on a real device. So in any
> case, running on any illegal instruction must be handled in some
> "special" way.

The instruction FFFF is probably the one of the undocumented ones that
has been field-tested the most so far. ;-)

If you have a bootloader, but don't have the BOOTRST fuse set, and run
an otherwise empty AVR after reset, it will have to execute FFFF
instructions until it eventually encounters the bootloader code.

This scenario is known to work well enough in practice, so simulavr
should at least offer an option to not immediately terminate
simulation, and to not require user interaction for every FFFF
instruction (that would be tedious).

According to this posting:

http://www.avrfreaks.net/comment/83257#comment-83257

FFFF is actually not a NOP but SBRS r31, 7.  The difference is
negligible, it's only a matter whether each instruction is going to be
executed, or each second one.  Since bootloaders commonly start on an
even-word address (i.e. a byte address that is divisible by 4), it
will always end up in executing the bootloader code that way when
started by a reset.
-- 
cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)



reply via email to

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