是否可以在 IAP 運(yùn)行時(shí)移除讀保護(hù)以讀取閃存? 我的 IAP 程序?qū)⒋a下載到一個(gè)閃存區(qū)域,然后將其復(fù)制到另一個(gè)區(qū)域。 不幸的是,當(dāng)啟用讀保護(hù)時(shí),程序內(nèi)部的讀取失敗。
你好,使能讀保護(hù)時(shí)程序內(nèi)部肯定讀flash數(shù)據(jù)是沒(méi)問(wèn)題的,讀保護(hù)是為了外部加密。可檢查下是不是程序哪里邏輯出問(wèn)題了。另外軟件解除讀保護(hù)是個(gè)偽命題,解除讀保護(hù)的話所有程序?qū)?huì)丟失,單片機(jī)將會(huì)死機(jī)。
另外軟件解除讀保護(hù)操作如下,有興趣可試下,(選擇字操作完成后復(fù)位生效)注意成功后代碼將全部清除
感謝您的解釋。 實(shí)際上,讀保護(hù)不會(huì)導(dǎo)致程序級(jí)別的閃存讀取出現(xiàn)問(wèn)題。 但如果它打開(kāi),那么我的 IAP 例程將不起作用。
我的 IAP 程序可以自行更新,因?yàn)檫@個(gè)程序的功能在 DATA 部分,
__attribute__?((section(".data")))
此外,還修改了鏈接器腳本,以便將保存到閃存 (save-restore.o) 時(shí)所需的庫(kù)函數(shù)放在 DATA 部分。
如果未啟用“讀保護(hù)”,我的程序?qū)⒄9ぷ?,如果我在啟用“讀保護(hù)”的情況下對(duì)芯片進(jìn)行編程,則相同的代碼、相同的二進(jìn)制文件將無(wú)法工作。 為什么?
感謝您的幫助。
Hello, can you help me, I need to disable the read protection on the CH32v003 chip so that I can do the recording again. but I'm not finding the command to do it via the command line.
Hello, if you want to disable read protection when downloading, you can check the box in the following picture. In addition, even if read protection is enabled, we have a way to remove read protection in the download configuration item, as shown in the following figure
That's no wonder your program didn't work. If your code is running in RAM, it wouldn't be able to erase or program the FLASH under Code Read-Protect except full chip erase. Code Read-Protect also prevents the first 4K zone of FLASH from being erased or rewritten. So to have your IAP code worked properly, you need to put it in the FLASH, not RAM.