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.
Hi Expert,
I got request from customer to have dcsm program Z1 with a unique password and Z2 with a default password
Can you please give me an example to program dcsm Z1 and Z2 setting via uniflash command line ?
I am thinking about using sterie's approach in the link below but it looks like sterie had run into problem after execute the command
i don't have mcu left to retry , can Experts confirm that is a valid way to program dcsm with uniflash commandline ?
Thanks
Hi Vincent,
I am looping in Ricky Lau, our Uniflash expert provide best solution on this.
Regards,
Vivek Singh
Hi Vincent,
The thread you posted is related to UniFlash 3.4. The latest version of UniFlash has updated the command line syntax, so it would look a little different, but general concept is similar.
So, an example command for programming the Zone1 password on F280049 would be:
> dslite -c <ccxml> -s Z1B0CSMPSWD0=1234ABCD -b Z1PasswordProgram -e
Please let me know if this works for you.
Thanks,
Ricky
thanks for the reply ,
C:\ti\uniflash_5.1.0\dslite.bat --mode flash -c C:\Users\vincentyllin\Desktop\uniflash_cmdline\TMS320F280049.ccxml -e -g C:\Users\vincentyllin\Desktop\uniflash_cmdline\program.txt -v -s Z1B0OTPGPREG1=5AFFFFFF -s Z1B0OTPGPREG2=5AFFFFFF -s Z1B0OTPGPREG3=FFFFFF03 -s Z1B0PSWDLOCK=FB7FFFF0 -s Z1B0CRCLOCK=4BFFFFFF -s Z1B0CSMPSWD3=12345678 -s Z1B0CSMPSWD2=12345678 -s Z1B0CSMPSWD1=47FFFFFF -s Z1B0CSMPSWD0=12345678 -s Z1B0GRABSECT=AAAAAA55 -s Z1B0GRABRAM=0000AAAA -s Z1B0EXEONLYSECT=0000FFF0 -s Z1B0EXEONLYRAM=000000FF -s Z1B1GRABSECT=AAAAAAAA -s Z1B1EXEONLYSECT=0000FFFF -s Z2B0OTPGPREG1=5AFFFFFF -s Z2B0OTPGPREG2=5AFFFFFF -s Z2B0OTPGPREG3=FFFFFF03 -s Z2B0CRCLOCK=0FFFFFFF -s Z2B0PSWDLOCK=BF7FFFF0 -s Z2B0GRABSECT=555556AA -s Z2B0GRABRAM=0000AAAA -s Z2B0EXEONLYSECT=0000001F -s Z2B0EXEONLYRAM=000000FF -s Z2B1GRABSECT=55555555 -s Z2B1EXEONLYSECT=00000000 -b Z1PasswordProgram -b Z2PasswordProgram -b Z1Unlock -b Z1B0AllProgram -b Z1B1AllProgram -b Z2B0AllProgram -b Z2B1AllProgram
the load setting argument doesn't load setting file properly , so i end up typing whole dcsm setting onto the argument. it looks like the above the command can program the dcsm into the mcu,
i run into another problem , i have two image in flash , one image is in B0 Sect 0-3 , the rest of the sector are the second image ,
Once I confirm the second image's integrity I use following command to boot into second image.
#define Image1_AppCode (int (*)(void))Bzero_Sector4_start
(*Image1_AppCode)();
It was working fine before dcsm is programmed, now I set Z1 to protect first image with exeonly and Z2 protect second image with exeonly,
Do I need to unlock Z2 before boot into second image ?
Vincent,
Vivek might be able to answer your security related question.
For the issue with loading security settings via file, this was a bug that was caused by the order of loading the settings from file, and then connecting to the device which overwrote the user settings. It looks like you are using v5.1.0; This issue should be fixed in the latest version of UniFlash. Setting each option separately in the command works as well as you noted.
Thanks,
Ricky
I used following command from uniflash to program dcsm settings, it did program the setting into OTP , however
C:\ti\uniflash_5.1.0\dslite.bat --mode flash -c C:\Users\vincentyllin\Desktop\uniflash_cmdline\TMS320F280049.ccxml -e -g C:\Users\vincentyllin\Desktop\uniflash_cmdline\program.txt -v -s Z1B0OTPGPREG1=5AFFFFFF -s Z1B0OTPGPREG2=5AFFFFFF -s Z1B0OTPGPREG3=FFFFFF03 -s Z1B0PSWDLOCK=FB7FFFF0 -s Z1B0CRCLOCK=4BFFFFFF -s Z1B0CSMPSWD3=12345678 -s Z1B0CSMPSWD2=12345678 -s Z1B0CSMPSWD1=47FFFFFF -s Z1B0CSMPSWD0=12345678 -s Z1B0GRABSECT=AAAAAA55 -s Z1B0GRABRAM=0000AAAA -s Z1B0EXEONLYSECT=0000FFF0 -s Z1B0EXEONLYRAM=000000FF -s Z1B1GRABSECT=AAAAAAAA -s Z1B1EXEONLYSECT=0000FFFF -s Z2B0OTPGPREG1=5AFFFFFF -s Z2B0OTPGPREG2=5AFFFFFF -s Z2B0OTPGPREG3=FFFFFF03 -s Z2B0CRCLOCK=0FFFFFFF -s Z2B0PSWDLOCK=BF7FFFF0 -s Z2B0GRABSECT=555556AA -s Z2B0GRABRAM=0000AAAA -s Z2B0EXEONLYSECT=0000001F -s Z2B0EXEONLYRAM=000000FF -s Z2B1GRABSECT=55555555 -s Z2B1EXEONLYSECT=00000000 -b Z1PasswordProgram -b Z2PasswordProgram -b Z1Unlock -b Z1B0AllProgram -b Z1B1AllProgram -b Z2B0AllProgram -b Z2B1AllProgram
However I run into similar problem with this post 2 years ago.
where MCU's flash registers show error in the 0x78014 , 0x78014, like the link shown above.
I am not sure if this is a bug my MCU/Uniflash ,so I decide to find a new f280049 mcu and program dcsm without touching pswdlockand crclock with following commnad
C:\ti\uniflash_5.1.0\dslite.bat --mode flash -c C:\Users\vincentyllin\Desktop\uniflash_cmdline\TMS320F280049.ccxml -e -g C:\Users\vincentyllin\Desktop\uniflash_cmdline\program.txt -v -s Z1B0OTPGPREG1=5AFFFFFF -s Z1B0OTPGPREG2=FFFFFFFF -s Z1B0OTPGPREG3=FFFFFF03 -s Z1B0CSMPSWD3=12345678 -s Z1B0CSMPSWD2=12345678 -s Z1B0CSMPSWD1=47FFFFFF -s Z1B0CSMPSWD0=12345678 -s Z1B0GRABSECT=AAAAAA55 -s Z1B0GRABRAM=0000AAAA -s Z1B0EXEONLYSECT=0000FFF0 -s Z1B0EXEONLYRAM=000000FF -s Z1B1GRABSECT=AAAAAAAA -s Z1B1EXEONLYSECT=0000FFFF -s Z2B0OTPGPREG1=5AFFFFFF -s Z2B0OTPGPREG2=5AFFFFFF -s Z2B0OTPGPREG3=FFFFFF03 -s Z2B0CRCLOCK=0FFFFFFF -s Z2B0PSWDLOCK=BF7FFFF0 -s Z2B0GRABSECT=555556AA -s Z2B0GRABRAM=0000AAAA -s Z2B0EXEONLYSECT=0000001F -s Z2B0EXEONLYRAM=000000FF -s Z2B1GRABSECT=55555555 -s Z2B1EXEONLYSECT=00000000 -b Z1PasswordProgram -b Z1Unlock -b Z2Unlock -b Z1B0LINKPOINTERProgram -b Z1GPREGProgram -b Z1OTPBOOTCTRLProgram -b Z1B0GRABProgram -b Z1B0EXEONLYProgram -b Z1B1LINKPOINTERProgram -b Z1B1GRABProgram -b Z1B1EXEONLYProgram -b Z2B0LINKPOINTERProgram -b Z2GPREGProgram -b Z2OTPBOOTCTRLProgram -b Z2B0GRABProgram -b Z2B0EXEONLYProgram -b Z2B1LINKPOINTERProgram -b Z2B1GRABProgram -b Z2B1EXEONLYProgram
after program , It still stuck in boot-rom,
1. Load the boot-rom symbol
2. Change bootpin_config_key to 0xA5
3. Successfully read OTP and gointo case of flash boot with 0x80000 as entryaddress
4. return 0x80000 as starting address
5. went into illegal interrupt after
However if I unlock dcsm z1 with mcu register before return EntryAddr, it has no problem boot into my flash image
Am I not able to run flash image when the flash sector is secure by Z1 as EXEONLY?
Hi,
It was working fine before dcsm is programmed, now I set Z1 to protect first image with exeonly and Z2 protect second image with exeonly,
Do I need to unlock Z2 before boot into second image ?
No, code should be able to jump to secure function from unsecure so unlocking Z2 is not needed.
Am I not able to run flash image when the flash sector is secure by Z1 as EXEONLY?
No, it should not matter. Where is your stack ? Make sure that is not placed into any secure RAM.
Regards,
Vivek Singh
MEMORY { PAGE 0 : /* BEGIN is used for the "boot to Flash" bootloader mode */ BEGIN : origin = 0x080000, length = 0x000002 RAMM0 : origin = 0x0000F5, length = 0x00030B BOOT_FLASH : origin = 0x080002, length = 0x003FFE /* on-chip Flash */ /* BANK0_SEC0 ~ BANK0_SEC3 */ RAMLS0 : origin = 0x008000, length = 0x000800 RESET : origin = 0x3FFFC0, length = 0x000002 PAGE 1 : BOOT_RSVD : origin = 0x000002, length = 0x0000F3 /* Part of M0, BOOT rom will use this for stack */ RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */ RAMLS1 : origin = 0x008800, length = 0x003800 RAMGS : origin = 0x00C000, length = 0x008000 } SECTIONS { codestart : > BEGIN, PAGE = 0, ALIGN(4) .text : > BOOT_FLASH, PAGE = 0, ALIGN(4) .cinit : > BOOT_FLASH, PAGE = 0, ALIGN(4) .pinit : > BOOT_FLASH, PAGE = 0, ALIGN(4) .switch : > BOOT_FLASH, PAGE = 0, ALIGN(4) .reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */ .stack : > RAMGS, PAGE = 1 .ebss : >>RAMLS1 | RAMGS , PAGE = 1 .esysmem : > RAMGS, PAGE = 1 .econst : > BOOT_FLASH, PAGE = 0, ALIGN(4) ramgs0 : > RAMGS, PAGE = 1 ramgs1 : > RAMGS, PAGE = 1 .TI.ramfunc : LOAD = BOOT_FLASH, RUN = RAMLS0, LOAD_START(_RamfuncsLoadStart), LOAD_SIZE(_RamfuncsLoadSize), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), RUN_SIZE(_RamfuncsRunSize), RUN_END(_RamfuncsRunEnd), PAGE = 0, ALIGN(4) } /* //=========================================================================== // End of file. //=========================================================================== */
I have put the stack in the RAMGS section and I didn't block any ram in the dcsm.
b0 sector 0 - 3 is secure as EXEONLY in Z1.
I have talk to TI's FAE @Wayne Huang from Taiwan , he suggest to use secure instead of execute only , now it looks like it has successfully run into application.
I Still haven't program Z1B0PSWDLOCK section, Ricky Lau Vivek Singh can you please have a look why
-b Z1B0AllProgram -b Z1B1AllProgram -b Z2B0AllProgram -b Z2B1AllProgram will brick the unit ?
Vincent,
Z1B0PSWDLOCK (and Z1B0CRCLOCK) are programmed via the Z1OTPSECLOCKProgram operation, so you will need to add that to your command if you want to program Z1B0PSWDLOCK.
I'm not aware of the "AllProgram" operations bricking device. It should just execute each of the available security programming operations sequentially.
Thanks,
Ricky
Hi Ricky , is it ok to add these two command at -b Z1OTPSECLOCKProgram -b Z2OTPSECLOCKProgram
at the end of the following?
-b Z1PasswordProgram -b Z2PasswordProgram -b Z1Unlock -b Z2Unlock -b Z1B0LINKPOINTERProgram -b Z1GPREGProgram -b Z1OTPBOOTCTRLProgram -b Z1B0GRABProgram -b Z1B0EXEONLYProgram -b Z1B1LINKPOINTERProgram -b Z1B1GRABProgram -b Z1B1EXEONLYProgram -b Z2B0LINKPOINTERProgram -b Z2GPREGProgram -b Z2OTPBOOTCTRLProgram -b Z2B0GRABProgram -b Z2B0EXEONLYProgram -b Z2B1LINKPOINTERProgram -b Z2B1GRABProgram -b Z2B1EXEONLYProgram
I'm not aware of the "AllProgram" operations bricking device. It should just execute each of the available security programming operations sequentially.
I did confirm it brick the unit though
Vincent,
Adding "-b Z1OTPSECLOCKProgram" and "-b Z2OTPSECLOCKProgram" would perform the Z1 and Z2 OTPSECLOCK programming. All the -b operations will be done in the order you provide it. You can ask Vivek if this is the preferred way to program OTPSECLOCK and other security fields on your device if needed.
As for "AllProgram" bricking your device, if you still have the console output from running the command, or the error message you are getting now when trying to connect to the device, maybe Vivek can help figure out what happened to the device.
Thanks,
Ricky