TMS320F28P550SJ: Uniflash CLI unlocking and programming

Part Number: TMS320F28P550SJ
Other Parts Discussed in Thread: UNIFLASH

Tool/software:

Hi Uniflash Expert,

I am making a Uniflash CLI demo for customer. 

From the related question, I see there's some issue using the setting files therefore Vincent put all configuration into arguments. Is this still the case in the latest 9.4.0 Uniflash?

If yes, how to program a new password to a locked device? This requires different password for locking and unlocking, and the argument only takes one set of passwords as input.

If the latest Uniflash already supports using setting files to unlock and lock the device, could you please give an example achieving the above?

Regards,

Hang. 

  • Hi Hang,

    >How to program a new password to a locked device?

    This will require a two-pass approach, first unlocking the device from the CLI tool, loading the new program file, and second issuing a new program password command with value for program changed as a setting, for example:

    1st PASS:

    set GENERATED_COMMAND=-c user_files/configs/f28p550sj9.ccxml -l user_files/settings/generated.ufsettings -s VerifyAfterProgramLoad="No verification" -e -f -v "user_files/images/led_ex1_blinky.out" -b Z1Unlock -s Z1CSMPSWD0=0xFFFFFFFF -s Z1CSMPSWD1=0x4D7FFFFF -s Z1CSMPSWD2=0xFFFFFFFF -s Z1CSMPSWD3=0xFFFFFFFF

    2nd PASS:

    set GENERATED_COMMAND2=-c user_files/configs/f28p550sj9.ccxml -l user_files/settings/generated.ufsettings -s VerifyAfterProgramLoad="No verification" -e -a Z1Program -s Z1CSMPSWD0=0xFFFFFFFF -s Z1CSMPSWD1=0x4D7FFFFF -s Z1CSMPSWD2=0xFFFFFFFF -s Z1CSMPSWD3=0xFFFFFFFF
    I should note that this is done in a two-pass approach due to how the UniFlash settings recognizes the -s parameter(s) being given (it will be used for both Z1Unlock and Z1Program if left in the same GENERATED_COMMAND line, which can cause error). I'm attaching a generated CPU1 bat script file (as .txt) that has been modified for this use case. If you want to test the 2nd PASS first without programming a password, please replace Z1Program with Z1Unlock and change one of the Z1CSMPSWD values to a non-default value to see error functionality. Also, if you wish to run in one back to back sequence, you can remove the pause lines from the .bat script so you won't have to press a button.
    @echo off
    setlocal
    setlocal ENABLEDELAYEDEXPANSION
    
    REM Path to this batch script
    set UNIFLASH_PATH=%~dp0
    
    REM Path to DebugServer folder
    set DEBUGSERVER_ROOT=%~dp0ccs_base\DebugServer\
    
    set MODE=flash
    set EXECUTABLE="!DEBUGSERVER_ROOT!bin\DSLite"
    
    set GENERATED_COMMAND=-c user_files/configs/f28p550sj9.ccxml -l user_files/settings/generated.ufsettings -s VerifyAfterProgramLoad="No verification" -e -f -v "user_files/images/led_ex1_blinky.out" -b Z1Unlock -s Z1CSMPSWD0=0xFFFFFFFF -s Z1CSMPSWD1=0x4D7FFFFF -s Z1CSMPSWD2=0xFFFFFFFF -s Z1CSMPSWD3=0xFFFFFFFF
    set GENERATED_COMMAND2=-c user_files/configs/f28p550sj9.ccxml -l user_files/settings/generated.ufsettings -s VerifyAfterProgramLoad="No verification" -e -a Z1Unlock -s Z1CSMPSWD0=0xFFFFFFFF -s Z1CSMPSWD1=0x4D7FFFFF -s Z1CSMPSWD2=0xFFFFFFFF -s Z1CSMPSWD3=0xFFFFFFFF
    set ADDITIONALS=
    
    REM list available modes
    if "%1"=="--listMode" (
    	echo.
    	
    	echo Usage: dslite --mode ^<mode^> arg
    	echo.
    	
    	echo Available Modes for UniFlash CLI:
    	echo   * flash [default] - on-chip flash programming
    	echo   * memory          - export memory to a file
    	echo   * load            - simple loader [use default options]
    	echo   * serial          - serial flash programming
    	echo   * noConnectFlash  - bypasses connect sequence during flash; for programming a blank CC23xx device
    if exist !DEBUGSERVER_ROOT!drivers\MSP430Flasher.exe (
    	echo   * mspflasher      - support MSPFlasher command line parameters [deprecated]
    )
    	
    	exit /b 0
    )
    
    REM no parameters given, use the default generated command
    if "%1" EQU "" (
    	echo Executing Unlock and Program:
    	echo ^> dslite --mode !MODE! !GENERATED_COMMAND! !ADDITIONALS!
    	echo.
    	
    	CMD /S /C "%EXECUTABLE% !MODE! !GENERATED_COMMAND! !ADDITIONALS!"
    	pause
    
    	echo Executing Password Lock:
    	echo ^> dslite --mode !MODE! !GENERATED_COMMAND2! !ADDITIONALS!
    	echo.
    	
    	CMD /S /C "%EXECUTABLE% !MODE! !GENERATED_COMMAND2! !ADDITIONALS!"
    	pause
    	exit /b !errorlevel!
    )
    
    REM user options parsing
    set USEROPTIONS=%*
    
    REM user options without the --mode
    set "_args=%*"
    set "_args=!_args:*%1 =!"
    set "_args=!_args:*%2 =!"
    
    if "%3"=="" (
    	set USEROPTIONS2=
    ) else (
    	set USEROPTIONS2=!_args!
    )
    
    REM custom mode from users
    if "%1" EQU "--mode" (
    	set MODE=%2
    	set USEROPTIONS=!USEROPTIONS2!
    )
    
    REM default user options if none given
    if "!USEROPTIONS!" EQU "" (
    	set USEROPTIONS=-h
    )
    
    REM mspflasher support
    if "%MODE%" EQU "mspflasher" (
    	set EXECUTABLE=!DEBUGSERVER_ROOT!drivers\MSP430Flasher.exe
    	set MODE=
    )
    
    REM execute with given user parameters
    echo Executing the following command:
    if "!MODE!" EQU "" (
    	echo ^> !EXECUTABLE! !USEROPTIONS! !ADDITIONALS!
    ) else (
    	echo ^> !EXECUTABLE! !MODE! !USEROPTIONS! !ADDITIONALS!
    )
    echo.
    
    echo For more details and examples, please visit https://software-dl.ti.com/ccs/esd/uniflash/docs/latest_qsguide.html#command-line-interface
    echo.
    
    CMD /S /C "%EXECUTABLE% !MODE! !USEROPTIONS! !ADDITIONALS!"
    exit /b !errorlevel!
    Thanks and regards,
    Charles