How to set program counter to illegal address while code is running ?

Status
Not open for further replies.

jani12

Member
I'm trying to create illegal instruction reset.

I'm programming Infineon TC29x Aurix Tricore Microcontroller based embedded system in 'C' language.

I need to set program counter to illegal address, i.e. 0x00FF FFFC. Can this be done with assembly language instructions?
If yes, please instrument assembly language instruction that would set program counter to 0x00FF FFFC while code is running.
 
So far as I know, an "illegal" memory location will appear as something else, but won't simulate or run.

In this example of code for a 12F1840, I assign 0xFFFF as an illegal location for the CBLOCK directive. In theory, it rolls over:

The disassembly is shown on the left (MPLab 8.92). Notice that register "temp" is set as 0x1. That will, of course cause problems. The Watch window for an attempted simulation shows:



I could try to force something more, but first, why do you want to do that?

John
 
If you are using C, why would there be a illegal instruction?? I doubt your compiler is that bad!!

Its possible to run code on the wrong chip, but then it would possibly not run at all...
 
Even in C execution of random areas can happen, with a table of pointers to functions and an out of bounds index would do it. In fact, that is the answer to the ops question, a pointer to a function with a random address should produce the required result.

Mike.
 
Hi Mike... Problem here is... Even with a bad pointer, no exception will be generated.. One of C golden rules.. Initialise pointers as you get no warnings in runtime...
 
I'm assuming the chip he is using generates exceptions and he wants to test his exception handler. I'm not familiar with the chip.

Mike.
 
If you have access to the return stack, you could put the illegal address on the return stack and then execute a return instruction.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…