使用dcsm进行配置如下:
1、
.sect "b0_dcsm_otp_z1_linkpointer" ;select block1, no change
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER1
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER2
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER3
.long 0xFFFFFFFF ;Reserved
默认选择block0
2、
.sect "b0_dcsm_zsel_z1"
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYRAM
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYSECT
.long 0xFFFFFFFF ;B0_Z1OTP_GRABRAM
.long 0xFFFFFEFF ;B0_Z1OTP_GRABSECT ;b0 sector4 0xFFFFFFFF->0xFFFFFEFF
.long 0x11112222 ;B0_Z1OTP_CSMPSWD0 (LSW of 128-bit password)
.long 0x33334444 ;B0_Z1OTP_CSMPSWD1
.long 0x55556666 ;B0_Z1OTP_CSMPSWD2
.long 0x77778888 ;B0_Z1OTP_CSMPSWD3 (MSW of 128-bit password)
选择bank0中sector4 flash扇区进行加密
3、
cmd文件:
b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0
b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0, type = DSECT
b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0, type = DSECT
b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0
4、其他地方不进行加密
使用CCS不能烧写:
C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code). Operation cancelled.
C28xx_CPU1: File Loader: Memory write failed: Unknown error
C28xx_CPU1: GEL: File: F:\XXX.out: Load failed.
天下无狗:
这个问题解决了,是因为第二个密码必须在0x47ffffff基础上的1将1写成0。但是又遇到一个问题在不进行加密时程序怎么跑都正常,连接仿真器和不连接仿真器都正常,但是加密后通过仿真器先解密后烧写程序能正常跑,之后拔了仿真器从新上电代码就不能跑,如果通过仿真器进行硬件复位后代码也不能跑,通过仿真器观察flash处于加密模式内容为全0,这倒是正常,主要是为什么了断电后重启代码就不能跑了
使用dcsm进行配置如下:
1、
.sect "b0_dcsm_otp_z1_linkpointer" ;select block1, no change
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER1
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER2
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER3
.long 0xFFFFFFFF ;Reserved
默认选择block0
2、
.sect "b0_dcsm_zsel_z1"
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYRAM
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYSECT
.long 0xFFFFFFFF ;B0_Z1OTP_GRABRAM
.long 0xFFFFFEFF ;B0_Z1OTP_GRABSECT ;b0 sector4 0xFFFFFFFF->0xFFFFFEFF
.long 0x11112222 ;B0_Z1OTP_CSMPSWD0 (LSW of 128-bit password)
.long 0x33334444 ;B0_Z1OTP_CSMPSWD1
.long 0x55556666 ;B0_Z1OTP_CSMPSWD2
.long 0x77778888 ;B0_Z1OTP_CSMPSWD3 (MSW of 128-bit password)
选择bank0中sector4 flash扇区进行加密
3、
cmd文件:
b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0
b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0, type = DSECT
b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0, type = DSECT
b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0
4、其他地方不进行加密
使用CCS不能烧写:
C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code). Operation cancelled.
C28xx_CPU1: File Loader: Memory write failed: Unknown error
C28xx_CPU1: GEL: File: F:\XXX.out: Load failed.
Green Deng:
回复 天下无狗:
感谢你的反馈。另,你的第二个问题,你确认程序被正确烧写进芯片了吗?因为如果烧写进去了,那不管是否加密都应该运行的。
使用dcsm进行配置如下:
1、
.sect "b0_dcsm_otp_z1_linkpointer" ;select block1, no change
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER1
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER2
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER3
.long 0xFFFFFFFF ;Reserved
默认选择block0
2、
.sect "b0_dcsm_zsel_z1"
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYRAM
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYSECT
.long 0xFFFFFFFF ;B0_Z1OTP_GRABRAM
.long 0xFFFFFEFF ;B0_Z1OTP_GRABSECT ;b0 sector4 0xFFFFFFFF->0xFFFFFEFF
.long 0x11112222 ;B0_Z1OTP_CSMPSWD0 (LSW of 128-bit password)
.long 0x33334444 ;B0_Z1OTP_CSMPSWD1
.long 0x55556666 ;B0_Z1OTP_CSMPSWD2
.long 0x77778888 ;B0_Z1OTP_CSMPSWD3 (MSW of 128-bit password)
选择bank0中sector4 flash扇区进行加密
3、
cmd文件:
b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0
b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0, type = DSECT
b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0, type = DSECT
b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0
4、其他地方不进行加密
使用CCS不能烧写:
C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code). Operation cancelled.
C28xx_CPU1: File Loader: Memory write failed: Unknown error
C28xx_CPU1: GEL: File: F:\XXX.out: Load failed.
天下无狗:
回复 Green Deng:
因为我的代码一直是放在flash中进行调试的,没有放在RAM中,现在是项目已经开发完成了,最后再加上这个dcsm加密功能就出现这种情况,如果说我的代码没有烧进flash,那为何用仿真器可以运行呢?谢谢
使用dcsm进行配置如下:
1、
.sect "b0_dcsm_otp_z1_linkpointer" ;select block1, no change
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER1
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER2
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER3
.long 0xFFFFFFFF ;Reserved
默认选择block0
2、
.sect "b0_dcsm_zsel_z1"
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYRAM
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYSECT
.long 0xFFFFFFFF ;B0_Z1OTP_GRABRAM
.long 0xFFFFFEFF ;B0_Z1OTP_GRABSECT ;b0 sector4 0xFFFFFFFF->0xFFFFFEFF
.long 0x11112222 ;B0_Z1OTP_CSMPSWD0 (LSW of 128-bit password)
.long 0x33334444 ;B0_Z1OTP_CSMPSWD1
.long 0x55556666 ;B0_Z1OTP_CSMPSWD2
.long 0x77778888 ;B0_Z1OTP_CSMPSWD3 (MSW of 128-bit password)
选择bank0中sector4 flash扇区进行加密
3、
cmd文件:
b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0
b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0, type = DSECT
b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0, type = DSECT
b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0
4、其他地方不进行加密
使用CCS不能烧写:
C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code). Operation cancelled.
C28xx_CPU1: File Loader: Memory write failed: Unknown error
C28xx_CPU1: GEL: File: F:\XXX.out: Load failed.
Green Deng:
回复 天下无狗:
仿真器仿真的时候,代码是运行在ram中的
使用dcsm进行配置如下:
1、
.sect "b0_dcsm_otp_z1_linkpointer" ;select block1, no change
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER1
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER2
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER3
.long 0xFFFFFFFF ;Reserved
默认选择block0
2、
.sect "b0_dcsm_zsel_z1"
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYRAM
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYSECT
.long 0xFFFFFFFF ;B0_Z1OTP_GRABRAM
.long 0xFFFFFEFF ;B0_Z1OTP_GRABSECT ;b0 sector4 0xFFFFFFFF->0xFFFFFEFF
.long 0x11112222 ;B0_Z1OTP_CSMPSWD0 (LSW of 128-bit password)
.long 0x33334444 ;B0_Z1OTP_CSMPSWD1
.long 0x55556666 ;B0_Z1OTP_CSMPSWD2
.long 0x77778888 ;B0_Z1OTP_CSMPSWD3 (MSW of 128-bit password)
选择bank0中sector4 flash扇区进行加密
3、
cmd文件:
b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0
b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0, type = DSECT
b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0, type = DSECT
b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0
4、其他地方不进行加密
使用CCS不能烧写:
C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code). Operation cancelled.
C28xx_CPU1: File Loader: Memory write failed: Unknown error
C28xx_CPU1: GEL: File: F:\XXX.out: Load failed.
天下无狗:
回复 Green Deng:
我说一下我的操作步骤: 1、首先我通过CCS将程序烧写进flash中(这里先不管它烧写进去与否),反正CCS提示烧写确实成功,并且是烧写flash 2、仍然保持仿真器处于在线状态,此时不管单步还是全速运行代码都可以正常跑 3、让仿真器处于单步状态,此时通过CCS的复位键(有个类似返回键的那个)对软件进行复位,此时仿真器仍处于在线,此时不管单步还是全速运行代码都可以正常跑 4、仍然保持仿真器处于在线状态,通过CCS的复位键(CPU reset)进行复位,之后flash中的内容就全为0处于加密状态,程序就不能跑了
使用dcsm进行配置如下:
1、
.sect "b0_dcsm_otp_z1_linkpointer" ;select block1, no change
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER1
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER2
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER3
.long 0xFFFFFFFF ;Reserved
默认选择block0
2、
.sect "b0_dcsm_zsel_z1"
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYRAM
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYSECT
.long 0xFFFFFFFF ;B0_Z1OTP_GRABRAM
.long 0xFFFFFEFF ;B0_Z1OTP_GRABSECT ;b0 sector4 0xFFFFFFFF->0xFFFFFEFF
.long 0x11112222 ;B0_Z1OTP_CSMPSWD0 (LSW of 128-bit password)
.long 0x33334444 ;B0_Z1OTP_CSMPSWD1
.long 0x55556666 ;B0_Z1OTP_CSMPSWD2
.long 0x77778888 ;B0_Z1OTP_CSMPSWD3 (MSW of 128-bit password)
选择bank0中sector4 flash扇区进行加密
3、
cmd文件:
b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0
b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0, type = DSECT
b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0, type = DSECT
b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0
4、其他地方不进行加密
使用CCS不能烧写:
C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code). Operation cancelled.
C28xx_CPU1: File Loader: Memory write failed: Unknown error
C28xx_CPU1: GEL: File: F:\XXX.out: Load failed.
天下无狗:
回复 天下无狗:
另外,需要说明,用仿真器调试时通过仿真器可以看到flash是已经编程了的
使用dcsm进行配置如下:
1、
.sect "b0_dcsm_otp_z1_linkpointer" ;select block1, no change
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER1
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER2
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER3
.long 0xFFFFFFFF ;Reserved
默认选择block0
2、
.sect "b0_dcsm_zsel_z1"
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYRAM
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYSECT
.long 0xFFFFFFFF ;B0_Z1OTP_GRABRAM
.long 0xFFFFFEFF ;B0_Z1OTP_GRABSECT ;b0 sector4 0xFFFFFFFF->0xFFFFFEFF
.long 0x11112222 ;B0_Z1OTP_CSMPSWD0 (LSW of 128-bit password)
.long 0x33334444 ;B0_Z1OTP_CSMPSWD1
.long 0x55556666 ;B0_Z1OTP_CSMPSWD2
.long 0x77778888 ;B0_Z1OTP_CSMPSWD3 (MSW of 128-bit password)
选择bank0中sector4 flash扇区进行加密
3、
cmd文件:
b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0
b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0, type = DSECT
b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0, type = DSECT
b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0
4、其他地方不进行加密
使用CCS不能烧写:
C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code). Operation cancelled.
C28xx_CPU1: File Loader: Memory write failed: Unknown error
C28xx_CPU1: GEL: File: F:\XXX.out: Load failed.
天下无狗:
回复 天下无狗:
沉了????
使用dcsm进行配置如下:
1、
.sect "b0_dcsm_otp_z1_linkpointer" ;select block1, no change
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER1
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER2
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER3
.long 0xFFFFFFFF ;Reserved
默认选择block0
2、
.sect "b0_dcsm_zsel_z1"
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYRAM
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYSECT
.long 0xFFFFFFFF ;B0_Z1OTP_GRABRAM
.long 0xFFFFFEFF ;B0_Z1OTP_GRABSECT ;b0 sector4 0xFFFFFFFF->0xFFFFFEFF
.long 0x11112222 ;B0_Z1OTP_CSMPSWD0 (LSW of 128-bit password)
.long 0x33334444 ;B0_Z1OTP_CSMPSWD1
.long 0x55556666 ;B0_Z1OTP_CSMPSWD2
.long 0x77778888 ;B0_Z1OTP_CSMPSWD3 (MSW of 128-bit password)
选择bank0中sector4 flash扇区进行加密
3、
cmd文件:
b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0
b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0, type = DSECT
b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0, type = DSECT
b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0
4、其他地方不进行加密
使用CCS不能烧写:
C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code). Operation cancelled.
C28xx_CPU1: File Loader: Memory write failed: Unknown error
C28xx_CPU1: GEL: File: F:\XXX.out: Load failed.
天下无狗:
回复 天下无狗:
再次补充,加密后通过CPU reset复位,然后单步发现在boot28.asm执行第一条指令MOVSP,#_stack程序就跑飞了
使用dcsm进行配置如下:
1、
.sect "b0_dcsm_otp_z1_linkpointer" ;select block1, no change
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER1
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER2
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER3
.long 0xFFFFFFFF ;Reserved
默认选择block0
2、
.sect "b0_dcsm_zsel_z1"
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYRAM
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYSECT
.long 0xFFFFFFFF ;B0_Z1OTP_GRABRAM
.long 0xFFFFFEFF ;B0_Z1OTP_GRABSECT ;b0 sector4 0xFFFFFFFF->0xFFFFFEFF
.long 0x11112222 ;B0_Z1OTP_CSMPSWD0 (LSW of 128-bit password)
.long 0x33334444 ;B0_Z1OTP_CSMPSWD1
.long 0x55556666 ;B0_Z1OTP_CSMPSWD2
.long 0x77778888 ;B0_Z1OTP_CSMPSWD3 (MSW of 128-bit password)
选择bank0中sector4 flash扇区进行加密
3、
cmd文件:
b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0
b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0, type = DSECT
b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0, type = DSECT
b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0
4、其他地方不进行加密
使用CCS不能烧写:
C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code). Operation cancelled.
C28xx_CPU1: File Loader: Memory write failed: Unknown error
C28xx_CPU1: GEL: File: F:\XXX.out: Load failed.
mangui zhang:
回复 天下无狗:
我觉得是加密区和非加密区相互访问的原因吧
使用dcsm进行配置如下:
1、
.sect "b0_dcsm_otp_z1_linkpointer" ;select block1, no change
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER1
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER2
.long 0xFFFFFFFF ;Reserved
.long 0x1FFFFFFF ;B0_Z1OTP_LINKPOINTER3
.long 0xFFFFFFFF ;Reserved
默认选择block0
2、
.sect "b0_dcsm_zsel_z1"
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYRAM
.long 0xFFFFFFFF ;B0_Z1OTP_EXEONLYSECT
.long 0xFFFFFFFF ;B0_Z1OTP_GRABRAM
.long 0xFFFFFEFF ;B0_Z1OTP_GRABSECT ;b0 sector4 0xFFFFFFFF->0xFFFFFEFF
.long 0x11112222 ;B0_Z1OTP_CSMPSWD0 (LSW of 128-bit password)
.long 0x33334444 ;B0_Z1OTP_CSMPSWD1
.long 0x55556666 ;B0_Z1OTP_CSMPSWD2
.long 0x77778888 ;B0_Z1OTP_CSMPSWD3 (MSW of 128-bit password)
选择bank0中sector4 flash扇区进行加密
3、
cmd文件:
b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0
b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0, type = DSECT
b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0, type = DSECT
b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0, type = DSECT
b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0
4、其他地方不进行加密
使用CCS不能烧写:
C28xx_CPU1: Error during Flash programming (Flash algorithm returned error code). Operation cancelled.
C28xx_CPU1: File Loader: Memory write failed: Unknown error
C28xx_CPU1: GEL: File: F:\XXX.out: Load failed.
天下无狗:
回复 mangui zhang:
现在是这样的我的代码是放在flash的bank0中的sector0~3,这四个扇区未受密码保护,bank0的sector4进行加密,实际用的时候没有代码也没有访问sector4啊,这点确实没搞明白