本帖最后由 coslight 于 2015-5-18 08:15 编辑
今天下载了新版的BSP_M058S_V3.00.00.1版本的库文件,使用中发现Sys_UnlockReg()使用无法通过。进过查找发现问题处在GCR的寄存器定义上。
原来的M058s。h中定义GCR_T为:
typedef struct
{
__I uint32_t PDID; /* Offset: 0x00 Part Device Identification Number Register. */
__IO uint32_t RSTSRC; /* Offset: 0x04 System Reset Source Register */
__IO uint32_t IPRSTC1; /* Offset: 0x08 Peripheral Reset Control Resister 1 */
__IO uint32_t IPRSTC2; /* Offset: 0x0C Peripheral Reset Control Resister 2 */
__IO uint32_t BODCR; /* Offset: 0x18 Brown-Out Detector Control Register */
__IO uint32_t TEMPCR; /* Offset: 0x1C Temperature Sensor Control Register */
__IO uint32_t PORCR; /* Offset: 0x24 Power-On-Reset Control Register */
__IO uint32_t P0_MFP; /* Offset: 0x30 P0 Multiple Function and Input Type Control Register */
__IO uint32_t P1_MFP; /* Offset: 0x34 P1 Multiple Function and Input Type Control Register */
__IO uint32_t P2_MFP; /* Offset: 0x38 P2 Multiple Function and Input Type Control Register */
__IO uint32_t P3_MFP; /* Offset: 0x3C P3 Multiple Function and Input Type Control Register */
__IO uint32_t P4_MFP; /* Offset: 0x40 P4 Multiple Function and Input Type Control Register */
__IO uint32_t P5_MFP; /* Offset: 0x44 P5 Multiple Function and Input Type Control Register */
__IO uint32_t P6_MFP; /* Offset: 0x48 P6 Multiple Function and Input Type Control Register */
__IO uint32_t P7_MFP; /* Offset: 0x4C P7 Multiple Function and Input Type Control Register */
__IO uint32_t REGWRPROT; /* Offset: 0x100 Register Write-Protection Register */
} GCR_T;
修改后的代码为:
typedef struct
{
__I uint32_t PDID; /* Offset: 0x00 Part Device Identification Number Register. */
__IO uint32_t RSTSRC; /* Offset: 0x04 System Reset Source Register */
__IO uint32_t IPRSTC1; /* Offset: 0x08 Peripheral Reset Control Resister 1 */
__IO uint32_t IPRSTC2; /* Offset: 0x0C Peripheral Reset Control Resister 2 */
__IO uint32_t bak1[2];
__IO uint32_t BODCR; /* Offset: 0x18 Brown-Out Detector Control Register */
__IO uint32_t TEMPCR; /* Offset: 0x1C Temperature Sensor Control Register */
__IO uint32_t bak2[1];
__IO uint32_t PORCR; /* Offset: 0x24 Power-On-Reset Control Register */
__IO uint32_t bak3[2];
__IO uint32_t P0_MFP; /* Offset: 0x30 P0 Multiple Function and Input Type Control Register */
__IO uint32_t P1_MFP; /* Offset: 0x34 P1 Multiple Function and Input Type Control Register */
__IO uint32_t P2_MFP; /* Offset: 0x38 P2 Multiple Function and Input Type Control Register */
__IO uint32_t P3_MFP; /* Offset: 0x3C P3 Multiple Function and Input Type Control Register */
__IO uint32_t P4_MFP; /* Offset: 0x40 P4 Multiple Function and Input Type Control Register */
__IO uint32_t P5_MFP; /* Offset: 0x44 P5 Multiple Function and Input Type Control Register */
__IO uint32_t P6_MFP; /* Offset: 0x48 P6 Multiple Function and Input Type Control Register */
__IO uint32_t P7_MFP; /* Offset: 0x4C P7 Multiple Function and Input Type Control Register */
__IO uint32_t bak4[4+4+4+4+4+4+4+4+4+4+4];
__IO uint32_t REGWRPROT; /* Offset: 0x100 Register Write-Protection Register */
} GCR_T;
修改后在编译下载后运行正常了。
|