| ??? 12/11/02 14:20 Read: times |
#34237 - RE: How to use software traps? |
If you're worried about your code suddenly jumping to some funny address, then your "trap" would need to be a single-byte instruction, as you have no guarantee that this spurious jump might not "land" in the middle of a multi-byte instruction!
This "trap" scheme obviously won't help you if the spurious jump happens to end up somewhere where there is actually real code - the probability of that happening presumably depends on how full your ROM is? Note that the erased state of a byte in UV-PROM or Flash is 0xFF - which is the opcode for MOV R7, A. This is a single-byte instruction which does nothing particularly harmful. Therefore, if your code does happen to jump into an empty part of your ROM, it'll just keep running through it, copying A into R7, til it finds some code or wraps around into the reset vector (Code address 0x0000). So all you actually need to do is to make sure that there's no gaps between your functions! Check the Linker Map file. |



