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

Started by learn 5 years ago3 replieslatest reply 5 years ago185 views
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.
[ - ]
Reply by jms_nhJune 20, 2017

The usual technique in C involves a function pointer, something like

typedef void (*FUNC_PTR)(void);




But that is not an illegal address  (depends upon the processor memory map). An illegal address is something different, like jumping to an unaligned value 0x1 or a value outside implemented memory.

[ - ]
Reply by learnJune 21, 2017

That was very helpful!

[ - ]
Reply by kevboJune 22, 2017

I don't know about this specific processor nor your IDE, but if you can in-line some assembly code, then perhaps you can push the illegal address onto the return stack and then execute a return.  This is more-or-less the standard way to implement a jump table in assembly for many processors, as few allow access to the PC.

Not all processors have the means to do this, and not all IDE's will let you in-line assembly code.