Tool/software: Code Composer Studio
Hi ,
I am using code composer version 6.1.3.00034 .
I have been able to use the the code composer On-Chip flash to lock and unlock passwords in zone 1 . I am now trying to do the same by using the blinky_dcsm_xpu01.c example.
First could you tell me what CsmUnlock() in F2837xD_SysCtrl.c is used for ? Is this to be put in the gel file so that the processor automatically unlock on ccs connection . If so, what is the purpose of this ?
OnReset(int nErrorCode) { Unlock_CSM();
}
Secondly , If I am not using automatic unlocking ,
Do I need the below code for performing a dummy read of the PWL registers and writing the 128-bit password to CSMKEY registers?
void DcsmZ1Unlock(void) { volatile long int *CSM = (volatile long int *)0x5F010; //CSM register file volatile long int *CSMPWL = (volatile long int *)0x78028; //CSM Password location (assuming default Zone sel block) volatile int tmp; int I; // Read the 128-bits of the CSM password locations (PWL) // for (I=0; I<4; I++) tmp = *CSMPWL++; // If the password locations (CSMPWL) are all = ones (0xFFFF), // then the zone will now be unsecure. If the password // is not all ones (0xFFFF), then the code below is required // to unsecure the CSM. // Write the 128-bit password to the CSMKEY registers // If this password matches that stored in the // CSLPWL then the CSM will become unsecure. If it does not // match, then the zone will remain secure. // An example password of: // 0x11112222333344445555666677778888 is used. *CSM++ = DcsmZ1Regs.Z1_CSMKEY0;//0x22221111; // Register Z1_CSMKEY0 at 0x5F010 *CSM++ = DcsmZ1Regs.Z1_CSMKEY1;//0x44443333; // Register Z1_CSMKEY1 at 0x5F012 *CSM++ = DcsmZ1Regs.Z1_CSMKEY2;//0x66665555; // Register Z1_CSMKEY2 at 0x5F014 *CSM++ = DcsmZ1Regs.Z1_CSMKEY3;//0x88887777; // Register Z1_CSMKEY3 at 0x5F016 }
IF so , where do I place this code and call this function from ? Do I place it in blink_with_DCSM_cpu01.c OR in the gel file ?
If I put it in the gel file , the gel file fails .
And will the gel file have the DcsmZ1Unlock() instead of Unlock_CSM() as shown below :
OnReset(int nErrorCode) {
DcsmZ1Unlock();
}