Browse Source

fixed: 修正eeprom block bug

pull/1/head v0.1
zhangsan 4 years ago
parent
commit
845a1ed295
  1. BIN
      si4/ps5ws.si4project/soft_ps5ws.sip_xm
  2. 4
      source/app/app_config.c
  3. 2
      source/app/task_encrypt.c
  4. 6
      source/bsp/bsp_config.h

BIN
si4/ps5ws.si4project/soft_ps5ws.sip_xm

Binary file not shown.

4
source/app/app_config.c

@ -44,7 +44,7 @@ void L3_reg_2_iap(void)
L0_uart0_sendstr("e2p write success"); L0_uart0_sendstr("e2p write success");
} }
#endif #endif
if(L1_eep_write_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, D_EEP_PARAM_BLOCK_SIZE, (U8*)&R.p,sizeof(R.p),TRUE) == 0) if(L1_eep_write_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, D_EEP_SECTOR_BLOCK_SIZE, (U8*)&R.p,sizeof(R.p),TRUE) == 0)
{ {
L0_uart0_sendstr("e2p write success"); L0_uart0_sendstr("e2p write success");
return; return;
@ -73,7 +73,7 @@ void L3_iap_2_reg(void)
R.p.adc_blur_threshold[0] = iapData.adc_blur_threshold[0]; R.p.adc_blur_threshold[0] = iapData.adc_blur_threshold[0];
R.p.adc_blur_threshold[1] = iapData.adc_blur_threshold[1]; R.p.adc_blur_threshold[1] = iapData.adc_blur_threshold[1];
#endif #endif
if(L1_eep_read_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, D_EEP_PARAM_BLOCK_SIZE, (U8*)&R.p, NULL) == 0) if(L1_eep_read_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, D_EEP_SECTOR_BLOCK_SIZE, (U8*)&R.p, NULL) == 0)
{ {
L0_uart0_sendstr("e2p read success"); L0_uart0_sendstr("e2p read success");
return; return;

2
source/app/task_encrypt.c

@ -31,7 +31,7 @@ int L3_mcu_id_ok(void)
U8 i = 0; U8 i = 0;
//1. 获取eeprom中存储的enc信息 //1. 获取eeprom中存储的enc信息
if(L1_eep_read_block(D_EEP_ENC_IN_SECTOR, D_EEP_ENC_IN_BLOCK, D_EEP_ENC_BLOCK_SIZE, (U8*)&eep_enc,NULL) == 1) if(L1_eep_read_block(D_EEP_ENC_IN_SECTOR, D_EEP_ENC_IN_BLOCK, D_EEP_SECTOR_BLOCK_SIZE, (U8*)&eep_enc,NULL) == 1)
{ {
//L0_uart0_sendstr("e2p read enc failed"); //L0_uart0_sendstr("e2p read enc failed");
return 0; return 0;

6
source/bsp/bsp_config.h

@ -116,13 +116,13 @@
//EEP User Defined 参数区存储配置 //EEP User Defined 参数区存储配置
#define D_EEP_PARAM_IN_SECTOR 1 //eeprom参数区扇区地址,从0开始 #define D_EEP_PARAM_IN_SECTOR 1 //eeprom参数区扇区地址,从0开始
#define D_EEP_PARAM_IN_BLOCK 0 //eeprom参数区数据块地址,从0开始 #define D_EEP_PARAM_IN_BLOCK 0 //eeprom参数区数据块地址,从0开始
#define D_EEP_PARAM_BLOCK_SIZE (D_EEP_SECTOR_BLOCK_SIZE) //参数区每个块大小,必须:D_EEP_PARAM_BLOCK_SIZE<=D_EEP_SECTOR_BLOCK_SIZE!!!,因为eeprom.h中是按照D_EEP_SECTOR_BLOCK_SIZE分配的buf //#define D_EEP_PARAM_BLOCK_SIZE (D_EEP_SECTOR_BLOCK_SIZE) //参数区每个块大小,必须:D_EEP_PARAM_BLOCK_SIZE<=D_EEP_SECTOR_BLOCK_SIZE!!!,因为eeprom.h中是按照D_EEP_SECTOR_BLOCK_SIZE分配的buf
#define D_EEP_PARAM_BLOCK_NUM (D_EEP_SECTOR_SIZE / D_EEP_PARAM_BLOCK_SIZE) //每个扇区数据块的数量 //#define D_EEP_PARAM_BLOCK_NUM (D_EEP_SECTOR_SIZE / D_EEP_PARAM_BLOCK_SIZE) //每个扇区数据块的数量
//EEP 加密区存储配置 //EEP 加密区存储配置
#if(D_CODE_ENCRYPTION_TYPE == TYPE_ENCRYPTION_ENABLE) #if(D_CODE_ENCRYPTION_TYPE == TYPE_ENCRYPTION_ENABLE)
#define D_EEP_ENC_IN_SECTOR 0 //eeprom加密区扇区地址,从0开始 #define D_EEP_ENC_IN_SECTOR 0 //eeprom加密区扇区地址,从0开始
#define D_EEP_ENC_IN_BLOCK 0 //eeprom加密区数据块地址,从0开始 #define D_EEP_ENC_IN_BLOCK 0 //eeprom加密区数据块地址,从0开始
#define D_EEP_ENC_BLOCK_SIZE 0x20 //ENC_BLOCK_SIZE必须与加密程序中的ENC_BLOCK_SIZE匹配,此处不建议修改,如需修改,请同时修改加密程序 //#define D_EEP_ENC_BLOCK_SIZE 0x20 //ENC_BLOCK_SIZE必须与加密程序中的ENC_BLOCK_SIZE匹配,此处不建议修改,如需修改,请同时修改加密程序
#endif #endif
#elif #elif
xxx xxx

Loading…
Cancel
Save