加密系統(tǒng)調(diào)試_HCS12學(xué)習(xí)筆記(8)
其實(shí)很簡(jiǎn)單,只是對(duì)#FF0F進(jìn)行操作一下就可以了,具體位操作詳見(jiàn)S12FTS256KV2.PDF,寄存器FESC。
在MAIN.C的最后加上
const volatile unsigned char SecureReg @(0xFF0F)=0xFC;
即可,注意VOLATILE字樣,如果沒(méi)有的話,可能被DUBUG掉。
我對(duì)所有的程序進(jìn)行了調(diào)試,一切正常,只有在涉及到FLASH擦寫(xiě)時(shí),程序無(wú)法正常運(yùn)行,或者把程序段放入FLASH分頁(yè)時(shí)無(wú)法正常運(yùn)行。查了N多資料,未果。
于是找了FREESCALE的技術(shù)支持,交流過(guò)后發(fā)現(xiàn),是我芯片型號(hào)的問(wèn)題,因?yàn)槲业男酒腗ASK是1K79X,比較老的型號(hào),所以確實(shí)在這個(gè)方面是有問(wèn)題的,如果換成了DT256或者高版本的MASK,即可解決問(wèn)題。
這里是1K79X參錯(cuò)里的內(nèi)容,描述了這個(gè)問(wèn)題。
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.
至此問(wèn)題解決。
評(píng)論