Hello All,
to detect whether a target is run under BDM control, my code checks whether SRS is zero.
This way I enable some workarounds in the code during BDM debug sessions (i.e. a loop instead of WAIT because my debugger dislikes WAIT).
Is this a safe method? IOW is it guaranteed that SRS is not zero if I don't run the target under BDM control?
Some of the workarounds should not be run in production mode because they make the product less stable.
Oliver
Hi Oliver,
Here are a few things that I have learned.
I know that the SRS register behavior is different between the HC08GP32 and the S08GB60, so it may matter which derivative you are using.
On the GB60, the SRS register is not consistent when I reset/restart the firmware from the BDM. Most of the time I get zero in the SRS, but sometimes I get the "Reset-Pin" reset bit set in the SRS instead.
Though I don't have a lot of field hours on the GB60 yet, I have yet to see the SRS come up zero when the BDM was not attached.
Don't know which part you are talking about, but it is specified that S08D FTRIM is loaded from flash on reset into normal mode. Resetting into BDM mode, FTRIM is loaded with 0x80. This can be used to determine mode, but only if NVTRIM is not 0x80.
Hello kef,
did you test this?
The MC9S08DZ60 data sheet states "The MCU will not automatically copy the values in these FLASH locations to the respective registers. Therefore, user code must copy these values from FLASH to the registers". The SH and SG also doesn't copy the values from Flash to the clock registers.
Oliver
You are right. I found this notice in DZ128 datasheet, and though it applies to whole family. D60 datasheet doesn't have this notice: