Browse Source

fixed: 修正eeprom block bug

master
zhangsan 4 years ago
parent
commit
d7129bc277
  1. BIN
      si4/ps5ws.si4project/soft_ps5ws.sip_xm
  2. 6
      source/app/common.c
  3. 6
      source/bsp/bsp_config.h

BIN
si4/ps5ws.si4project/soft_ps5ws.sip_xm

Binary file not shown.

6
source/app/common.c

@ -29,7 +29,7 @@ void L3_eeprom_read_param()
} }
} }
#endif #endif
if(L1_eep_read_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, D_EEP_PARAM_BLOCK_SIZE, (U8*)&G.p, NULL) == 0) if(L1_eep_read_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, D_EEP_SECTOR_BLOCK_SIZE, (U8*)&G.p, NULL) == 0)
{ {
//L0_uart0_sendstr("e2p read success"); //L0_uart0_sendstr("e2p read success");
return; return;
@ -51,7 +51,7 @@ void L3_eeprom_persist_param()
L0_Iap_Erase(EEP_PARAM_ADDR); L0_Iap_Erase(EEP_PARAM_ADDR);
L0_Iap_Program_array(EEP_PARAM_ADDR, (U8*)&eep_param, 2 + dlen + 2); L0_Iap_Program_array(EEP_PARAM_ADDR, (U8*)&eep_param, 2 + dlen + 2);
#endif #endif
if(L1_eep_write_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, D_EEP_PARAM_BLOCK_SIZE, (U8*)&G.p,sizeof(G.p),TRUE) == 0) if(L1_eep_write_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, D_EEP_SECTOR_BLOCK_SIZE, (U8*)&G.p,sizeof(G.p),TRUE) == 0)
{ {
//L0_uart0_sendstr("e2p write success"); //L0_uart0_sendstr("e2p write success");
return; return;
@ -109,7 +109,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