是否可以在 IAP 运行时移除读保护以读取闪存? 我的 IAP 程序将代码下载到一个闪存区域,然后将其复制到另一个区域。 不幸的是,当启用读保护时,程序内部的读取失败。
你好,使能读保护时程序内部肯定读flash数据是没问题的,读保护是为了外部加密。可检查下是不是程序哪里逻辑出问题了。另外软件解除读保护是个伪命题,解除读保护的话所有程序将会丢失,单片机将会死机。
另外软件解除读保护操作如下,有兴趣可试下,(选择字操作完成后复位生效)注意成功后代码将全部清除
感谢您的解释。 实际上,读保护不会导致程序级别的闪存读取出现问题。 但如果它打开,那么我的 IAP 例程将不起作用。
我的 IAP 程序可以自行更新,因为这个程序的功能在 DATA 部分,
__attribute__ ((section(".data")))
此外,还修改了链接器脚本,以便将保存到闪存 (save-restore.o) 时所需的库函数放在 DATA 部分。
如果未启用“读保护”,我的程序将正常工作,如果我在启用“读保护”的情况下对芯片进行编程,则相同的代码、相同的二进制文件将无法工作。 为什么?
感谢您的帮助。
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.