加密系統調試_HCS12學習筆記(8)
其實很簡單,只是對#FF0F進行操作一下就可以了,具體位操作詳見S12FTS256KV2.PDF,寄存器FESC。
在MAIN.C的最后加上
const volatile unsigned char SecureReg @(0xFF0F)=0xFC;
即可,注意VOLATILE字樣,如果沒有的話,可能被DUBUG掉。
我對所有的程序進行了調試,一切正常,只有在涉及到FLASH擦寫時,程序無法正常運行,或者把程序段放入FLASH分頁時無法正常運行。查了N多資料,未果。
于是找了FREESCALE的技術支持,交流過后發現,是我芯片型號的問題,因為我的芯片的MASK是1K79X,比較老的型號,所以確實在這個方面是有問題的,如果換成了DT256或者高版本的MASK,即可解決問題。
這里是1K79X參錯里的內容,描述了這個問題。
MUCts00603: FLASH
Program & erase blocked in normal single chip mode when secure
Description
In normal single chip mode, when security is enabled, it is not possible to launch the Program ($20), Sector-Erase ($40) and Erase-Verify ($05) commands in the Flash. The Mass-Erase ($41) command can be launched.
Workaround
To enable the Program ($20), Sector-Erase ($40) and Erase-Verify ($05) commands in the flash, security must be disabled via the backdoor key sequence. See Flash User Guide for details of the backdoor key operation.
至此問題解決。
評論