This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

28069 CSM and jump to flash

Other Parts Discussed in Thread: UNIFLASH, CONTROLSUITE

I have a custom bootloader that resides in Sector A. It is structured such that upon reset the bootloader is run which then checks for a valid application in another Section of Flash and then jumps to it. This has all been working reliably for some time.

I am now intersted in turning on the CSM. When I program a key to the CSM either using CCS v5.5 or Uniflash v3 my bootloader no longer runs. It seems as if the code is not branching appropriately to the codestart section. 

I assumed that I could write a key to Sector A that had already been programmed (but not the key locations) as the flash manual states that flash writes of 1 bit are possible. I noticed that the jump to flash memory location resides right between the zeros and the key for the CSM. Could it be that the writing of the key somehow also over writes this? 

What is the correct proceedure for loading code into sector A and programming the key as a seperate step?

Are there modifications that need to be made to the cmd file in order to support the CSM that I am missing?

  • I did an experiment where I read the memory location 0x3F7FF6 when all is working. In there is the value I expect for the code jump. Next I used the Uniflash utility to write the CSM key in and performed the same read - I get zeros back and my bootloader no longer runs.

    This suggests that perhaps the CSM utility is over writing the jump to flash location 0x3F7FF6 . I checked other memory locations in Sector A where I have placed some table data with specific values and it looks like those were preserved just fine during the key programming. So it seems that just the jump to flash address is being modified (i.e. to me it looks like the sector is not erased before the key is written).

    Can you please confirm, and suggest a workaround?
  • Correction - it looks like the whole sector might be erased. So I guess the question really is, is an erase part of the key programming process? And if so how do you load code into sector A while preserving the ability to load a CSM key at a later time?
  • Stevens,

    If you don't have the passwords locations intialize in your code then it should not be part of your .out and password locations will not be programmed.  As long as none of the passwords locations are programmed and all of them have value 0xFFFF, they can be programmed later using the CCS flash tool without erasing whole sector.

    Regards,

    Vivek Singh

  • Steven,

    Vivek is right. You should be able to program CSM passwords any time to secure your device.

    When using CSM, address locations 0x3F7F80 - 0x3F7FF5 should not contain any program (or) data code. These locations will be programmed '0x0000s' when CSM passwords is used. Are you using any of these locations to store your customer application code? If so, this could be the problem.

    Please refer to NOTE mentioned Pg45 of www.ti.com/.../tms320f28069.pdf for more details.

    Regards,
    Manoj
  • In this test I erase the entire flash with Uniflash v3, I then program it using the same tool and verifty it runs. Then using the DSS I read out the memory for the CSM and some table data in Sector A. This is with my program loaded into SectorA, and all runs fine.

    Console Output:

    Connecting to CPU...
    Connected to CPU.

    Restarting...
    CPU Restarted.
    C28xx: Starting device unlocking...

    C28xx: Device unlocked. To clear the programmed password, please erase Sector A
    of Flash memory.

    CSM Data:
    Data at : 0x3f7f80 : 0x0L 0x0L
    Data at : 0x3f7f82 : 0x0L 0x0L
    Data at : 0x3f7f84 : 0x0L 0x0L
    Data at : 0x3f7f86 : 0x0L 0x0L
    Data at : 0x3f7f88 : 0x0L 0x0L
    Data at : 0x3f7f8a : 0x0L 0x0L
    Data at : 0x3f7f8c : 0x0L 0x0L
    Data at : 0x3f7f8e : 0x0L 0x0L
    Data at : 0x3f7f90 : 0x0L 0x0L
    Data at : 0x3f7f92 : 0x0L 0x0L
    Data at : 0x3f7f94 : 0x0L 0x0L
    Data at : 0x3f7f96 : 0x0L 0x0L
    Data at : 0x3f7f98 : 0x0L 0x0L
    Data at : 0x3f7f9a : 0x0L 0x0L
    Data at : 0x3f7f9c : 0x0L 0x0L
    Data at : 0x3f7f9e : 0x0L 0x0L
    Data at : 0x3f7fa0 : 0x0L 0x0L
    Data at : 0x3f7fa2 : 0x0L 0x0L
    Data at : 0x3f7fa4 : 0x0L 0x0L
    Data at : 0x3f7fa6 : 0x0L 0x0L
    Data at : 0x3f7fa8 : 0x0L 0x0L
    Data at : 0x3f7faa : 0x0L 0x0L
    Data at : 0x3f7fac : 0x0L 0x0L
    Data at : 0x3f7fae : 0x0L 0x0L
    Data at : 0x3f7fb0 : 0x0L 0x0L
    Data at : 0x3f7fb2 : 0x0L 0x0L
    Data at : 0x3f7fb4 : 0x0L 0x0L
    Data at : 0x3f7fb6 : 0x0L 0x0L
    Data at : 0x3f7fb8 : 0x0L 0x0L
    Data at : 0x3f7fba : 0x0L 0x0L
    Data at : 0x3f7fbc : 0x0L 0x0L
    Data at : 0x3f7fbe : 0x0L 0x0L
    Data at : 0x3f7fc0 : 0x0L 0x0L
    Data at : 0x3f7fc2 : 0x0L 0x0L
    Data at : 0x3f7fc4 : 0x0L 0x0L
    Data at : 0x3f7fc6 : 0x0L 0x0L
    Data at : 0x3f7fc8 : 0x0L 0x0L
    Data at : 0x3f7fca : 0x0L 0x0L
    Data at : 0x3f7fcc : 0x0L 0x0L
    Data at : 0x3f7fce : 0x0L 0x0L
    Data at : 0x3f7fd0 : 0x0L 0x0L
    Data at : 0x3f7fd2 : 0x0L 0x0L
    Data at : 0x3f7fd4 : 0x0L 0x0L
    Data at : 0x3f7fd6 : 0x0L 0x0L
    Data at : 0x3f7fd8 : 0x0L 0x0L
    Data at : 0x3f7fda : 0x0L 0x0L
    Data at : 0x3f7fdc : 0x0L 0x0L
    Data at : 0x3f7fde : 0x0L 0x0L
    Data at : 0x3f7fe0 : 0x0L 0x0L
    Data at : 0x3f7fe2 : 0x0L 0x0L
    Data at : 0x3f7fe4 : 0x0L 0x0L
    Data at : 0x3f7fe6 : 0x0L 0x0L
    Data at : 0x3f7fe8 : 0x0L 0x0L
    Data at : 0x3f7fea : 0x0L 0x0L
    Data at : 0x3f7fec : 0x0L 0x0L
    Data at : 0x3f7fee : 0x0L 0x0L
    Data at : 0x3f7ff0 : 0x0L 0x0L
    Data at : 0x3f7ff2 : 0x0L 0x0L
    Data at : 0x3f7ff4 : 0x0L 0x0L
    Data at : 0x3f7ff6 : 0x7fL 0x4030L
    Data at : 0x3f7ff8 : 0xffffL 0xffffL
    Data at : 0x3f7ffa : 0xffffL 0xffffL
    Data at : 0x3f7ffc : 0xffffL 0xffffL
    Data at : 0x3f7ffe : 0xffffL 0xffffL

    Table Data
    Data at : 0x3f4004 : 0x7126L 0x9944L
    Data at : 0x3f4006 : 0xd802L 0x2049L
    Data at : 0x3f4008 : 0x2be8L 0x407cL
    Data at : 0x3f400a : 0x9b74L 0x61a1L

    So I program a key, then run the exact same DSS script again (which includes code to unlock it with the key I just programmed). Here is what I get:

    Connecting to CPU...
    C28xx: GEL Output:
    Device Calibration not complete, check if device is unlocked and recalibrate.
    Connected to CPU.

    Restarting...
    C28xx: GEL Output:
    Device Calibration not complete, check if device is unlocked and recalibrate.
    CPU Restarted.
    C28xx: Starting device unlocking...

    C28xx: Device unlocked. To clear the programmed password, please erase Sector A
    of Flash memory.

    CSM Data:
    Data at : 0x3f7f80 : 0x0L 0x0L
    Data at : 0x3f7f82 : 0x0L 0x0L
    Data at : 0x3f7f84 : 0x0L 0x0L
    Data at : 0x3f7f86 : 0x0L 0x0L
    Data at : 0x3f7f88 : 0x0L 0x0L
    Data at : 0x3f7f8a : 0x0L 0x0L
    Data at : 0x3f7f8c : 0x0L 0x0L
    Data at : 0x3f7f8e : 0x0L 0x0L
    Data at : 0x3f7f90 : 0x0L 0x0L
    Data at : 0x3f7f92 : 0x0L 0x0L
    Data at : 0x3f7f94 : 0x0L 0x0L
    Data at : 0x3f7f96 : 0x0L 0x0L
    Data at : 0x3f7f98 : 0x0L 0x0L
    Data at : 0x3f7f9a : 0x0L 0x0L
    Data at : 0x3f7f9c : 0x0L 0x0L
    Data at : 0x3f7f9e : 0x0L 0x0L
    Data at : 0x3f7fa0 : 0x0L 0x0L
    Data at : 0x3f7fa2 : 0x0L 0x0L
    Data at : 0x3f7fa4 : 0x0L 0x0L
    Data at : 0x3f7fa6 : 0x0L 0x0L
    Data at : 0x3f7fa8 : 0x0L 0x0L
    Data at : 0x3f7faa : 0x0L 0x0L
    Data at : 0x3f7fac : 0x0L 0x0L
    Data at : 0x3f7fae : 0x0L 0x0L
    Data at : 0x3f7fb0 : 0x0L 0x0L
    Data at : 0x3f7fb2 : 0x0L 0x0L
    Data at : 0x3f7fb4 : 0x0L 0x0L
    Data at : 0x3f7fb6 : 0x0L 0x0L
    Data at : 0x3f7fb8 : 0x0L 0x0L
    Data at : 0x3f7fba : 0x0L 0x0L
    Data at : 0x3f7fbc : 0x0L 0x0L
    Data at : 0x3f7fbe : 0x0L 0x0L
    Data at : 0x3f7fc0 : 0x0L 0x0L
    Data at : 0x3f7fc2 : 0x0L 0x0L
    Data at : 0x3f7fc4 : 0x0L 0x0L
    Data at : 0x3f7fc6 : 0x0L 0x0L
    Data at : 0x3f7fc8 : 0x0L 0x0L
    Data at : 0x3f7fca : 0x0L 0x0L
    Data at : 0x3f7fcc : 0x0L 0x0L
    Data at : 0x3f7fce : 0x0L 0x0L
    Data at : 0x3f7fd0 : 0x0L 0x0L
    Data at : 0x3f7fd2 : 0x0L 0x0L
    Data at : 0x3f7fd4 : 0x0L 0x0L
    Data at : 0x3f7fd6 : 0x0L 0x0L
    Data at : 0x3f7fd8 : 0x0L 0x0L
    Data at : 0x3f7fda : 0x0L 0x0L
    Data at : 0x3f7fdc : 0x0L 0x0L
    Data at : 0x3f7fde : 0x0L 0x0L
    Data at : 0x3f7fe0 : 0x0L 0x0L
    Data at : 0x3f7fe2 : 0x0L 0x0L
    Data at : 0x3f7fe4 : 0x0L 0x0L
    Data at : 0x3f7fe6 : 0x0L 0x0L
    Data at : 0x3f7fe8 : 0x0L 0x0L
    Data at : 0x3f7fea : 0x0L 0x0L
    Data at : 0x3f7fec : 0x0L 0x0L
    Data at : 0x3f7fee : 0x0L 0x0L
    Data at : 0x3f7ff0 : 0x0L 0x0L
    Data at : 0x3f7ff2 : 0x0L 0x0L
    Data at : 0x3f7ff4 : 0x0L 0x0L
    Data at : 0x3f7ff6 : 0x0L 0x0L
    Data at : 0x3f7ff8 : 0x0L 0x0L
    Data at : 0x3f7ffa : 0x0L 0x0L
    Data at : 0x3f7ffc : 0x0L 0x0L
    Data at : 0x3f7ffe : 0x0L 0x0L

    Table Data
    Data at : 0x3f4004 : 0x0L 0x0L
    Data at : 0x3f4006 : 0x0L 0x0L
    Data at : 0x3f4008 : 0x0L 0x0L
    Data at : 0x3f400a : 0x0L 0x0L

    This looks like either the CSM is not really unlocked or the data isn't there. Now my progam does not run. I can't tell if the data is really gone or the data reads are returning zero due to the CSM really being locked when it reports being unlocked. Remember, my program no longer runs and the only thing I can do at this point is unlock, which I can do, erase, which I can also do which erases the password, and reprogram - now my program can run but there is no key.

    My problem is really that my previoously functional program in Sector A no longer runs once the key is loaded. The above is just my attempts to sort out what is stopping the program from running.

  • I added a CSMSRC Register Read to my DSS code to verify the CSM state before attempting to read and ran the second half of the test (with a password set) again. The console output is below and now includes a "Status" which reports if the debugger is connected and BIT0 of the CSMSCR register which is 0 = Unsecure, 1 = Secure

    Connecting to CPU...
    C28xx: GEL Output:
    Device Calibration not complete, check if device is unlocked and recalibrate.
    Connected to CPU.


    Status:
    Is Target Connected : True
    Is Target Locked : 1

    Restarting...
    C28xx: GEL Output:
    Device Calibration not complete, check if device is unlocked and recalibrate.
    CPU Restarted.

    Status:
    Is Target Connected : True
    Is Target Locked : 1

    C28xx: Starting device unlocking...

    C28xx: Device unlocked. To clear the programmed password, please erase Sector A
    of Flash memory.


    Status:
    Is Target Connected : True
    Is Target Locked : 0

    CSM Data:
    Data at : 0x3f7f80 : 0x0L 0x0L
    Data at : 0x3f7f82 : 0x0L 0x0L
    Data at : 0x3f7f84 : 0x0L 0x0L
    Data at : 0x3f7f86 : 0x0L 0x0L
    Data at : 0x3f7f88 : 0x0L 0x0L
    Data at : 0x3f7f8a : 0x0L 0x0L
    Data at : 0x3f7f8c : 0x0L 0x0L
    Data at : 0x3f7f8e : 0x0L 0x0L
    Data at : 0x3f7f90 : 0x0L 0x0L
    Data at : 0x3f7f92 : 0x0L 0x0L
    Data at : 0x3f7f94 : 0x0L 0x0L
    Data at : 0x3f7f96 : 0x0L 0x0L
    Data at : 0x3f7f98 : 0x0L 0x0L
    Data at : 0x3f7f9a : 0x0L 0x0L
    Data at : 0x3f7f9c : 0x0L 0x0L
    Data at : 0x3f7f9e : 0x0L 0x0L
    Data at : 0x3f7fa0 : 0x0L 0x0L
    Data at : 0x3f7fa2 : 0x0L 0x0L
    Data at : 0x3f7fa4 : 0x0L 0x0L
    Data at : 0x3f7fa6 : 0x0L 0x0L
    Data at : 0x3f7fa8 : 0x0L 0x0L
    Data at : 0x3f7faa : 0x0L 0x0L
    Data at : 0x3f7fac : 0x0L 0x0L
    Data at : 0x3f7fae : 0x0L 0x0L
    Data at : 0x3f7fb0 : 0x0L 0x0L
    Data at : 0x3f7fb2 : 0x0L 0x0L
    Data at : 0x3f7fb4 : 0x0L 0x0L
    Data at : 0x3f7fb6 : 0x0L 0x0L
    Data at : 0x3f7fb8 : 0x0L 0x0L
    Data at : 0x3f7fba : 0x0L 0x0L
    Data at : 0x3f7fbc : 0x0L 0x0L
    Data at : 0x3f7fbe : 0x0L 0x0L
    Data at : 0x3f7fc0 : 0x0L 0x0L
    Data at : 0x3f7fc2 : 0x0L 0x0L
    Data at : 0x3f7fc4 : 0x0L 0x0L
    Data at : 0x3f7fc6 : 0x0L 0x0L
    Data at : 0x3f7fc8 : 0x0L 0x0L
    Data at : 0x3f7fca : 0x0L 0x0L
    Data at : 0x3f7fcc : 0x0L 0x0L
    Data at : 0x3f7fce : 0x0L 0x0L
    Data at : 0x3f7fd0 : 0x0L 0x0L
    Data at : 0x3f7fd2 : 0x0L 0x0L
    Data at : 0x3f7fd4 : 0x0L 0x0L
    Data at : 0x3f7fd6 : 0x0L 0x0L
    Data at : 0x3f7fd8 : 0x0L 0x0L
    Data at : 0x3f7fda : 0x0L 0x0L
    Data at : 0x3f7fdc : 0x0L 0x0L
    Data at : 0x3f7fde : 0x0L 0x0L
    Data at : 0x3f7fe0 : 0x0L 0x0L
    Data at : 0x3f7fe2 : 0x0L 0x0L
    Data at : 0x3f7fe4 : 0x0L 0x0L
    Data at : 0x3f7fe6 : 0x0L 0x0L
    Data at : 0x3f7fe8 : 0x0L 0x0L
    Data at : 0x3f7fea : 0x0L 0x0L
    Data at : 0x3f7fec : 0x0L 0x0L
    Data at : 0x3f7fee : 0x0L 0x0L
    Data at : 0x3f7ff0 : 0x0L 0x0L
    Data at : 0x3f7ff2 : 0x0L 0x0L
    Data at : 0x3f7ff4 : 0x0L 0x0L
    Data at : 0x3f7ff6 : 0x0L 0x0L
    Data at : 0x3f7ff8 : 0x0L 0x0L
    Data at : 0x3f7ffa : 0x0L 0x0L
    Data at : 0x3f7ffc : 0x0L 0x0L
    Data at : 0x3f7ffe : 0x0L 0x0L

    Table Data
    Data at : 0x3f4004 : 0x0L 0x0L
    Data at : 0x3f4006 : 0x0L 0x0L
    Data at : 0x3f4008 : 0x0L 0x0L
    Data at : 0x3f400a : 0x0L 0x0L

    CSM Test Complete

  • Wondering whether your DSS script has a debugger reset after you unlock the device. This will lock the device.

  • I wondered that too which is why I added the status check to read the CSMSRC register. There really are not any other API calls between the unlock and the data reads. So in the post above, you can see the status right before the data read is 0 which should indicate the CSM is unlocked.

    Here is the excerpt from the jython DSS script I wrote:

    PROGRAM = 0
    DATA = 1

    # Set enter the key data and command unlock
    DSS.session.memory.writeWord(DATA,2791,60304)
    DSS.session.flash.unlock()

    # Check the status
    ConnStatus = DSS.session.target.isConnected()
    IsLocked = DSS.session.memory.readRegister('CSM_CSMSCR')&0x1
    print "\r\nStatus:\r\n Is Target Connected : " , ConnStatus
    print " Is Target Locked : " , IsLocked, '\r\n'

    # Address of CSM Zeros and PSWD
    ZEROS = int(0x3F7F80)
    PSWD = int(0x3F7FF8)

    print "CSM Data:"
    for i in range(0,128,2,):
    add1 = ZEROS + i
    add2 = ZEROS + i +1
    result1 = DSS.session.memory.readWord(PROGRAM,add1)
    result2 = DSS.session.memory.readWord(PROGRAM,add2)
    print " Data at : ", hex(add1) ," : " , hex(result1) , hex(result2)

  • Jon,

    Will the device get reconnected when you execute this statement?

    ConnStatus = DSS.session.target.isConnected()

    If so, this might lock the device as on a target connect device gets debugger reset. Can you try removing the above statement and see whether CSM passwords are read correctly.

    regards,
    Manoj
  • Hi Manoj,

    I did as you suggested and removed the calls for reading the connection status after unlocking - but still check the CSMSCR register. I still get the same output. It says it is unlocked but returns nothing but zeros.

    Connecting to CPU...
    C28xx: GEL Output:
    Device Calibration not complete, check if device is unlocked and recalibrate.
    Connected to CPU.

    Is Target Locked : 1

    Restarting...
    C28xx: GEL Output:
    Device Calibration not complete, check if device is unlocked and recalibrate.
    CPU Restarted.
    Is Target Locked : 1

    C28xx: Starting device unlocking...

    C28xx: Device unlocked. To clear the programmed password, please erase Sector A
    of Flash memory.

    Is Target Locked : 0

    CSM Data:
    Data at : 0x3f7f80 : 0x0L 0x0L
    Data at : 0x3f7f82 : 0x0L 0x0L
    Data at : 0x3f7f84 : 0x0L 0x0L
    Data at : 0x3f7f86 : 0x0L 0x0L
    Data at : 0x3f7f88 : 0x0L 0x0L
    Data at : 0x3f7f8a : 0x0L 0x0L
    Data at : 0x3f7f8c : 0x0L 0x0L
    Data at : 0x3f7f8e : 0x0L 0x0L
    Data at : 0x3f7f90 : 0x0L 0x0L
    Data at : 0x3f7f92 : 0x0L 0x0L
    Data at : 0x3f7f94 : 0x0L 0x0L
    Data at : 0x3f7f96 : 0x0L 0x0L
    Data at : 0x3f7f98 : 0x0L 0x0L
    Data at : 0x3f7f9a : 0x0L 0x0L
    Data at : 0x3f7f9c : 0x0L 0x0L
    Data at : 0x3f7f9e : 0x0L 0x0L
    Data at : 0x3f7fa0 : 0x0L 0x0L
    Data at : 0x3f7fa2 : 0x0L 0x0L
    Data at : 0x3f7fa4 : 0x0L 0x0L
    Data at : 0x3f7fa6 : 0x0L 0x0L
    Data at : 0x3f7fa8 : 0x0L 0x0L
    Data at : 0x3f7faa : 0x0L 0x0L
    Data at : 0x3f7fac : 0x0L 0x0L
    Data at : 0x3f7fae : 0x0L 0x0L
    Data at : 0x3f7fb0 : 0x0L 0x0L
    Data at : 0x3f7fb2 : 0x0L 0x0L
    Data at : 0x3f7fb4 : 0x0L 0x0L
    Data at : 0x3f7fb6 : 0x0L 0x0L
    Data at : 0x3f7fb8 : 0x0L 0x0L
    Data at : 0x3f7fba : 0x0L 0x0L
    Data at : 0x3f7fbc : 0x0L 0x0L
    Data at : 0x3f7fbe : 0x0L 0x0L
    Data at : 0x3f7fc0 : 0x0L 0x0L
    Data at : 0x3f7fc2 : 0x0L 0x0L
    Data at : 0x3f7fc4 : 0x0L 0x0L
    Data at : 0x3f7fc6 : 0x0L 0x0L
    Data at : 0x3f7fc8 : 0x0L 0x0L
    Data at : 0x3f7fca : 0x0L 0x0L
    Data at : 0x3f7fcc : 0x0L 0x0L
    Data at : 0x3f7fce : 0x0L 0x0L
    Data at : 0x3f7fd0 : 0x0L 0x0L
    Data at : 0x3f7fd2 : 0x0L 0x0L
    Data at : 0x3f7fd4 : 0x0L 0x0L
    Data at : 0x3f7fd6 : 0x0L 0x0L
    Data at : 0x3f7fd8 : 0x0L 0x0L
    Data at : 0x3f7fda : 0x0L 0x0L
    Data at : 0x3f7fdc : 0x0L 0x0L
    Data at : 0x3f7fde : 0x0L 0x0L
    Data at : 0x3f7fe0 : 0x0L 0x0L
    Data at : 0x3f7fe2 : 0x0L 0x0L
    Data at : 0x3f7fe4 : 0x0L 0x0L
    Data at : 0x3f7fe6 : 0x0L 0x0L
    Data at : 0x3f7fe8 : 0x0L 0x0L
    Data at : 0x3f7fea : 0x0L 0x0L
    Data at : 0x3f7fec : 0x0L 0x0L
    Data at : 0x3f7fee : 0x0L 0x0L
    Data at : 0x3f7ff0 : 0x0L 0x0L
    Data at : 0x3f7ff2 : 0x0L 0x0L
    Data at : 0x3f7ff4 : 0x0L 0x0L
    Data at : 0x3f7ff6 : 0x0L 0x0L
    Data at : 0x3f7ff8 : 0x0L 0x0L
    Data at : 0x3f7ffa : 0x0L 0x0L
    Data at : 0x3f7ffc : 0x0L 0x0L
    Data at : 0x3f7ffe : 0x0L 0x0L

    Table Data
    Data at : 0x3f4004 : 0x0L 0x0L
    Data at : 0x3f4006 : 0x0L 0x0L
    Data at : 0x3f4008 : 0x0L 0x0L
    Data at : 0x3f400a : 0x0L 0x0L

  • Hi,

    Any additional suggestions for me to try - I am still stuck not being able to run code with a programmed CSM key.

    Jon

  • I tried another experiement where I loaded the Example_2806xFlash from v136 of the the ControlSuite device support examples and locked it using the same code as above then ran my script. All seems to be working fine. Where should I start looking for an issue? The cmd file? Project settings? It is important to note that my application runs fine from flash WITHOUT the CSM code programmed and it is only when I program in a CSM key does it not longer run and returns all zeros for the script I run.

    Binary : /Example_2806xFlash/Debug/Example_2806xFlash.out

    Connecting to CPU...
    C28xx: GEL Output:
    Device Calibration not complete, check if device is unlocked and recalibrate.
    Connected to CPU.


    Status:
    Is Target Connected : True
    Is Target Locked : 1

    Restarting...
    C28xx: GEL Output:
    Device Calibration not complete, check if device is unlocked and recalibrate.
    CPU Restarted.

    Status:
    Is Target Connected : True
    Is Target Locked : 1

    C28xx: Starting device unlocking...

    C28xx: Device unlocked. To clear the programmed password, please erase Sector A
    of Flash memory.


    Status:
    Is Target Connected : True
    Is Target Locked : 0

    CSM Data:
    Data at : 0x3f7f80 : 0x0L 0x0L
    Data at : 0x3f7f82 : 0x0L 0x0L
    Data at : 0x3f7f84 : 0x0L 0x0L
    Data at : 0x3f7f86 : 0x0L 0x0L
    Data at : 0x3f7f88 : 0x0L 0x0L
    Data at : 0x3f7f8a : 0x0L 0x0L
    Data at : 0x3f7f8c : 0x0L 0x0L
    Data at : 0x3f7f8e : 0x0L 0x0L
    Data at : 0x3f7f90 : 0x0L 0x0L
    Data at : 0x3f7f92 : 0x0L 0x0L
    Data at : 0x3f7f94 : 0x0L 0x0L
    Data at : 0x3f7f96 : 0x0L 0x0L
    Data at : 0x3f7f98 : 0x0L 0x0L
    Data at : 0x3f7f9a : 0x0L 0x0L
    Data at : 0x3f7f9c : 0x0L 0x0L
    Data at : 0x3f7f9e : 0x0L 0x0L
    Data at : 0x3f7fa0 : 0x0L 0x0L
    Data at : 0x3f7fa2 : 0x0L 0x0L
    Data at : 0x3f7fa4 : 0x0L 0x0L
    Data at : 0x3f7fa6 : 0x0L 0x0L
    Data at : 0x3f7fa8 : 0x0L 0x0L
    Data at : 0x3f7faa : 0x0L 0x0L
    Data at : 0x3f7fac : 0x0L 0x0L
    Data at : 0x3f7fae : 0x0L 0x0L
    Data at : 0x3f7fb0 : 0x0L 0x0L
    Data at : 0x3f7fb2 : 0x0L 0x0L
    Data at : 0x3f7fb4 : 0x0L 0x0L
    Data at : 0x3f7fb6 : 0x0L 0x0L
    Data at : 0x3f7fb8 : 0x0L 0x0L
    Data at : 0x3f7fba : 0x0L 0x0L
    Data at : 0x3f7fbc : 0x0L 0x0L
    Data at : 0x3f7fbe : 0x0L 0x0L
    Data at : 0x3f7fc0 : 0x0L 0x0L
    Data at : 0x3f7fc2 : 0x0L 0x0L
    Data at : 0x3f7fc4 : 0x0L 0x0L
    Data at : 0x3f7fc6 : 0x0L 0x0L
    Data at : 0x3f7fc8 : 0x0L 0x0L
    Data at : 0x3f7fca : 0x0L 0x0L
    Data at : 0x3f7fcc : 0x0L 0x0L
    Data at : 0x3f7fce : 0x0L 0x0L
    Data at : 0x3f7fd0 : 0x0L 0x0L
    Data at : 0x3f7fd2 : 0x0L 0x0L
    Data at : 0x3f7fd4 : 0x0L 0x0L
    Data at : 0x3f7fd6 : 0x0L 0x0L
    Data at : 0x3f7fd8 : 0x0L 0x0L
    Data at : 0x3f7fda : 0x0L 0x0L
    Data at : 0x3f7fdc : 0x0L 0x0L
    Data at : 0x3f7fde : 0x0L 0x0L
    Data at : 0x3f7fe0 : 0x0L 0x0L
    Data at : 0x3f7fe2 : 0x0L 0x0L
    Data at : 0x3f7fe4 : 0x0L 0x0L
    Data at : 0x3f7fe6 : 0x0L 0x0L
    Data at : 0x3f7fe8 : 0x0L 0x0L
    Data at : 0x3f7fea : 0x0L 0x0L
    Data at : 0x3f7fec : 0x0L 0x0L
    Data at : 0x3f7fee : 0x0L 0x0L
    Data at : 0x3f7ff0 : 0x0L 0x0L
    Data at : 0x3f7ff2 : 0x0L 0x0L
    Data at : 0x3f7ff4 : 0x0L 0x0L
    Data at : 0x3f7ff6 : 0x7fL 0x47c4L
    Data at : 0x3f7ff8 : 0xffffL 0xffffL
    Data at : 0x3f7ffa : 0xffffL 0xffffL
    Data at : 0x3f7ffc : 0xffffL 0xffffL
    Data at : 0x3f7ffe : 0xffffL 0xeb90L

    Table Data
    Data at : 0x3f4004 : 0x600L 0xe630L
    Data at : 0x3f4006 : 0x5616L 0x2942L
    Data at : 0x3f4008 : 0x6f00L 0x7625L
    Data at : 0x3f400a : 0xfff0L 0x761bL

    CSM Test Complete
  • Okay - I am a little confused. I went looking in my cmd file to see if there were any issues with how the memory was being allocated for the CSM & BEGIN. It looked fine with correct lengths. I then tried to include the file F2806x_CSMPassords.asm from the example flash project that worked - it wouldn't compile giving me length errors for the sections - but my section lengths are seem correct to me:

    CSM_RSVD : origin = 0x3F7F80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
    BEGIN : origin = 0x3F7FF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */
    CSM_PWL_P0 : origin = 0x3F7FF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */

    So I take out the file I added - and now I can read out the data with my script - not sure what happened - I reverted my project files and everything in the directory when backing out the change for the passoword file.

    So I can UNLOCK with a the password I set and read out the contents of memory:

    Connecting to CPU...
    C28xx: GEL Output:
    Device Calibration not complete, check if device is unlocked and recalibrate.
    Connected to CPU.


    Status:
    Is Target Connected : True
    Is Target Locked : 1

    Restarting...
    C28xx: GEL Output:
    Device Calibration not complete, check if device is unlocked and recalibrate.
    CPU Restarted.

    Status:
    Is Target Connected : True
    Is Target Locked : 1

    C28xx: Starting device unlocking...

    C28xx: Device unlocked. To clear the programmed password, please erase Sector A
    of Flash memory.


    Status:
    Is Target Connected : True
    Is Target Locked : 0

    CSM Data:
    Data at : 0x3f7f80 : 0x0L 0x0L
    Data at : 0x3f7f82 : 0x0L 0x0L
    Data at : 0x3f7f84 : 0x0L 0x0L
    Data at : 0x3f7f86 : 0x0L 0x0L
    Data at : 0x3f7f88 : 0x0L 0x0L
    Data at : 0x3f7f8a : 0x0L 0x0L
    Data at : 0x3f7f8c : 0x0L 0x0L
    Data at : 0x3f7f8e : 0x0L 0x0L
    Data at : 0x3f7f90 : 0x0L 0x0L
    Data at : 0x3f7f92 : 0x0L 0x0L
    Data at : 0x3f7f94 : 0x0L 0x0L
    Data at : 0x3f7f96 : 0x0L 0x0L
    Data at : 0x3f7f98 : 0x0L 0x0L
    Data at : 0x3f7f9a : 0x0L 0x0L
    Data at : 0x3f7f9c : 0x0L 0x0L
    Data at : 0x3f7f9e : 0x0L 0x0L
    Data at : 0x3f7fa0 : 0x0L 0x0L
    Data at : 0x3f7fa2 : 0x0L 0x0L
    Data at : 0x3f7fa4 : 0x0L 0x0L
    Data at : 0x3f7fa6 : 0x0L 0x0L
    Data at : 0x3f7fa8 : 0x0L 0x0L
    Data at : 0x3f7faa : 0x0L 0x0L
    Data at : 0x3f7fac : 0x0L 0x0L
    Data at : 0x3f7fae : 0x0L 0x0L
    Data at : 0x3f7fb0 : 0x0L 0x0L
    Data at : 0x3f7fb2 : 0x0L 0x0L
    Data at : 0x3f7fb4 : 0x0L 0x0L
    Data at : 0x3f7fb6 : 0x0L 0x0L
    Data at : 0x3f7fb8 : 0x0L 0x0L
    Data at : 0x3f7fba : 0x0L 0x0L
    Data at : 0x3f7fbc : 0x0L 0x0L
    Data at : 0x3f7fbe : 0x0L 0x0L
    Data at : 0x3f7fc0 : 0x0L 0x0L
    Data at : 0x3f7fc2 : 0x0L 0x0L
    Data at : 0x3f7fc4 : 0x0L 0x0L
    Data at : 0x3f7fc6 : 0x0L 0x0L
    Data at : 0x3f7fc8 : 0x0L 0x0L
    Data at : 0x3f7fca : 0x0L 0x0L
    Data at : 0x3f7fcc : 0x0L 0x0L
    Data at : 0x3f7fce : 0x0L 0x0L
    Data at : 0x3f7fd0 : 0x0L 0x0L
    Data at : 0x3f7fd2 : 0x0L 0x0L
    Data at : 0x3f7fd4 : 0x0L 0x0L
    Data at : 0x3f7fd6 : 0x0L 0x0L
    Data at : 0x3f7fd8 : 0x0L 0x0L
    Data at : 0x3f7fda : 0x0L 0x0L
    Data at : 0x3f7fdc : 0x0L 0x0L
    Data at : 0x3f7fde : 0x0L 0x0L
    Data at : 0x3f7fe0 : 0x0L 0x0L
    Data at : 0x3f7fe2 : 0x0L 0x0L
    Data at : 0x3f7fe4 : 0x0L 0x0L
    Data at : 0x3f7fe6 : 0x0L 0x0L
    Data at : 0x3f7fe8 : 0x0L 0x0L
    Data at : 0x3f7fea : 0x0L 0x0L
    Data at : 0x3f7fec : 0x0L 0x0L
    Data at : 0x3f7fee : 0x0L 0x0L
    Data at : 0x3f7ff0 : 0x0L 0x0L
    Data at : 0x3f7ff2 : 0x0L 0x0L
    Data at : 0x3f7ff4 : 0x0L 0x0L
    Data at : 0x3f7ff6 : 0x7fL 0x4030L
    Data at : 0x3f7ff8 : 0xffffL 0xffffL
    Data at : 0x3f7ffa : 0xffffL 0xffffL
    Data at : 0x3f7ffc : 0xffffL 0xffffL
    Data at : 0x3f7ffe : 0xffffL 0xeb90L

    Table Data
    Data at : 0x3f4004 : 0x7126L 0x9944L
    Data at : 0x3f4006 : 0xd802L 0x2049L
    Data at : 0x3f4008 : 0x2be8L 0x407cL
    Data at : 0x3f400a : 0x9b74L 0x61a1L

    NOW, for what I really wanted to do which is figure out why I cannot run standalone after programming a CSM key. Here is what I have learned:

    This is my test:

    > ERASE all flash sectors
    > program in my application
    > check that it all works fine
    > program in the CSM key using Uniflash 3.0
    > Lock the CSM using Uniflash
    > Cycle power to my board -> my code does not run

    > but if I run my script to unlock and read memory -> it works and does read the memory THEN it starts running (I assume it commands a restart)

    So it seems like my real issue that that AFTER programming a CSM key, when the processor comes out of reset it does not run, but if I UNLOCK it using session.flash.unlock() - and command a reset, restart, runAsynch - > it runs.