Dear All:
i'm now using the 9s08dz32. i want to generate an illigal operation to force the mcu to reset. when in asm, the code looks like this:
ILOP MACRO ;
DC.B $8d ; this is illegal operation code
ENDM ;
but i don't know how to implement this code into C.
could anyone help me?
Hello,
I am not sure whether this can be done with inline assembly?
However, a method that should work would be to create an ASM file to contain the illegal operation code within a sub-routine. The sub-routine would then be called from within the C file (as a function with the same name). A prototype will be needed within the C file, and an XDEF reference within the ASM file.
Perhaps others will be able to provide a simpler method.
Regards,
Mac
Hello,
Fabio Pereira has an example for an ILAD reset on his page.
Look at the Code for chapter 5.
It should be easy to adapt it to ILOP.
The reset function is implemented als follows :
void reset(void)
{
unsigned int temp = 0x9E00;
__asm
{
LDHX @temp // load the address of temp into H:X
JMP ,X // jump to the address pointer to by H:X
}
}
Eckhard
As it was discussed in the past, there is no need for the jmp.
https://community.freescale.com/message/10910#10910
The HLI supports to embed arbitrary bytes into the instruction stream.
Daniel