cancel
Showing results for 
Search instead for 
Did you mean: 

Illegal Opcode Exception

faqbox
Associate II
Posted on April 19, 2005 at 14:09

Illegal Opcode Exception

4 REPLIES 4
faqbox
Associate II
Posted on April 08, 2005 at 06:45

Hi all,

I have a serious problem using a ST10F269 uC, sometimes the processor issues an 'illegal opcode' exception and I cannot find any reasons.

First time this arose while using Lauterbachs Fire32 emulator and 'rumors' told me about a well-known bond-out chip problem and a workaround was provided (reserving parts of IRAM).

Unfortunately this exception happens also with flashed devices.

Analyzing the trace after the Ill_opcode trap showed a mov command that seems to be ok and that's all..so not really useful.

My question now: Is any information about this problem somewhere out there? Hopefully not a ST10 bug?

Any help appreciated.

Rgds

Guido

charles239955_st
Associate II
Posted on April 15, 2005 at 07:12

Hello,

Are you sure it is an Undefined Opcode trap as several are sharing the same trap number?

What is the value of the TFR register?

If the MOV is causing the trap, maybe the problem is on the addresses. You could be getting a Illegal Word Operand Access or Illegal External Bus access trap.

Put a breakpoint with your emulator on the Trap B vector location (address 0x0028) and check the TFR register value.

If bit 0 is set, then it is a Illegal External Bus Access:

An external access has been attempted with no external bus defined.

If bit 2 is set, then it is a Illegal Word Operand Access:

A word operand access (read or write) to an odd address has been attempted.

faqbox
Associate II
Posted on April 18, 2005 at 11:39

Thanks Kenshin for your hints.

I now checked the TFR register and I get a 0x0001, so an 'ILLBUS' exception. But we don't have external memory configured, only internal RAM and Flash-ROM; configuration is set to Single-Chip-Mode (busact0 is 0), pin EA/ should be high on reset.

Any further hints, maybe a problem with the emulator?

Guido

charles239955_st
Associate II
Posted on April 19, 2005 at 14:09

The ILLBUS trap is showing that you have a wrong access to external memory.

As you said, you target to use only internal resources of the ST10. So the last MOV instruction is either reading or writing to a location not corresponding to the on-chip resources.

By default the ST10 core will try to redirect the access on the external bus and this is where you get the trap.

So in fact you need to check your code to see why the address is wrong. Maybe a bad pointer initialisation or an incorrect mapping of the application. The error may not be in the last MOV instruction that generateg the TRAP but before in the register initialisation (in case of indirect addressing mode as MOV [Rx], [Ry] ).