Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN, , UNIFLASH
In this thread i am going to explain step by step procedure for AJSM locking and unlocking for Hercules Microcontrollers.
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.
Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN, , UNIFLASH
In this thread i am going to explain step by step procedure for AJSM locking and unlocking for Hercules Microcontrollers.
Locking Procedure:
1. Open HALCoGen file of your project in HALCoGen, and notedown the TI Visible key

In my case it is 0xEFFDFFFF 0xFFFFFFFF 0xFFFDFFFE 0xFFEFFFFF
2. Now give a new key based on your requirement, here for testing i am changing only one bit of the key like as shown below

After changing key, you need to do save key and calculate ECC.
3. Now enable AJSM driver and generate the code.

4. This will generate ajsm.asm file with new code like as shown below:

5. Now modify .cmd file, add AJSM and AJSMECC sections:

6. Now build the project and flash the code into microcontroller, this will lock the JTAG by performing lock code into JTAG AJSM key area.
Here is my locking code for the reference:
Unlocking Procedure:
AJSM unlocking can be done in two ways,
1. CMD based unlocking using dbgauth tool
2. CCS based unlocking using gel files
Here is the step-by-step procedure for both the methods:
1. CMD based unlocking using dbgauth tool:
i) Copy "tms570ls3137_secure.xml" file to the targetdb path (C:\ti\ccs1250\ccs\ccs_base\common\targetdb\devices) like as shown below:
You can find this xml in attached project of AJSM App notes or else you can download from here as well:
<?xml version="1.0" encoding="utf-8"?>
<!-- (c) Texas Instruments 2008-2019, All rights reserved. -->
<!-- Filename:TMS570LS3137.xml -->
<!-- Version: 1.0 -->
<!-- - Preliminary, imported from TMS570LS2x -->
<!-- 01 May 2011 -->
<device id="TMS570LS3137" partnum="TMS570LS3137" HW_revision="1" XML_version="1" desc="TMS570LS3137 (SECURE)" description="TMS570LS3137 QFP/BGA, 3MB Flash, 256kB RAM, 2ch FlexRay, 10/100M Ethernet">
<property Type="stringfield" Value="real time" id="Startup Mode"/>
<instance XML_version="1.2" desc="IcePick" href="routers/icepick_c.xml" id="IcePick_C_0" xml="icepick_c.xml" xmlpath="routers"/>
<router HW_revision="1.0" XML_version="1.2" description="ICEPick_C Router" id="IcePick_C_0" isa="ICEPICK_C">
<subpath desc="Port16" id="Port16">
<property Type="numericfield" Value="16" id="Port Number"/>
<property Type="choicelist" Value="1" id="Initial Configuration"/>
<property Type="choicelist" Value="1" id="Custom Configuration"/>
<property Type="choicelist" Value="0" id="Force Configuration"/>
<instance XML_version="1.2" desc="Dap" href="routers/cs_dap.xml" id="CS_DAP_0" xml="cs_dap.xml" xmlpath="routers"/>
<router HW_revision="" XML_version="1.2" description="CS_DAP Router" id="CS_DAP_0" isa="CS_DAP">
<property Type="filepathfield" Value="../../emulation/gel/ajsm/dap_util.gel" id="GEL File"/>
<subpath desc="PortR4" id="PortR4">
<property Type="choicelist" Value="0" id="Type"/>
<property Type="numericfield" Value="0" id="Port Number"/>
<property Type="choicelist" Value="1" id="Initial Configuration"/>
<property Type="choicelist" Value="1" id="Custom Configuration"/>
<property Type="choicelist" Value="0" id="Force Configuration"/>
<property Type="choicelist" Value="1" id="Pseudo"/>
<instance XML_version="1.2" desc="CortexR4" href="cpus/cortex_r4.xml" id="Cortex_R4_0" xml="cortex_r4.xml" xmlpath="cpus"/>
<cpu HW_revision="" XML_version="1.2" desc="CortexR4" description="Cortex_R4 CPU" id="Cortex_R4_0" isa="Cortex_R4">
<!-- Project Wizard Settings -->
<property Type="stringfield" Value="--silicon_version=7R4 --float_support=VFPv3D16 --abi=eabi --enum_type=packed --elf" id="CompilerBuildOptions" />
<property Type="stringfield" Value="--be32 --heap_size=0x800 --stack_size=0x800" id="LinkerBuildOptions"/>
<property Type="stringfield" Value="rtsv7R4_T_be_v3D16_eabi.lib" id="RTSlib" />
<property Type="stringfield" Value="4.5.1" id="MinCodegenVersion" />
<property Type="stringfield" Value="true" id="IsElfDefault" />
<!-- END Project Wizard Settings -->
<property Type="numericfield" Value="0x02000100" id="Access Port Designator"/>
<property Type="numericfield" Value="0x80001000" id="Address"/>
<property Type="filepathfield" Value="../../emulation/gel/tms570ls3137.gel" id="GEL File"/>
<!-- Additional Core Registers -->
<instance href="../Modules/hercules/cp15_cortexr4f_r1p3.xml" id="Cp15" xml="cp15_cortexr4f_r1p3.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7C200" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/vfp_cortexr4f_r1p3.xml" id="Vfp" xml="vfp_cortexr4f_r1p3.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7C000" size="0x1FF" accessnumbytes="4" permissions="p" />
<!-- Periphal Modules Registers -->
<instance href="../Modules/hercules/hercules_awm_spec_0.7.3.xml" id="MibAdc2" xml="hercules_awm_spec_0.7.3.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7C200" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_awm_spec_0.7.3.xml" id="MibAdc1" xml="hercules_awm_spec_0.7.3.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7C000" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_dcan_spec_1.3.2.xml" id="Dcan3" xml="hercules_dcan_spec_1.3.2.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7E000" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_dcan_spec_1.3.2.xml" id="Dcan2" xml="hercules_dcan_spec_1.3.2.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7DE00" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_dcan_spec_1.3.2.xml" id="Dcan1" xml="hercules_dcan_spec_1.3.2.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7DC00" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_emac_tms570ls3x.xml" id="EMAC" xml="hercules_emac_tms570ls3x.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFCF78000" size="0x7FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_cpgmac_tms570ls3x.xml" id="CPGMAC" xml="hercules_cpgmac_tms570ls3x.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFCF78800" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_mdio_tms570ls3x.xml" id="MDIO" xml="hercules_mdio_tms570ls3x.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFCF78900" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_frcc_spec_2.3.2.xml" id="FlexRay" xml="hercules_frcc_spec_2.3.2.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7C800" size="0x7FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_frtu_spec_2.3.2.xml" id="FlexRayTU" xml="hercules_frtu_spec_2.3.2.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7A000" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_gio_general_spec_1.2.1.xml" id="Gio" xml="hercules_gio_general_spec_1.2.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7BC00" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_gio_port_a_spec_1.2.1.xml" id="GioA" xml="hercules_gio_port_a_spec_1.2.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7BC00" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_gio_port_b_spec_1.2.1.xml" id="GioB" xml="hercules_gio_port_b_spec_1.2.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7BC00" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_i2c_tms570ls3x.xml" id="I2C" xml="hercules_i2c_tms570ls3x.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7D400" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_nhet_spec_1.1.5.xml" id="Nhet1" xml="hercules_nhet_spec_1.1.5.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7B800" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_nhet_spec_1.1.5.xml" id="Nhet2" xml="hercules_nhet_spec_1.1.5.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7B900" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_htu_spec_1.1.1d.xml" id="Htu1" xml="hercules_htu_spec_1.1.1d.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7A400" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_htu_spec_1.1.1d.xml" id="Htu2" xml="hercules_htu_spec_1.1.1d.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7A500" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_iomm_tms570ls3x.xml" id="IOMM" xml="hercules_iomm_tms570ls3x.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFEA00" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_mibspip_spec_3.5.1.xml" id="MibSpi1" xml="hercules_mibspi_spec_3.5.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7F400" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_mibspip_spec_3.5.1.xml" id="Spi2" xml="hercules_mibspi_spec_3.5.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7F600" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_mibspip_spec_3.5.1.xml" id="MibSpi3" xml="hercules_mibspi_spec_3.5.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7F800" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_mibspip_spec_3.5.1.xml" id="Spi4" xml="hercules_mibspi_spec_3.5.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7FA00" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_mibspip_spec_3.5.1.xml" id="MibSpip5" xml="hercules_mibspi_spec_3.5.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7FC00" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_sciblin_spec_2.0.2.xml" id="Lin2" xml="hercules_sciblin_spec_2.0.2.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7E500" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_sciblin_spec_2.0.2.xml" id="Lin1" xml="hercules_sciblin_spec_2.0.2.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF7E400" size="0xFF" accessnumbytes="4" permissions="p" />
<!-- System Modules Registers -->
<instance href="../Modules/hercules/hercules_ccmr4_spec_1.5.0.xml" id="CcmR4" xml="hercules_ccmr4_spec_1.5.0.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFF600" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_mcrc_spec_1.1.1.xml" id="Crc" xml="hercules_mcrc_spec_1.1.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFE000000" size="0xFFFFFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_dcc_spec_2.4.1.xml" id="Dcc1" xml="hercules_dcc_spec_2.4.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFEC00" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_dcc_spec_2.4.1.xml" id="Dcc2" xml="hercules_dcc_spec_2.4.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFF400" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_dma_spec_1.2.0.xml" id="Dma" xml="hercules_dma_spec_1.2.0.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFF000" size="0x3FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_dmm_spec_1.5.1.xml" id="Dmm" xml="hercules_dmm_spec_1.5.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFF700" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_esm_spec_1.0.4.xml" id="Esm" xml="hercules_esm_spec_1.0.4.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFF500" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_fwm_spec_3.0.10.xml" id="FlashWrapper" xml="hercules_fwm_spec_3.0.10.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFF87000" size="0xFFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_pbist_spec_2.6.1.xml" id="Pbist" xml="hercules_pbist_spec_2.6.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFE400" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_pmm_tms570ls3x.xml" id="PMM" xml="hercules_pmm_tms570ls3x.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFF0000" size="0x1FF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_rtp_spec_2.4.0.xml" id="Rtp" xml="hercules_rtp_spec_2.4.0.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFFA00" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_rti_spec_3.2.1.xml" id="Rti" xml="hercules_rti_spec_3.2.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFFC00" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_stc_spec_1.3.0.xml" id="Stc" xml="hercules_stc_spec_1.3.0.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFE600" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_sys_spec_4.7.2.xml" id="Sys" xml="hercules_sys_spec_4.7.2.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFFF00" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_sys2_spec_4.7.2.xml" id="Sys2" xml="hercules_sys2_spec_4.7.2.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFE100" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_vim_spec_1.6.1.xml" id="Vim" xml="hercules_vim_spec_1.6.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFFE00" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_vimpar_spec_1.2.1.xml" id="VimPar" xml="hercules_vimpar_spec_1.2.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFFD00" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_pom_spec_1.8.1.xml" id="Pom" xml="hercules_pom_spec_1.8.1.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFA04000" size="0xFFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_emif_spec_2.5.5.xml" id="Emif" xml="hercules_emif_spec_2.5.5.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFCFFE800" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_pcr_spec_4.7.2.xml" id="Pcr" xml="hercules_pcr_spec_4.7.2.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFE000" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_rwm_spec_1.0.0.xml" id="RamWrapper_Even" xml="hercules_rwm_spec_1.0.0.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFF800" size="0xFF" accessnumbytes="4" permissions="p" />
<instance href="../Modules/hercules/hercules_rwm_spec_1.0.0.xml" id="RamWrapper_Odd" xml="hercules_rwm_spec_1.0.0.xml" xmlpath="../Modules/hercules/" HW_revision="1.0" description="" requestor="TMS470RDX" baseaddr="0xFFFFF900" size="0xFF" accessnumbytes="4" permissions="p" />
</cpu>
</subpath>
</router>
</subpath>
<subpath desc="Port17" id="Port17">
<property Type="numericfield" Value="17" id="Port Number"/>
</subpath>
<subpath desc="Port18" id="Port18">
<property Type="numericfield" Value="18" id="Port Number"/>
<instance XML_version="1.2" desc="AJSM" href="cpus/ajsm.xml" id="AJSM" xml="ajsm.xml" xmlpath="cpus"/>
<cpu HW_revision="1.0" XML_version="1.2" description="AJSM" deviceSim="false" id="AJSM" isa="AJSM">
<property Type="filepathfield" Value="../../emulation/gel/ajsm/ajsm_util.gel" id="GEL File"/>
</cpu>
</subpath>
</router>
</device>
<!--End Of File -->

