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.
The usual technique in C involves a function pointer, something like
typedef void (*FUNC_PTR)(void);
FUNC_PTR pf = (FUNC_PTR)0x00FFFFFC;
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.
That was very helpful!
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.