Tool/software: Code Composer Studio
I am testing out the CSM on a launchpadXL board. My intention was to start with the CSM enabled but with the full password match flow, then only half the password match flow and then none, but I got stuck on the first part.
I am able to attach to the target/program it if I have selected the "Emuation Boot" with the bootmode switches of the launchpad. I would like to be able to attach/program the device when it is running from Flash as well (GetMode bootmode), but this doesn't work at the moment. One of the first things my program does, is run the whole Password Match Flow. I thought this would allow me to connect to the target as soon as it has been completed (which would be almost instantly after turning on). However this is not the case, as instead I get this error:
Error connecting to the target:
(Error -1135 @ 0x0)
The debug probe reported an error. Confirm debug probe configuration and connections, reset the debug probe, and retry the operation.
(Emulation package 8.0.903.4).
The code for the Password Match Flow is taken directly from the TRM:
volatile int *CSM = (volatile int *)0x000AE0; //CSM register file
volatile int *PWL = (volatile int *)0x003F7FF8; //Password location
volatile int tmp;
int I;
// Read the 128-bits of the password locations (PWL)
// in flash at address 0x3F 7FF8 - 0x3F 7FFF
// If the device is secure, then the values read will
// not actually be loaded into the temp variable, so
// this is called a dummy read.
for (I=0; I<8; I++) tmp = *PWL++;
// If the password locations (PWL) are all = ones (0xFFFF),
// then the device 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 KEY registers
// If this password matches that stored in the
// PWL then the CSM will become unsecure. If it does not
// match, then the device will remain secure.
// An example password of:
// 0x11112222333344445555666677778888 is used.
EALLOW;
*CSM++ = 0x1111; // Register KEY0 at 0xAE0
*CSM++ = 0x2222; // Register KEY1 at 0xAE1
*CSM++ = 0x3333; // Register KEY2 at 0xAE2
*CSM++ = 0x4444; // Register KEY3 at 0xAE3
*CSM++ = 0x5555; // Register KEY4 at 0xAE4
*CSM++ = 0x6666; // Register KEY5 at 0xAE5
*CSM++ = 0x7777; // Register KEY6 at 0xAE6
*CSM++ = 0x8888; // Register KEY7 at 0xAE7
EDIS;
These are the contents of the memory browser window pointed at password memory locations directly after loading the program:
0x003F7FF8 PWL_PWL0
0x003F7FF8 0x1111
0x003F7FF9 PWL_PWL1
0x003F7FF9 0x2222
0x003F7FFA PWL_PWL2
0x003F7FFA 0x3333
0x003F7FFB PWL_PWL3
0x003F7FFB 0x4444
0x003F7FFC PWL_PWL4
0x003F7FFC 0x5555
0x003F7FFD PWL_PWL5
0x003F7FFD 0x6666
0x003F7FFE PWL_PWL6
0x003F7FFE 0x7777
0x003F7FFF PWL_PWL7
0x003F7FFF 0x8888 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
0x003F8007 0x0000