ii) Now open target configuration file in project and change device from "TMS570LS3137" to "TMS570LS3137 (SECURE)" like as shown below:

iii) Now save the changes and perform "Test Connection"

iv) This will generate testBoard.dat in the path highlighted below:

v)Copy above generated testBoard.dat file to the "dbgauth" tool path (C:\ti\ccs1250\ccs\ccs_base\common\uscif) like as shwown below:

vi) Now calculate the Unlock key from "TI Visible Key" and "configured Customer Key", like as shown below:

Unlock key is the XOR of TI Visible Key and Customer Key, and after generating this unlock key then we need to do reverse 32-bit order for to get final unlock key for our configured key.
You can use this excel for calculation purpose:
AJSM Unlock Key calculation.xlsx
vi) Now prepare dbgauth cmd like as given in 10th row of the above excel with the calculated final unlock key.
For my inputs i got cmd as this: dbgauth -c testBoard.dat -s ajsm -t cortexr4 -k 00000000000000000000000000000001 -m 1
vii) Now open cmd at location "C:\ti\ccs1250\ccs\ccs_base\common\uscif" and run the above command to unlock the JTAG.

This should unlock the JTAG like as shown above, and now JTAG remains unlocked state until we do PoR. So we can program the flash through either CCS or Uniflash tools.
2. CCS based unlocking using gel files:
i) Perform till step-v in "CMD based unlocking using dbgauth tool" method.
ii) Now create "ajsm" folder in GEL path of CCS "C:\ti\ccs1250\ccs\ccs_base\emulation\gel". And move "ajsm_util.gel" and "dap_util.gel" to this created folder like as shown below:

You can find these gel's in attached project of AJSM App notes or else you can download from here as well:
iii) Now in project open target configuration file and give unlock code at AJSM (Port18) like as shown below:

iv) Now save and launch this modified target configuration.

v) Now right click on the core and connect the core:

vi) Now core should get connect like as shown below:

vii) Now you can reset the core and can flash the required firmware and can debug the core.